Game Development Reference
In-Depth Information
*MESH_TVERT 2 0.1250 1.0000 0.0000
*MESH_TVERT 3 0.1875 1.0000 0.0000
When reading the list the function enters a loop. The exit condition for the
loop is the file location exceeding the end of the list. For each iteration of
the loop we find the next MESH_TVERT token and then parse this line.
The token array will contain the index of the vertex in array value one, the
u component in array value two and the v component in array value
BOOL C3DSAscii::ReadTextureVertices(CStdioFile &file, TEXVEC
*tvert, int count)
CString line;
int start, end, index;
TOKEN tokens[5];
start = file.GetPosition();
end = GetSectionEnd(file);
if (!FindToken(file,line,"MESH_TVERT",-1,end)) return
if (ParseTokens(line,tokens,5)<5) return FALSE;
index = atoi(tokens[1].name);
if (index > count) return FALSE; //Index out of range
tvert[index].u = (float)atof(tokens[2].name);
tvert[index].v = (float)atof(tokens[3].name);
return TRUE;
To make use of the texture vertices we have to read the textured face list.
Toon3D uses a POLYGON structure that includes texture coordinates.
When reading the textured face list we assign these coordinates
*MESH_TFACE 00 17 18
*MESH_TFACE 11 18 19
Search Nedrilad ::

Custom Search