Sign in to follow this  
ankhd

Back on the Loading X File Problem

Recommended Posts

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
[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]
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

Share this post


Link to post
Share on other sites
Can the GetDeclaration() function return more then MAX_FVF_DECL_SIZE = 65
What happens if you have a mesh with 165000 vertices.

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