Sign in to follow this  
ankhd

What is the CloneMesh used for when loading a mesh

Recommended Posts

Hi all, I'm trying to learn how to load a X file into d3d and I was woundering why in the tutorials for loading a .X file using the D3DXLoadMeshHierarchyFromX function that it uses the CloneMesh to copy the mesh data into the new mesh container. why can't you just do this newMeshContainer->MeshData.pMesh = pMeshData->pMesh; here is some of the code. With DIRECTX latest D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]; if (FAILED(pMeshData->pMesh->GetDeclaration(Declaration))) return E_FAIL; //pMeshData->pMesh->CloneMeshFVF(D3DXMESH_MANAGED, // pMeshData->pMesh->GetFVF(), pd3dDevice, // &newMeshContainer->MeshData.pMesh); pMeshData->pMesh->CloneMesh(D3DXMESH_MANAGED, Declaration, pd3dDevice, &newMeshContainer->MeshData.pMesh); And also this code fails to load a mesh that the SDK's MView can load [Edited by - ankhd on March 22, 2007 11:22:07 PM]

Share this post


Link to post
Share on other sites
Hi again, Does any body know if there is any Tut's Like the MView(From the SDK)
for loading mesh and with out all the complex stuff in the SDK's mview

Share this post


Link to post
Share on other sites
newMeshContainer->MeshData.pMesh = pMeshData->pMesh;

That line of code will just copy the pointer. They will still point to the same piece of data. If you actually need 2 copies of the mesh, you need to use the CloneMesh functions.

According to google, MView was removed from the DirectX SDK in late 2005. You might want to consider getting the newest DirectX SDK from Microsoft.com.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this