Game Development Reference
In-Depth Information
SURF
“BlueMetal”
....
SURF
“YellowPlastic”
Despite finding 'BlueMetal' first, the index in the PTAG chunk for the
surface would be 3. A surface with the name 'Default' would have an index
of 0 in the PTAG chunk.
BOOL CLWObject::LoadPTags(FILE *fp, int length)
{
int count, length;
USHORT plyID, srfID;
char buf[4];
fread(buf, 4, 1, fp);
if (strncmp(buf, ”SURF”, 4)!=0){
fseek(fp, length, SEEK_CUR);
return TRUE;
}
count = 4;
while (count<length){
if (!ReadShort(fp, plyID)) return FALSE;
if (!ReadShort(fp, srfID)) return FALSE;
if (plyID<numpolygons){
plys[plyID].srfID = srfID;
}
count += 4;
}
return TRUE;
}
The surface chunk is by far the most complex chunk in most object files.
Many of the features of the surface chunk can be ignored by a real-time
application. In this simple application we use just two features, the colour
and the name of the surface. In common with the points list and the
polygon list, we declare a structure called SURFACE to store the data.
Search Nedrilad ::




Custom Search