Game Development Reference
In-Depth Information
if (line.Find("MESH_NORMALS")!=-1){
if (!ReadNormals(file, obj)) goto meshabort;
if (tvert) delete [] tvert;
return TRUE;
if (tvert) delete [] tvert;
return FALSE;
The vertex list contains MESH_NUMVERTEX lines each describing a
single vertex. The value read from MESH_NUMVERTEX is stored in the
variable obj
numponts. Before reading each line the entire vertex array
is set to zero values using a simple memset call. Then the function uses a
'for' loop to iterate through all the points in the object storing the values
read from the file. To orientate the values read from the ASE file to the
coordinate space used by Toon3D, the y and z values are flipped and the
z value inverted.
BOOL C3DSAscii::ReadVertexList(CStdioFile &file, CToon3DObject
CString line,tmp;
int start,end;
TOKEN tokens[5];
start = file.GetPosition();
end = GetSectionEnd(file);
for (int i=0; i<obj->numpoints; i++){
if (!FindToken(file,line,"MESH_VERTEX ",-1,end)) return
if (ParseTokens(line,tokens,5)<5) return FALSE;
//Swap z and y and flip the z
obj->pts[i].x = atof(tokens[2].name);
obj->pts[i].y = atof(tokens[4].name);
obj->pts[i].z =-atof(tokens[3].name);
return TRUE;
Search Nedrilad ::

Custom Search