I'm trying to support X files with and without textures. Here's an example of the material section of an X file that has been exported by Pandasoft 3ds Max exporter:
Material {
0.650980;0.898039;0.898039;1.000000;;
0.000000;
0.650980;0.898039;0.898039;;
0.000000;0.000000;0.000000;;
}
I then use D3DXLoadMeshFromX, pretty much like all the samples I've checked:
| |
| if( !FAILED(D3DXLoadMeshFromX( |
| meshFileName.c_str(), D3DXMESH_MANAGED, m_pDevice, NULL, |
| &pMaterialBuffer, NULL, &numMaterials, |
| &pMesh ) ) ) |
| { |
| // Apply textures and materials from the mesh |
| D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pMaterialBuffer->GetBufferPointer(); |
| // ETC ETC |
| } |
But for some reason, d3dxMaterials[0]->pTextureFileName != NULL. All the samples I have seen check for NULL at this point before loading a texture, but since my texture file name seems to point to random garbage, I can't do this. Anybody seen this before or have any ideas?