Game Development Reference
In-Depth Information
if (!ReadFloat(fp, f)) return FALSE;
srf->green = (BYTE)(f * 255.0f);
if (!ReadFloat(fp, f)) return FALSE;
srf->blue = (BYTE)(f * 255.0f);
if (!ReadShort(fp, e)) return FALSE;
if (e!=0){
AfxMessageBox(”Colour envelopes not supported”);
return FALSE;
}
count += sublength;
continue;
}
//If we got to here then the chunk was
// not found so skip by byte aligned sublength
if (sublength%2){
fseek(fp, sublength+1, SEEK_CUR);
count += (sublength+1);
}else{
fseek(fp, sublength, SEEK_CUR);
count += sublength;
}
}
}
return TRUE;
}
The simple application LWLoader in the examples for this chapter on
the CD should load most Lightwave 6 files. The application makes no
attempt to scale the view to the size of the object, so if the object is much
smaller than 5 units high or much bigger then it will appear either too small
or two big on the screen. A couple of suitably sized objects can be found
in the Objects folder for this chapter.
More about surfaces
Toon3D uses many more features of the surface chunk and we will look
now at how these are loaded and how we use the details stored in the
object file to assign complex textures to our polygons. This function call is
suitable for LWO1 objects created with Lightwave 5+. Many of the same
features are found in the surface sub-chunks in an LW02 file created with
Search Nedrilad ::




Custom Search