ObjReplacementHandler
ObjReplacementInterface
typedef struct st_LWObjReplacementHandler {
LWInstanceFuncs *inst;
LWItemFuncs *item;
void (*evaluate) (LWInstance, ObjReplacementAccess *);
} LWObjReplacementHandler;
typedef struct st_LWObjReplacementAccess {
LWItemID objectID;
LWFrame curFrame, newFrame;
LWTime curTime, newTime;
int curType, newType;
const char *curFilename;
const char *newFilename;
} LWObjReplacementAccess;
#define LWOBJREP_NONE 0
#define LWOBJREP_PREVIEW 1
#define LWOBJREP_RENDER 2
This handler allows another type of animation which can replace the entire
object geometry at every single step. Replacement is done by object
name, so the server evaluation function can provide a new object name
to load for each subframe timestep, or it can only load a new object
periodically, allowing the same geometry to persist for a length of time.
Filenames are used instead of direct mesh replacement for generality.
An object replacement server could use a series of prebuilt objects,
like character heads for example, to do expressions or lip-syncing by
providing the name of the correct head at each step. Some animation
could be done very efficiently using a combination of object
replacement and object import servers. The replacement server could
write a brief description file for the parameters of a timestep
(positions and sizes of metaballs, for example) which the object
import server could then convert into a complete mesh while loading.
A simple form of this server could be used to replace objects with
nulls when they are not visible in the scene.
8.7.1. Object Replacement Access
The access structure passed to the evaluation function contains
information about the currently loaded object and the next timestep.
The server compares the current settings and the next step and
provides a new filename if a different object should be loaded for
the next timestep to be evaluated.
If the currently loaded geometry can be used for the new
frame and time, then the new filename can be set to null.
- objectID
- Item ID for the object whose geometry may be replaced by this server.
- curFrame, curTime, newFrame, newTime
- The frame and time values for the currently loaded geometry and the
next step. New geometry should be loaded if the object needs to look
different at the two different times. The times may not be sequential,
since network rendering can cause the renderer to jump around between
non-sequential times.
- curType, newType
- The type of the geometry currently loaded and needed for the next timestep.
The server can provide different geometry for
interactive previewing and actual rendering by examining this value.
OBJREP_NONE is only used when there is no geometry loaded at all for
the current time.
(88) Animation Servers
. . .
#define OBJREP_NONE 0
#define OBJREP_PREVIEW 1
#define OBJREP_RENDER 2
. . .
- curFilename
- This is set to the object geometry file currently loaded, and may be null
if there is no geometry loaded.
- newFilename
- This is the filename of a new object file to be loaded as the geometry for
this item at the new timestep, and is the only field set by the server.
It should only be set if the new geometry differs from that currently
loaded, since loading new geometry incurs significant overhead.
(89) Animation Servers
|