Back on the Loading X File Problem

Started by
1 comment, last by ankhd 16 years, 9 months ago
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
Advertisement
Can the GetDeclaration() function return more then MAX_FVF_DECL_SIZE = 65
What happens if you have a mesh with 165000 vertices.
Come on some one must know about this stuff

This topic is closed to new replies.

Advertisement