Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

How to clone a D3DX9 frame hierarchy?

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

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

Share this post


Link to post
Share on other sites
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.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

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

Edited by lucky6969b

Share this post


Link to post
Share on other sites

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;



}
Edited by lucky6969b

Share this post


Link to post
Share on other sites

What does this message mean?

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

D3DX: Bad magic number

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!