Game Development Reference
In-Depth Information
new array of 'MORPHITEM's and the new one is tagged on the end. If at
some stage it is decided to remove the morph targets or maybe replace
them with alternative targets, then the vertex locations stored in
morphitem[0] should be copied back to the object. This restores the object
as it was before the morph controller was added. Then the new morph
controller can be added as required.
//The object info structure stores the geometry and surface data
//for the object
typedef struct stOBJECTINFO{
int numpoints;
int numpolygons;
int numsurfaces;
POINT3D *pts;
POLYGON *plys;
SURFACE *srfs;
}OBJECTINFO;
CMorph::CMorph(OBJECTINFO &oi){
if (oi.numpoints){
basepts = oi.pts;
numpoints = oi.numpoints;
morphitem[0].pts = new VECTORF[numpoints];
if (morphitem.pts){
for (int i=0; i<numpoints; i++){
}
memcpy(morphitem[0].pts, mi.pts,
sizeof(VECTORF)*pointTotal);
}
}else{
numpoints = 0;
basepts = NULL;
morphitem[0].pts = NULL;
}
strcpy(morphitem[0].name, “Controller”);
morphitem[0].level = 1.0;
objcount = 1;
}
BOOL CMorph::AddMorph(MORPHITEM &mi, char *name)
{
Search Nedrilad ::




Custom Search