Mike
What is the purpose of pMaterial->dispMapFilename ?
and pMaterial->dispMapFilename (d or dis) VS pMaterial->colorMapFilename (map_Kd) ?
To compute the correct mesh index for CreateUVmap(nMes), i am using this
nMesh = TorUVmesh();
if (nMesh > -1) {
CreateUVmap(nMesh);
}
long TorUVmesh() {
long nRet = -1, nI = 0;
MobjMesh* pMesh;
MobjMat* pMaterial;
char zTex[MAX_PATH] = { 0 };
WideCharToMultiByte(CP_ACP, 0, gT.zTex, -1, zTex, MAX_PATH, 0, 0);
for (nI = 0; nI < gM.numberOfMeshes; ++nI) {
pMesh = >m_meshes[nI];
pMaterial = pMesh->pMaterial;
if (_stricmp(zTex, (char*)pMaterial->colorMapFilename.c_str()) == 0) {
nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->bumpMapFilename.c_str()) == 0) {
nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->ambiMapFilename.c_str()) == 0) {
nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->specMapFilename.c_str()) == 0) {
nRet = nI; break; }
//if (_stricmp(zTex, (char*)pMaterial->reflMapFilename.c_str()) == 0) {
// nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->dispMapFilename.c_str()) == 0) {
nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->emitMapFilename.c_str()) == 0) {
nRet = nI; break; }
if (_stricmp(zTex, (char*)pMaterial->glossMapFilename.c_str()) == 0) {
nRet = nI; break; }
}
return nRet;
}
Does that is fine with you?
Note: there is still a bug in CreateUVmap when selecting a mesh greater than 0 (we must compute the correct index offset)