The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Alex BP on July 24, 2005, 04:14:04 AM

Title: DirectX Skeletal animation from *.x a file
Post by: Alex BP on July 24, 2005, 04:14:04 AM
Who can will prompt as to load skeletal animation from a file *.x
I try to make it with the help invoke D3DXLoadMeshHierarchyFromXA, the program takes off. I suspect a problem in correct definition of interface ID3DXAllocateHierarchy.
Who can the problem knows in what?
Title: Re: DirectX Skeletal animation from *.x a file
Post by: hitchhikr on July 28, 2005, 10:27:57 AM
Paste the code.

You speak very good England.
Title: Re: DirectX Skeletal animation from *.x a file
Post by: James Ladd on July 28, 2005, 09:44:55 PM
hitchhikr,

Sarcasim doesnt come across well in text if being sarcastic is what you meant by writing "You speak very good England.".
Otherwise I guess you were just being mean.

Title: Re: DirectX Skeletal animation from *.x a file
Post by: hitchhikr on July 29, 2005, 12:54:45 PM
I'm not beeing mean here, proof: i'm even willing to help you to understand the difference between sarcasm (http://dictionary.reference.com/search?q=sarcasm) & irony (http://dictionary.reference.com/search?q=irony)
Title: Re: DirectX Skeletal animation from *.x a file
Post by: Alex BP on July 29, 2005, 10:27:30 PM
   invoke   GlobalAlloc,GMEM_FIXED,16
   mov   hmem,eax
   invoke   GlobalLock,hmem
   mov   Alloc,eax
   mov   [eax],CreateFrame
   mov   [eax+4],CreateMeshContainer
   mov   [eax+8],DestroyFrame
   mov   [eax+12],DestroyMeshContainer
   invoke   D3DXLoadMeshHierarchyFromXA,CStr("models\sample.x"),D3DXMESH_MANAGED,lpD3DDevice,ADDR Alloc,NULL,ADDR m_pFrameRoot,ADDR m_pAnimController
Title: Re: DirectX Skeletal animation from *.x a file
Post by: hitchhikr on July 29, 2005, 11:27:32 PM
Implementing such stuff in asm is going to be rather cumbersome since it's usually created as C++ classes.

This may or may not work:
(Btw, there's no need to use GlobalLock when GlobalAlloc is used with GMEM_FIXED).


    invoke  GlobalAlloc, GMEM_FIXED, 4
    mov Allocate_Hierarchy,eax
    invoke  GlobalAlloc, GMEM_FIXED, 4 * 4
    mov Class_VirtualFunctions,eax

    mov eax,Allocate_Hierarchy
    mov ebx,Class_VirtualFunctions
    mov [eax], ebx
    mov [ebx], offset CreateFrame
    mov [ebx + 4], offset CreateMeshContainer
    mov [ebx + 8], offset DestroyFrame
    mov [ebx + 12], offset DestroyMeshContainer

    invoke D3DXLoadMeshHierarchyFromXA, CStr("models\sample.x"), D3DXMESH_MANAGED, lpD3DDevice, toto,NULL, ADDR m_pFrameRoot, ADDR m_pAnimController


Methods need to be implemented like that:


CreateFrame proc pThis:dword, szName:dword, pNewFrame:dword
    mov eax,D3D_OK
    ret
CreateFrame endp

CreateMeshContainer proc pThis:dword, szName:dword, pMeshData:dword,
                                           pMaterials:dword, pEffectInstances:dword,
                                           NumMaterials:dword, pAdjacency:dword,
                                           pSkinInfo:dword, ppNewMeshContainer:dword
    mov eax,D3D_OK
    ret
CreateMeshContainer endp

DestroyFrame proc pThis:dword, pFrameToFree:dword
    mov eax,D3D_OK
    ret
DestroyFrame endp

DestroyMeshContainer proc pThis:dword, pMeshContainerToFree:dword
    mov eax,D3D_OK
    ret
DestroyMeshContainer endp


You better switch to C++ if you want to deal with such kind of stuff.
Title: Re: DirectX Skeletal animation from *.x a file
Post by: Alex BP on July 30, 2005, 12:34:17 AM
hitchhikr, thank!

I do not like C++ and classes. I like ASM!