How to clone a D3DX9 frame hierarchy?

Started by
3 comments, last by lucky6969b 7 years, 11 months ago

As my engine is using bvh animation, and not completely isolated by the animation controllers themselves,

I must clone the mesh hierarchy for individual transformation matrix transformed independently,

I try to use copy constructors to copy the frame hierarchy's transforms, but the problem I've encountering

is the bone final matrices were initially tied to the combined matrices, and they don't link up anymore

because I create another new matrix for each of those.

Are there any easy ways to clone the hierarchy?

Thanks

Jack

Advertisement

you should be about to start at the root frame, and for each frame, new a copy, and copy data to the new copy, then just chase the sibling and first child pointers, and repeat, until you've cloned it all.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Is there a good chance that the animation controller connection may be lost too

if I clone the frame hierarchy and then cloning the animation controller,

the controller should be attached to one instance of the frame hierarchy....

They are somewhat connected when they get loaded by D3DXLoadMeshHierarchyFromX

if they then are copy-constructed, they are no longer connected....

Update:

Alright. I then discovered the

D3DXLoadMeshHierarchyFromXInMemory

Function. I think that's what I need

Thanks

Jack

see below....

The pFrameRoot is a valid frame hierarchy...

any ideas?

thanks

Jack


bool CMesh::Load(LPD3DXFRAME pFrameRoot, bool bSkinnedMesh, bool bVertexBlending)
{
  
    CAllocateHierarchy Alloc;    

    
    m_bEnableVertexBlending = bVertexBlending;
    m_bSkinnedMesh = bSkinnedMesh;


    
    if (SUCCEEDED(D3DXLoadMeshHierarchyFromXInMemory((LPCVOID)pFrameRoot, sizeof(pFrameRoot),
        D3DXMESH_MANAGED, d3d::GetInstance().GetDevice(), &Alloc, NULL, &m_pFrameRoot, &m_pAnimController)))
    {
        // load it also as a static mesh
        if (FAILED(D3DXLoadMeshFromXInMemory((LPCVOID)pFrameRoot, sizeof(pFrameRoot), D3DXMESH_MANAGED, d3d::GetInstance().GetDevice(),
            NULL, NULL, NULL, NULL, &m_pStaticMesh)))
        {
            
            return false;

        }
    }
    else
    {
        
       return false;
    }
    


    if (!StructureHierarchy())
        return false;


    return true;



}

What does this message mean?

I keep getting this, then the returned frame root is null...

D3DX: Bad magic number

This topic is closed to new replies.

Advertisement