Scaling an .x file
Is it possible to scale an .x file? I have a mesh - without any original format model file - and it needs to be scaled up for my game. How can I scale the model? Do I need a converter to change the .X file into a 3ds (or such) object?
You can scale it just for rendering using D3DXMatrixScaling().
If you want to scale the mesh inside the file, I think its better you scale it manually in the 3D modelling software you modelled it before exporting.
cya
If you want to scale the mesh inside the file, I think its better you scale it manually in the 3D modelling software you modelled it before exporting.
cya
I think this code will help you, it would be easy to modify it to scale the mesh verts.
void CMesh::InvertZ(void){ LPD3DXMESH pMeshCopy; tD3DXCustomVertex *pVertex; tFace *pFace; DWORD dwNumVerts = m_pd3dMesh->GetNumVertices(); DWORD dwNumFaces = m_pd3dMesh->GetNumFaces(); m_pd3dMesh->CloneMeshFVF(0, tD3DXCustomVertex::VertexFVF, m_pD3DDevice, &pMeshCopy); pMeshCopy->LockVertexBuffer(0,(VOID**)&pVertex); for(unsigned int i = 0; i < dwNumVerts; i++) { pVertex.vPosition.z *= -1; pVertex.vNormal.z *= -1; } pMeshCopy->UnlockVertexBuffer(); pMeshCopy->LockIndexBuffer(0,(VOID**)&pFace); for(unsigned int i = 0; i < dwNumFaces; i++) { WORD iTempVert = pFace.vertOne; pFace.vertOne = pFace.vertThree; pFace.vertThree = iTempVert; } pMeshCopy->UnlockIndexBuffer(); D3DXSaveMeshToX("InvZ.x",pMeshCopy,NULL,m_pD3DXMaterials,NULL,m_dwNumMaterials,0);}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement