Sign in to follow this  

D3DXLoadMeshHierarchyFromXInMemory

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

Hi everyone, I have a problem with D3DXLoadMeshHierarchyFromXInMemory and maybe you can help me out. I'm using X files in my project and everything works just fine. I can load animated models with no problem. But now I just got a new model, witch after converting to an X file (kwXporter) cause D3DXLoadMeshHierarchyFromXInMemory to return D3DERR_INVALIDCALL. The debug d3d writes this to the debug output: Assertion failure! (h:\gfx_sdk_november\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices D3DX: ID3DXAnimationController::RegisterAnimationOutput: Number of matrices registered is equal to the max number set at creation time. I just can't do anything with it. If anyone have some experience about this error, plz let me know.

Share this post


Link to post
Share on other sites
I've found the problem. If you get a frame in ID3DXAllocateHierarchy::CreateFrame with a NULL name, the created D3DXFRAME::Name must be NULL and not an empty string! I wonder why does it work on other meshes.

Share this post


Link to post
Share on other sites
Hello, I'm tired with it.

I'm doing a pak sys, now process the X buffer to archive serializtion

the api as bellow

HRESULT D3DXLoadMeshHierarchyFromXInMemory(
LPCVOID pMemory,
DWORD SizeOfMemory,
DWORD MeshOptions,
LPDIRECT3DDEVICE9 pDevice,
LPD3DXALLOCATEHIERARCHY pAlloc,
LPD3DXLOADUSERDATA pUserDataLoader,
LPD3DXFRAME * ppFrameHeirarchy,
LPD3DXANIMATIONCONTROLLER * ppAnimController
);

My question is How can I get the pMemory, that's Pointer to a buffer that contains the mesh hierarchy.

If you know about it, pls tell me! thx

Share this post


Link to post
Share on other sites
byte* pMeshFile = NULL;
long lMeshFileSize = 0;
if ( FILE* pFile = fopen( "whatever.x", "rb" ) )
{
fseek( pFile, 0, SEEK_END );
lMeshFileSize = ftell( pFile );
fseek( pFile, 0, SEEK_SET );

pMeshFile = new byte[ lMeshFileSize ];
fread( pMeshFile, lMeshFileSize, 1, pFile );
}

D3DXLoadMeshHierarchyFromXInMemory( pMeshFile, lMeshFileSize, whatever...

Share this post


Link to post
Share on other sites

This topic is 3563 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.

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