Modifier (lxu-modifier.hpp)
This module provides utility classes for creating EvalModifier servers.
Contents
CLxItemModifierElement & CLxItemModifierServer
These classes are used to implement a fairly general-purpose modifier. The only assumption it makes is that there is one modifier node for each item of a specific type.
Server
The client subclasses the server type and defines these two virtual methods to declare their behaviors.
- ItemType() -- returns the name of the item type for this modifier
- GraphNames() -- returns a list of space-separated graph names that trigger this modifier to update (optional)
When a modifier node is added for an item, this method is called. It returns the element object that the client has also subclassed
- Alloc() -- allocate element using the Evaluation Interface to select channels to read and write
Element
The element is subclassed to perform the operation of the modifier by overriding these virtual methods.
- Eval() -- reads from input channels and writes to output(s)
- Test() -- returns false if this element no longer matches the state of the scene (defaults to true)
The element can also maintain cached state so that it can do incremental updates.
- Cache() -- returns new cache object (derived from CLxObject)
- EvalCache() -- if this modifier uses caches, then this method is called instead of Eval()
- Validate() -- called when an input channel has been re-validated, with its change code (optional)
Initialization
Adding the server is done with a special constructor which does the right voodoo given the server class and name.
initialize () { CLxExport_ItemModifierServer<CMyModifier> ("myModifier"); }
CLxObjectRefModifierCore
This class is used to create somewhat simpler modifiers whose only purpose is to set object channels on items. These are also configured by virtual methods:
- ItemType() -- name of the item type
- Channel() -- name of the OBJREF channel
- Attach() -- add channels for reading
- Alloc() -- read inputs and allocate the destination object
It supports a similar initialization function.
initialize () { CLxExport_ItemModifierServer<CLxObjectRefModifier<CMyCore> > ("myModifierServer"); }
CLxRenderCamera
Utility class for accessing the current render camera. The method support reading the camera index inside a modifier.