News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DirectX Skeletal animation from *.x a file

Started by Alex BP, July 24, 2005, 04:14:04 AM

Previous topic - Next topic

Alex BP

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?

hitchhikr

Paste the code.

You speak very good England.

James Ladd

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.


hitchhikr

I'm not beeing mean here, proof: i'm even willing to help you to understand the difference between sarcasm & irony

Alex BP

   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

hitchhikr

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.

Alex BP

hitchhikr, thank!

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