multiple transform

Started by
0 comments, last by Gage64 15 years, 4 months ago
Hy. II have 2 meshes and i would scale the first of 3 unit , the second of -1 uni i have the tree meshes in a vector and i do this:
Quote: std::vector<CMeshBase*>::iterator itMesh; for(itMesh = m_AllMeshes.begin();itMesh != m_AllMeshes.end();itMesh++) { Device->SetMaterial(&mtrl); CMeshBase* pmesh=((CMeshBase*)*itMesh); if(pmesh->getName().find("B-floor-mesh")!=string::npos ) { D3DXMatrixRotationX(&pmesh->mxRotate,-240); D3DXMatrixTranslation(&pmesh->mxTranslate,5.234062 ,-1.04631 ,0.148801); D3DXMatrixScaling(&pmesh->mxScale,3,3,3); Device->SetTransform(D3DTS_WORLD,&pmesh->mxScale); pmesh->mesh->DrawSubset(0); } if(pmesh->getName().find("F430")!=string::npos) { D3DXMatrixRotationX(&pmesh->mxRotate,-180); D3DXMatrixTranslation(&pmesh->mxTranslate,-0.676137 ,0.016215 ,0.56571); D3DXMatrixScaling(&pmesh->mxScale,-1,-1,-1); D3DXMATRIX World=pmesh->mxRotate*pmesh->mxTranslate*pmesh->mxScale; Device->SetTransform(D3DTS_WORLD, &World); pmesh->mesh->DrawSubset(0); } }
but this apply only the last transformation why? How i cand do this with directx9? THanks
Advertisement
I think you want to apply the scaling first:

world = scale * rotation * translation;

This topic is closed to new replies.

Advertisement