A SceneProcessor object can do more or less anything with the Scene. This base class exists to allow novel use of things like the visitor design pattern with arbitrary operations on scene objects. A common subclass implementation would be to render the scene somehow, but other operations such as applying some kind of movement to the scene or updating certain properties of objects in the scene would be just as valid.
See process() for more details about how the scene processor is intended to be implemented and used.
SceneProcessor is a specialization of SceneItemProcessor (which does very little without specialization). SceneProcessor makes some assumptions about how the user wants to process a scene, specifically in that it assumes that we wish to skip any scene item which is not enabled. A disabled item's children will also not be parsed. The visitImpl methods should be overriden to implement custom behaviour based on this premise.
bool postVisits |
( |
Scene & |
scene | ) |
|
|
overrideprotectedvirtual |
- Parameters
-
scene | The scene being visited. |
This function should only ever be called by process(). Client code should not call it directly. The default implementation performs a check on this condition and returns true
if the function is being called within a call to process(), or false
otherwise. The default implementation performs no other action.
Subclasses may wish to provide their own implementation for postVisits() in order to clean up internal data structures or finalize some aspect of the processing. They are not required to call this base class implementation if they do so.
Reimplemented from SceneItemProcessor.
Reimplemented in SceneTransformProcessor.
bool preVisits |
( |
Scene & |
scene | ) |
|
|
overrideprotectedvirtual |
- Parameters
-
scene | The scene being visited. |
This function should only ever be called by process(). Client code should not call it directly. The default implementation performs a check on this condition and returns true
if the function is being called within a call to process(), or false
otherwise. The default implementation performs no other action.
Subclasses may wish to provide their own implementation for preVisits() in order to set up their own internal data structures. They are not required to call this base class implementation if they do so.
Reimplemented from SceneItemProcessor.
Reimplemented in SceneTransformProcessor.
- Parameters
-
camera | The camera scene item to visit. |
This function should only ever be called by the camera object being passed as the parameter, and only as part of a call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if camera is currently enabled. If it is, then it calls the virtual visitImpl(Camera&) function. Subclasses must provide their own implementation for visitImpl(Camera &) if they can process camera scene items.
Enabling a camera is not the same as using it. Many scene processors will not provide their own implementation of visitImpl(Camera&), so the enable/disable state for a camera often has little effect. For those scene processors that do process cameras, it is up to them what enabling or disabling a camera means. Quite often, for a renderer this will correspond to whether or not some visual representation of the camera should be included in the render, but you should consult the documentation of the scene processor you are interested in before relying on this.
Reimplemented from SceneItemProcessor.
- Parameters
-
clipRegion | The clipRegion scene item to visit. |
This function should only ever by called by the clipRegion object being passed as the parameter, and only as part of the call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if clipRegion is currently visible or enabled. If it is, then it calls the virtual visitImpl(ClipRegion&) function. Subclasses must provide their own implementation for visitImpl(ClipRegion&) if they can process clipRegion scene items.
Reimplemented from SceneItemProcessor.
bool visit |
( |
Light & |
light | ) |
|
|
finaloverridevirtual |
- Parameters
-
light | The light scene item to visit. |
This function should only ever be called by the light object being passed as the parameter, and only as part of a call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if light is currently enabled. If it is, then it calls the virtual visitImpl(Light&) function. Subclasses must provide their own implementation for visitImpl(Light&) if they can process light scene items.
Reimplemented from SceneItemProcessor.
- Parameters
-
model | The model scene item to visit. |
This function should only ever be called by the model object being passed as the parameter, and only as part of a call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if model is currently enabled. If it is, then it calls the virtual visitImpl(MeshModelInstance&) function. Subclasses must provide their own implementation for visitImpl(MeshModelInstance&) if they can process model scene items. Since models are usually the main objects in a scene, it would be unusual for a scene processor to not provide their own implementation for visitImpl(MeshModelInstance&).
Reimplemented from SceneItemProcessor.
- Parameters
-
sceneItemInstance | The sceneItemInstance scene item to visit. |
This function should only ever by called by the sceneItemInstance object being passed as the parameter, and only as part of the call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if sceneItemInstance is currently enabled. If it is, then it calls the virtual visitImpl(SceneItemInstance&) function. Subclasses must provide their own implementation for visitImpl(SceneItemInstance&) if they can process sceneItemInstance scene items.
Reimplemented from SceneItemProcessor.
- Parameters
-
transform | The transform to visit. |
This function should only ever be called by the transform object being passed as the parameter, and only as part of a call to process(). Any attempt to call the function outside of process() will fail.
After checking whether this call is part of a call to process(), the function then checks if transform is currently enabled. If it is, then it calls the virtual visitImpl(Transform&) function. Subclasses can provide their own implementation for visitImpl(Transform&) to handle transforms in some custom way, but the default implementation will often be sufficient. Note that if transform is not enabled, visitImpl(Transform&) is not called and this normally means that all children of transform are also not visited.
Reimplemented from SceneItemProcessor.