Game Development Reference
In-Depth Information
*MESH_TFACE 22 19 20
*MESH_TFACE 33 20 21
*MESH_TFACE 44 21 22
The MESH_TFACELIST section contains MESH_NUMTVFACES lines.
Each line starts with a MESH_TFACE tag, followed by four integer values.
The first is the face index, then the texture vertex indices for this face in
counter-clockwise order. To process this information, we read each vertex
in turn and apply the appropriate texture vertex from the passed texture
vertex array to the polygon's texture vertices stored in the POLYGON
structure member tc.
BOOL C3DSAscii::ReadTFaceList(CStdioFile &file, CToon3DObject
*obj, TEXVEC *tverts, int count)
CString line;
int start, end, plyindex, p[3], index;
start = file.GetPosition();
end = GetSectionEnd(file);
while (file.GetPosition()<(UINT)end){
if (!FindToken(file,line,"MESH_TFACE",-1,end)) return
if (ParseTokens(line,tokens,5)<5) return FALSE;
plyindex = atoi(tokens[1].name);
if (plyindex>obj->numpolygons) return FALSE;
ply = &obj->plys[plyindex].
index = atoi(tokens[2].name);
ply->tc[0].u = tverts[index].u;
ply->tc[0].v = tverts[index].v;
index = atoi(tokens[3].name);
ply->tc[2].u = tverts[index].u;
ply->tc[2].v = tverts[index].v;
index = atoi(tokens[4].name);
ply->tc[1].u = tverts[index].u;
ply->tc[1].v = tverts[index].v;
return TRUE;
Search Nedrilad ::

Custom Search