DisplacementHandler
DisplacementInterface
Displacement plug-ins deform objects by moving their points at each time step. They can
be called both during rendering and to update Layout's interface.
Handler Activation Function
XCALL_( int ) MyDisplacement( long version, GlobalFunc *global,
LWDisplacementHandler *local, void *serverData );
The local argument to a displacement plug-in's activation function is an
LWDisplacementHandler.
typedef struct st_LWDisplacementHandler {
LWInstanceFuncs *inst;
LWItemFuncs *item;
LWRenderFuncs *rend;
void (*evaluate) (LWInstance, LWDisplacementAccess *);
unsigned int (*flags) (LWInstance);
} LWDisplacementHandler;
The first three members of this structure are the standard handler
functions. The context argument to the inst->create function is
the LWItemID of the object associated with this instance.
In addition to the standard functions, a displacement plug-in provides an evaluation
function and a flags function.
- evaluate( instance, access )
- This is where the displacement happens. At each time step, the evaluation function is
called for each vertex in the object. The position of the vertex is examined and modified
through the access structure described below.
flags( instance )
- Returns an int that tells Layout whether the displacement will be in world coordinates
and whether it should occur before or after the object has been deformed by bones. Only
one of these flags should be returned.
LWDMF_WORLD
LWDMF_BEFOREBONES
Interface Activation Function
XCALL_( int ) MyInterface( long version, GlobalFunc *global,
??? *???, void *serverData );
TBD.
Displacement Access
Fundamentally, a displacement plug-in takes point coordinates and moves them for each
timestep. The access structure gives the evaluation function the position of the point to
displace in two ways.
typedef struct st_DisplacementAccess {
double oPos[3];
double source[3];
} DisplacementAccess;
- oPos
- The point location in object coordinates. This is read-only.
- source
- The location to be transformed in place by the displacement. If the flags function
returned the LWDMF_WORLD bit, the source is in world coordinates and has already
been modified by morphing, bones and object motion. Otherwise the source is in object
coordinates (after morphing, before item motion, and before or after bone effects,
depending on whether the flags function returned LWDMF_BEFOREBONES).
|