• Advertisement
Sign in to follow this  

How to save a dynamically generated mesh to a .x file?

This topic is 3678 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

hi, I'm using Directx 9 and C++. I have dynamically generated a mesh. I want to save it to a .x file coz I can compute normals and tangents using in built functions. How do I create a .x file from the vertex buffer info? Or do I have to use blender or something? Otherwise, is it possible for me to create a mesh with a vertex buffer that I can fill in C++? Thanks, M

Share this post


Link to post
Share on other sites
Advertisement
Hi, both things ar possible.
You can create a mesh from vertex/index buffer info with function

HRESULT D3DXCreateMesh(
DWORD NumFaces,
DWORD NumVertices,
DWORD Options,
CONST LPD3DVERTEXELEMENT9 * pDeclaration,
LPDIRECT3DDEVICE9 pD3DDevice,
LPD3DXMESH * ppMesh
);

And then you can save this mesh to .x file with function

HRESULT D3DXSaveMeshToX(
LPCTSTR pFilename,
LPD3DXMESH pMesh,
CONST DWORD * pAdjacency,
CONST D3DXMATERIAL * pMaterials,
CONST D3DXEFFECTINSTANCE * pEffectInstances,
DWORD NumMaterials,
DWORD Format
);

Share this post


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

  • Advertisement