[SOURCE]
//this lot here does not work
//pMeshData->pMesh->CloneMeshFVF(D3DXMESH_MANAGED,
// pMeshData->pMesh->GetFVF(), pd3dDevice,
// &newMeshContainer->MeshData.pMesh);
D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE];// = D3DDECL_END();
//THIS WORKS OR Returns no error
if(FAILED(pMeshData->pMesh->GetDeclaration(Declaration)))
{
return E_FAIL;
}
//new bit still not working
HRESULT hr = pMeshData->pMesh->CloneMesh(D3DXMESH_MANAGED,
Declaration, pd3dDevice,
&newMeshContainer->MeshData.pMesh);
if(FAILED(hr))
{ if(hr == D3DERR_INVALIDCALL)
//BUT if I do this it works
newMeshContainer->MeshData.pMesh = pMeshData->pMesh;
newMeshContainer->MeshData.pMesh->AddRef();
}
[/SOURCE]
Back on the Loading X File Problem
Hey all, I have a mesh Hierarchy X file loader, I used the Toymaker's tut's for the design. And it worked fine untill one day I made a new mesh and tryed to load it and it failed. It loaded in the SDK's MView program.
I traced the error down to this part of the CreateMeshContainer function
The Question is how should I handle the copying of the mesh passed back when I load with D3DXLoadMeshHierarchyFromX function in the CreateMeshContainer function.
Should I just set it like this
newMeshContainer->MeshData.pMesh = pMeshData->pMesh;
newMeshContainer->MeshData.pMesh->AddRef();
The SDK's MView uses this method above
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement