Game Development Reference
In-Depth Information
if (!basepts){
AfxMessageBox(”Error: either no morph controller or base
object has no vertex data.”);
return FALSE;
}
if (objcount == MAX_MORPH_TARGETS){
AfxMessageBox(”Error: Maximum number of morph objects
reached”);
return FALSE;
}
//Create storage for existing and new meshes
MORPHITEM *mitem = new MORPHITEM[objcount + 1];
if (!mitem){
AfxMessageBox(”Error: No memory for morph target”);
return FALSE;
}
if (objcount){
//Copy existing data
memcpy(mitem, morphitem, sizeof(MORPHITEM)*objcount);
delete [] morphitem;
morphitem = mitem;
mitem = &morphitem[objcount];
}
mitem->level = 0.0;
mitem->pts = new VECTOR[numpoints];
if (!mitem->pts) return FALSE;
memcpy(mitem->pts, mi.pts, sizeof(VECTOR)*numpoints);
strncpy(mitem->name, name, 29);
//Do we have any keyframes
if (keys) for (i=0;i<keytotal;i++) keys[i].level[objcount-
1]=0.0;
++objcount;
return TRUE;
}
Search Nedrilad ::




Custom Search