Jump to content
  • Advertisement
Sign in to follow this  
ankhd

Back on the Loading X File Problem

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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!