Game Development Reference
In-Depth Information
if (line.Find("SCENE_BACKGROUND_ANIM")!=-1){
AfxMessageBox("Background colour animation is not
supported in this importer");
}
if (line.Find("SCENE_AMBIENT_ANIM")!=-1){
AfxMessageBox("Ambient colour animation is not
supported in this importer");
}
}
return TRUE;
}
Reading the MATERIAL_LIST section
A MATERIAL_LIST section contains the tag MATERIAL_COUNT, which
gives the number of materials in the list, followed by MATERIAL_COUNT
materials. In the function to read the MATERIAL_LIST the start and end
of the section are stored in variables start and end . MATERIAL_COUNT
is found using the FindToken function. If MATERIAL_COUNT is found and
the ParseToken function returns at least two tokens when splitting the line
into tokens, then the current materials can be deleted and the material
count stored in the variable materialCount . The next step is to allocate
memory for the materials. We use a MATERIAL structure which is simply
a wrapper for a SURFACE structure. Then we use the function
ReadMaterial to read each of the materialCount materials.
BOOL C3DSAscii::ReadMaterialList(CStdioFile &file)
{
CString line;
int start,end,i;
TOKEN tokens[3];
start = file.GetPosition();
end = GetSectionEnd(file);
if (!FindToken(file, line, "MATERIAL_COUNT", start, end))
return FALSE;
if (ParseTokens(line, tokens, 3)<2) return FALSE;
DeleteMaterials();
materialCount = atoi(tokens[1].name);
Search Nedrilad ::




Custom Search