Game Development Reference
In-Depth Information
while(strcmp(tag[index], nm)){
index++;
if (index>=numsurfaces) return FALSE; //Surface name not found
}
srf = &srfs[index];
//Set some default values
srf->diffuse=1.0f;
srf->transparency=0.0f;
//Read sub-chunks
while (count<length){
if (!ReadSubChunk(buf,s,fp)) return FALSE;
count+=(s + 6);
if (strcmp(buf,”COLR”)==0){
//Found colour
r=fread(buf,4,1,fp); if (r!=1) return FALSE;
srf->r=buf[0]; srf->g=buf[1]; srf->b=buf[2];
continue;
}
if (strcmp(buf,”VDIF”)==0){
ReadFloat(fp,srf->diffuse);
continue;
}
if (strcmp(buf,”VLUM”)==0){
ReadFloat(fp,flt);
if(flt>0.0f)srf->flag+=SRF_FLAG_LUMINOUS;
continue;
}
if (strcmp(buf,”VSPC”)==0){
ReadFloat(fp,srf->specular);
continue;
}
if (strcmp(buf,”SMAN”)==0){
ReadFloat(fp,flt);
continue;
}
if (strcmp(buf,”VTRN”)==0){
//Found transparency
ReadFloat(fp,srf->transparency);
continue;
}
Search Nedrilad ::




Custom Search