Plz help me with Milkshape model loading!!!
Hi there
i have problems reading the materials from the file
here is how i do it
//read number of materials
fread(&numMaterials, sizeof(ushort), 1, file);
pMaterials = new MS3DMaterial[numMaterials];
//read materials
for(i = 0; i < numMaterials; i++)
{
fread( pMaterials.name, sizeof(char), 32, file);
fread( pMaterials.ambient, sizeof(float), 4, file);
fread( pMaterials.diffuse, sizeof(float), 4, file);
fread( pMaterials.specular, sizeof(float), 4, file);
fread( pMaterials.emissive, sizeof(float), 4, file);
fread(&pMaterials.shininess, sizeof(float), 1, file);
fread(&pMaterials.transparency, sizeof(float), 1, file);
fread(&pMaterials.mode, sizeof(char), 1, file);
fread( pMaterials.textureFileName, sizeof(char), 128, file);
fread( pMaterials.textureAlphamap, sizeof(char), 128, file);
logmsg(pMaterials.textureFileName);
//ms3d 1.5x relative path
if(strncmp(pMaterials.textureFileName, ".\\", 2) == 0)
{
strcpy(pathTemp + pathLength, pMaterials.textureFileName + 1);
strcpy(pMaterials.textureFileName, pathTemp);
}
}
//——–
now my texture loader saiz that it can''t find the textures and this is what my texture loader reads
$øwøT÷wÿÿÿ\heart.tga – texture file name of material no: 1 – wrong
no texture – and the the second material doesn''t load – which is also wrong
now i know the model only has 2 materials… i whent and checked in the milkshape editor
the rest of my model loads perfectly, only when reading the materials is a problem
any ideas
</i>
are you sure your pathTemp is correct?
seem works,
ok i thought u missed i, forum problem
</i> <br><br><SPAN CLASS=editedby>[edited by - iwaskia on May 3, 2002 11:28:29 AM]</SPAN>
seem works,
ok i thought u missed i, forum problem
</i> <br><br><SPAN CLASS=editedby>[edited by - iwaskia on May 3, 2002 11:28:29 AM]</SPAN>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement