What is the CloneMesh used for when loading a mesh

Started by
4 comments, last by Gerhard Mostert 17 years, 1 month ago
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]
Advertisement
The most common purpose is to allow the mesh to use different vertex formats.
.
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
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.
NextWar: The Quest for Earth available now for Windows Phone 7.
Hi, the MView came from the Extra data down load
Are you using DirectX 9c ? or What?

This topic is closed to new replies.

Advertisement