Jump to content
  • Advertisement
Sign in to follow this  
embpos

Scaling an .x file

This topic is 4755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!