C4 Engine
C4 Engine API Documentation


Defined in:  C4Effects.h
Called when an effect should be rendered.

virtual void RenderEffect(const FrustumCamera *camera, List<Renderable> *effectList) = 0;

camera The camera for which the effect is being rendered.
effectList An array of render lists to which the effect should add its renderables.
The RenderEffect function is called when the World Manager has determined that an effect needs to be rendered. This function is only called for an effect node that is enabled and has already passed the visibility and occlusion tests. (An effect can be disabled by setting the kNodeDisabled flag with the Node::SetNodeFlags function.)

When the RenderEffect function is called, an Effect node should use the List::AppendListElement function to add itself and any additional renderable objects to one or more of the lists in the array specified by the effectList parameter. This array should be indexed using the following constants.
kEffectListFullLight Fully lit opaque effects. These are rendered with all types of lighting just like ordinary geometry before all other effects.
kEffectListPartialLight Partially lit transparent effects. These are rendered after surface effects and before primary transparent effects. Only ambient or unified lighting is applied.
kEffectListOpaque Opaque effects. These are rendered after the final lighting pass and before any transparent effects.
kEffectListSurface Surface effects. These are rendered after all opaque effects and before all transparent effects.
kEffectListTransparent Primary transparent effects. These are rendered after all opaque effects and are sorted back to front.
kEffectListFrontmost Frontmost transparent effects. These are rendered after primary transparent effects. They are not sorted.
kEffectListOcclusion Occlusion queries. These are invisible effects that are rendered after the ambient or unified lighting pass to perform and occlusion query.
kEffectListDistortion Distortion effects. These are rendered into the distortion buffer, and the accumulated results are applied during post-processing.
kEffectListComposite Composite effects. These are rendered into the composite buffer, which is later used as a source for ordinary lighting passes.
For example, to add an effect renderable to the transparent effect list, the RenderEffect function should make the following call.
Special Considerations
Note that the RenderEffect function can be called multiple times during the same frame for an effect that is visible from multiple cameras. The RenderEffect function should not perform any iterative movement under the assumption that the RenderEffect function is called only once. Instead, this type of computation should be peformed in the Effect::MoveEffect function.
See Also