Ada计算机图形DirectX之d3dx9anim

本文深入解析了 D3DX9 动画系统,包括动画集、压缩动画集、关键帧动画集及动画控制器的创建、使用与管理。详细介绍了各种动画数据类型、回调函数、事件处理等高级特性,以及如何加载、保存和操作复杂的动画层次结构。
摘要由CSDN通过智能技术生成
----------------------------------------
-- File : d3dx9anim.ads               --
-- Translator:Dongfeng.Gu,2018/10/21  --
-- Mail: 515639@qq.com                --
-- Progress:100%                      --
----------------------------------------

with win32;                             use win32;
with win32.rpcdce;                      use win32.rpcdce;
with win32.objbase;                     use win32.objbase;
with win32.windef;                      use win32.windef;

with d3d9;                              use d3d9;
with d3dx9mesh;                         use d3dx9mesh;
with d3d9types;                         use d3d9types;
with d3dx9xof;                          use d3dx9xof;
with d3dx9core;                         use d3dx9core;

package d3dx9anim is

   IID_ID3DXAnimationSet:constant win32.rpcdce.GUID:=(16#698cfb3f#,16#9289#,16#4d95#,(16#9a#,16#57#,16#33#,16#a9#,16#4b#,16#5a#,16#65#,16#f9#));
   IID_ID3DXKeyframedAnimationSet:constant win32.rpcdce.GUID:=(16#fa4e8e3a#,16#9786#,16#407d#,(16#8b#,16#4c#,16#59#,16#95#,16#89#,16#37#,16#64#,16#af#));
   IID_ID3DXCompressedAnimationSet:constant win32.rpcdce.GUID:=(16#6cc2480d#,16#3808#,16#4739#,(16#9f#,16#88#,16#de#,16#49#,16#fa#,16#cd#,16#8d#,16#4c#));
   IID_ID3DXAnimationController:constant win32.rpcdce.GUID:=(16#ac8948ec#,16#f86d#,16#43e2#,(16#96#,16#de#,16#31#,16#fc#,16#35#,16#f9#,16#6d#,16#9e#));

   type tagD3DXMESHDATATYPE is (D3DXMESHTYPE_MESH,
                                D3DXMESHTYPE_PMESH,
                                D3DXMESHTYPE_PATCHMESH,
                                D3DXMESHTYPE_FORCE_DWORD);
   for tagD3DXMESHDATATYPE use (D3DXMESHTYPE_MESH=>16#001#,
                                D3DXMESHTYPE_PMESH=>16#002#,
                                D3DXMESHTYPE_PATCHMESH=>16#003#,
                                D3DXMESHTYPE_FORCE_DWORD=>16#7fffffff#);

   subtype D3DXMESHDATATYPE is tagD3DXMESHDATATYPE;

   type tagD3DXMESHDATA(C:Integer:=0) is record
      Typ:D3DXMESHDATATYPE;
      case C is
         when 0=>
            pMesh:LPD3DXMESH;
         when 1=>
            pPMesh:LPD3DXPMESH;
         when others=>
            pPatchMesh:LPD3DXPATCHMESH;
      end case;
   end record with Unchecked_Union;
   subtype D3DXMESHDATA is tagD3DXMESHDATA;
   type LPD3DXMESHDATA is access all tagD3DXMESHDATA;
   type LPCD3DXMESHDATA is access constant tagD3DXMESHDATA;

   
   type tagD3DXMESHCONTAINER;
   type LPD3DXMESHCONTAINER is access all tagD3DXMESHCONTAINER;
   type LPLPD3DXMESHCONTAINER is access all LPD3DXMESHCONTAINER;
   type LPCD3DXMESHCONTAINER is access constant tagD3DXMESHCONTAINER;
   
   type tagD3DXMESHCONTAINER is record
      Name:LPSTR;
      MeshData:D3DXMESHDATA;
      pMaterials:LPD3DXMATERIAL;
      pEffects:LPD3DXEFFECTINSTANCE;
      NumMaterials:DWORD;
      pAdjacency:LPDWORD;
      pSkinInfo:LPD3DXSKININFO;
      pNextMeshContainer:LPD3DXMESHCONTAINER;
   end record;

   subtype D3DXMESHCONTAINER is tagD3DXMESHCONTAINER;

   type tagD3DXFRAME;
   type LPD3DXFRAME is access all tagD3DXFRAME;
   type LPLPD3DXFRAME is access all LPD3DXFRAME;
   type LPCD3DXFRAME is access constant tagD3DXFRAME;
   

   type tagD3DXFRAME is record
      Name:LPSTR;
      TransformationMatrix:D3DMATRIX;
      pMeshContainer:LPD3DXMESHCONTAINER;
      pFrameSibling:LPD3DXFRAME;
      pFrameFirstChild:LPD3DXFRAME;
   end record;

   subtype D3DXFRAME is tagD3DXFRAME;

   

   type ID3DXAllocateHierarchy;
   type LPID3DXALLOCATEHIERARCHY is access all ID3DXAllocateHierarchy;
   subtype LPD3DXALLOCATEHIERARCHY is LPID3DXALLOCATEHIERARCHY;
   type LPLPID3DXALLOCATEHIERARCHY IS access all LPID3DXALLOCATEHIERARCHY;
   subtype LPLPD3DXALLOCATEHIERARCHY is LPLPID3DXALLOCATEHIERARCHY;

   type ID3DXAllocateHierarchy is record
      CreateFrame:access procedure(THIS:LPID3DXAllocateHierarchy;Name:LPCSTR;ppNewFrame:LPLPD3DXFRAME) with Convention=>Stdcall;
      CreateMeshContainer:access procedure(THIS:LPID3DXAllocateHierarchy;Name:LPCSTR;pMeshData:LPCD3DXMESHDATA;pMaterials:LPCD3DXMATERIAL;pEffectInstances:LPCD3DXEFFECTINSTANCE;NumMaterials:DWORD;pAdjacency:LPCDWORD;pSkinInfo:LPD3DXSKININFO;ppNewMeshContainer:LPLPD3DXMESHCONTAINER) with Convention=>Stdcall;
      DestroyFrame:access procedure(THIS:LPID3DXAllocateHierarchy;pFrameToFree:LPD3DXFRAME) with Convention=>Stdcall;
      DestroyMeshContainer:access procedure(THIS:LPID3DXAllocateHierarchy;pMeshContainerToFree:LPD3DXMESHCONTAINER) with Convention=>Stdcall;
   end record;

   type ID3DXLoadUserData;

   type LPD3DXLOADUSERDATA is access all ID3DXLoadUserData;

   type ID3DXLoadUserData is record
      LoadTopLevelData:access procedure(pXofChildData:LPD3DXFILEDATA) with Convention=>Stdcall;
      LoadFrameChildData:access procedure(pFrame:LPD3DXFRAME;pXofChildData:LPD3DXFILEDATA) with Convention=>Stdcall;
      LoadMeshChildData:access procedure(pMeshContainer:LPD3DXMESHCONTAINER;pXofChildData:LPD3DXFILEDATA) with Convention=>Stdcall;
   end record;

   type ID3DXSaveUserData;

   type LPD3DXSAVEUSERDATA is access all ID3DXSaveUserData;

   type ID3DXSaveUserData is record
      AddFrameChildData:access procedure(pFrame:LPCD3DXFRAME;pXofSave:LPD3DXFILESAVEOBJECT;pXofFrameData:LPD3DXFILESAVEDATA) with Convention=>Stdcall;
      AddMeshChildData:access procedure(pMeshContainer:LPCD3DXMESHCONTAINER;pXofSave:LPD3DXFILESAVEOBJECT;pXofMeshData:LPD3DXFILESAVEDATA) with Convention=>Stdcall;
      AddTopLevelDataObjectsPre:access procedure(pXofSave:LPD3DXFILESAVEOBJECT) with Convention=>Stdcall;
      AddTopLevelDataObjectsPost:access procedure(pXofSave:LPD3DXFILESAVEOBJECT) with Convention=>Stdcall;
      RegisterTemplates:access procedure(pXFileApi:LPD3DXFILE) with Convention=>Stdcall;
      SaveTemplates:access procedure(pXofSave:LPD3DXFILESAVEOBJECT) with Convention=>Stdcall;
   end record;

   type tagD3DXCALLBACK_SEARCH_FLAGS is (D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION,
                                         D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION,
                                         D3DXCALLBACK_SEARCH_FORCE_DWORD);
   for tagD3DXCALLBACK_SEARCH_FLAGS use (D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION=>16#01#,
                                         D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION=>16#02#,
                                         D3DXCALLBACK_SEARCH_FORCE_DWORD=>16#7fffffff#);


   subtype D3DXCALLBACK_SEARCH_FLAGS is tagD3DXCALLBACK_SEARCH_FLAGS;

   type ID3DXAnimationSet;
   type LPID3DXANIMATIONSET is access all ID3DXAnimationSet;
   subtype LPD3DXANIMATIONSET is LPID3DXANIMATIONSET;
   type LPLPID3DXANIMATIONSET is access all LPID3DXANIMATIONSET;
   subtype LPLPD3DXANIMATIONSET is LPLPID3DXANIMATIONSET;

   type ID3DXAnimationSet is record
      QueryInterface:access procedure(THIS:LPID3DXAnimationSet;iid:REFIID;ppv:LPLPVOID) with Convention=>Stdcall;
      AddRef:access function(THIS:LPID3DXAnimationSet) return ULONG with Convention=>Stdcall;
      Release:access function(THIS:LPID3DXAnimationSet) return ULONG with Convention=>Stdcall;
      GetName:access function(THIS:LPID3DXAnimationSet) return LPCSTR with Convention=>Stdcall;
      GetPeriod:access function(THIS:LPID3DXAnimationSet) return DOUBLE with Convention=>Stdcall;
      GetPeriodicPosition:access function(THIS:LPID3DXAnimationSet;Position:DOUBLE) return DOUBLE with Convention=>Stdcall;
      GetNumAnimations:access function(THIS:LPID3DXAnimationSet) return UINT with Convention=>Stdcall;
      GetAnimationNameByIndex:access procedure(THIS:LPID3DXAnimationSet;Index:UINT;ppName:access LPCSTR) with Convention=>Stdcall;
      GetAnimationIndexByName:access procedure(THIS:LPID3DXAnimationSet;pName:LPCSTR;pIndex:LPUINT) with Convention=>Stdcall;
      GetSRT:access procedure(THIS:LPID3DXAnimationSet;PeriodicPosition:DOUBLE;Animation:UINT;pScale:LPD3DXVECTOR3;pRotation:LPD3DXQUATERNION;pTranslation:LPD3DXVECTOR3) with Convention=>Stdcall;
      GetCallback:access procedure(THIS:LPID3DXAnimationSet;Position:DOUBLE;Flags:DWORD;pCallbackPosition:LPDOUBLE;ppCallbackData:LPLPVOID) with Convention=>Stdcall;
   end record;

   type tagD3DXPLAYBACK_TYPE is (D3DXPLAY_LOOP,
                                 D3DXPLAY_ONCE,
                                 D3DXPLAY_PINGPONG,
                                 D3DXPLAY_FORCE_DWORD);
   for tagD3DXPLAYBACK_TYPE use (D3DXPLAY_LOOP=>0,
                                 D3DXPLAY_ONCE=>1,
                                 D3DXPLAY_PINGPONG=>2,
                                 D3DXPLAY_FORCE_DWORD=>16#7fffffff#);


   subtype D3DXPLAYBACK_TYPE is tagD3DXPLAYBACK_TYPE;

   type tagD3DXKEY_VECTOR3 is record
      Time:FLOAT;
      Value:D3DXVECTOR3;
   end record;

   subtype D3DXKEY_VECTOR3 is tagD3DXKEY_VECTOR3;

   type LPD3DXKEY_VECTOR3 is access all tagD3DXKEY_VECTOR3;
   type LPCD3DXKEY_VECTOR3 is access constant D3DXKEY_VECTOR3;

   type tagD3DXKEY_QUATERNION is record
      Time:FLOAT;
      Value:D3DXQUATERNION;
   end record;

   subtype D3DXKEY_QUATERNION is tagD3DXKEY_QUATERNION;

   type LPD3DXKEY_QUATERNION is access all tagD3DXKEY_QUATERNION;
   type LPCD3DXKEY_QUATERNION is access constant D3DXKEY_QUATERNION;

   type tagD3DXKEY_CALLBACK is record
      Time:FLOAT;
      pCallbackData:LPVOID;
   end record;

   subtype D3DXKEY_CALLBACK is tagD3DXKEY_CALLBACK;

   type LPD3DXKEY_CALLBACK is access all tagD3DXKEY_CALLBACK;
   type LPCD3DXKEY_CALLBACK is access constant D3DXKEY_CALLBACK;

   type tagD3DXCOMPRESSION_FLAGS is (D3DXCOMPRESS_DEFAULT,
                                     D3DXCOMPRESS_FORCE_DWORD);
   for tagD3DXCOMPRESSION_FLAGS use (D3DXCOMPRESS_DEFAULT=>16#00#,
                                     D3DXCOMPRESS_FORCE_DWORD=>16#7fffffff#);


   subtype D3DXCOMPRESSION_FLAGS is tagD3DXCOMPRESSION_FLAGS;

   type ID3DXKeyframedAnimationSet;
   type LPID3DXKEYFRAMEDANIMATIONSET is access all ID3DXKeyframedAnimationSet;
   subtype LPD3DXKEYFRAMEDANIMATIONSET is LPID3DXKEYFRAMEDANIMATIONSET;
   type LPLPID3DXKEYFRAMEDANIMATIONSET is access all LPID3DXKEYFRAMEDANIMATIONSET;
   subtype LPLPD3DXKEYFRAMEDANIMATIONSET is LPLPID3DXKEYFRAMEDANIMATIONSET;

   type ID3DXKeyframedAnimationSet is record
      QueryInterface:access procedure(THIS:LPID3DXKeyframedAnimationSet;iid:REFIID;ppv:LPLPVOID) with Convention=>Stdcall;
      AddRef:access function(THIS:LPID3DXKeyframedAnimationSet) return ULONG with Convention=>Stdcall;
      Release:access function(THIS:LPID3DXKeyframedAnimationSet) return ULONG with Convention=>Stdcall;
      GetName:access function(THIS:LPID3DXKeyframedAnimationSet) return LPCSTR with Convention=>Stdcall;
      GetPeriod:access function(THIS:LPID3DXKeyframedAnimationSet) return DOUBLE with Convention=>Stdcall;
      GetPeriodicPosition:access function(THIS:LPID3DXKeyframedAnimationSet;Position:DOUBLE) return DOUBLE with Convention=>Stdcall;
      GetNumAnimations:access function(THIS:LPID3DXKeyframedAnimationSet) return UINT with Convention=>Stdcall;
      GetAnimationNameByIndex:access procedure(THIS:LPID3DXKeyframedAnimationSet;Index:UINT;ppName:access LPCSTR) with Convention=>Stdcall;
      GetAnimationIndexByName:access procedure(THIS:LPID3DXKeyframedAnimationSet;pName:LPCSTR;pIndex:LPUINT) with Convention=>Stdcall;
      GetSRT:access procedure(THIS:LPID3DXKeyframedAnimationSet;PeriodicPosition:DOUBLE;Animation:UINT;pScale:LPD3DXVECTOR3;pRotation:LPD3DXQUATERNION;pTranslation:LPD3DXVECTOR3) with Convention=>Stdcall;
      GetCallback:access procedure(THIS:LPID3DXKeyframedAnimationSet;Position:DOUBLE;Flags:DWORD;pCallbackPosition:LPDOUBLE;ppCallbackData:LPLPVOID) with Convention=>Stdcall;
      GetPlaybackType:access function(THIS:LPID3DXKeyframedAnimationSet) return D3DXPLAYBACK_TYPE with Convention=>Stdcall;
      GetSourceTicksPerSecond:access function(THIS:LPID3DXKeyframedAnimationSet) return DOUBLE with Convention=>Stdcall;
      GetNumScaleKeys:access function(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT) return UINT with Convention=>Stdcall;
      GetScaleKeys:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;pScaleKeys:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      GetScaleKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pScaleKey:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      SetScaleKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pScaleKey:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      GetNumRotationKeys:access function(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT) return UINT with Convention=>Stdcall;
      GetRotationKeys:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;pRotationKeys:LPD3DXKEY_QUATERNION) with Convention=>Stdcall;
      GetRotationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pRotationKey:LPD3DXKEY_QUATERNION) with Convention=>Stdcall;
      SetRotationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pRotationKey:LPD3DXKEY_QUATERNION) with Convention=>Stdcall;
      GetNumTranslationKeys:access function(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT) return UINT with Convention=>Stdcall;
      GetTranslationKeys:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;pTranslationKeys:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      GetTranslationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pTranslationKey:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      SetTranslationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT;pTranslationKey:LPD3DXKEY_VECTOR3) with Convention=>Stdcall;
      GetNumCallbackKeys:access function(THIS:LPID3DXKeyframedAnimationSet) return UINT with Convention=>Stdcall;
      GetCallbackKeys:access procedure(THIS:LPID3DXKeyframedAnimationSet;pCallbackKeys:LPD3DXKEY_CALLBACK) with Convention=>Stdcall;
      GetCallbackKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Key:UINT;pCallbackKey:LPD3DXKEY_CALLBACK) with Convention=>Stdcall;
      SetCallbackKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Key:UINT;pCallbackKey:LPD3DXKEY_CALLBACK) with Convention=>Stdcall;
      UnregisterScaleKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT) with Convention=>Stdcall;
      UnregisterRotationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT) with Convention=>Stdcall;
      UnregisterTranslationKey:access procedure(THIS:LPID3DXKeyframedAnimationSet;Animation:UINT;Key:UINT) with Convention=>Stdcall;
      RegisterAnimationSRTKeys:access procedure(THIS:LPID3DXKeyframedAnimationSet;pName:LPCSTR;NumScaleKeys:UINT;NumRotationKeys:UINT;NumTranslationKeys:UINT;pScaleKeys:LPCD3DXKEY_VECTOR3;pRotationKeys:LPCD3DXKEY_QUATERNION;pTranslationKeys:LPCD3DXKEY_VECTOR3;pAnimationIndex:LPDWORD) with Convention=>Stdcall;
      Compress:access procedure(THIS:LPID3DXKeyframedAnimationSet;Flags:DWORD;Lossiness:FLOAT;pHierarchy:LPD3DXFRAME;ppCompressedData:access LPD3DXBUFFER) with Convention=>Stdcall;
      UnregisterAnimation:access procedure(THIS:LPID3DXKeyframedAnimationSet;Index:UINT) with Convention=>Stdcall;
   end record;

   type ID3DXCompressedAnimationSet;
   type LPID3DXCOMPRESSEDANIMATIONSET is access all ID3DXCompressedAnimationSet;
   subtype LPD3DXCOMPRESSEDANIMATIONSET is LPID3DXCOMPRESSEDANIMATIONSET;
   type LPLPID3DXCOMPRESSEDANIMATIONSET is access all LPID3DXCOMPRESSEDANIMATIONSET;
   subtype LPLPD3DXCOMPRESSEDANIMATIONSET is LPLPID3DXCOMPRESSEDANIMATIONSET;

   type ID3DXCompressedAnimationSet is record
      QueryInterface:access procedure(THIS:LPID3DXCompressedAnimationSet;iid:REFIID;ppv:LPLPVOID) with Convention=>Stdcall;
      AddRef:access function(THIS:LPID3DXCompressedAnimationSet) return ULONG with Convention=>Stdcall;
      Release:access function(THIS:LPID3DXCompressedAnimationSet) return ULONG with Convention=>Stdcall;
      GetName:access function(THIS:LPID3DXCompressedAnimationSet) return LPCSTR with Convention=>Stdcall;
      GetPeriod:access function(THIS:LPID3DXCompressedAnimationSet) return DOUBLE with Convention=>Stdcall;
      GetPeriodicPosition:access function(THIS:LPID3DXCompressedAnimationSet;Position:DOUBLE) return DOUBLE with Convention=>Stdcall;
      GetNumAnimations:access function(THIS:LPID3DXCompressedAnimationSet) return UINT with Convention=>Stdcall;
      GetAnimationNameByIndex:access procedure(THIS:LPID3DXCompressedAnimationSet;Index:UINT;ppName:access LPCSTR) with Convention=>Stdcall;
      GetAnimationIndexByName:access procedure(THIS:LPID3DXCompressedAnimationSet;pName:LPCSTR;pIndex:LPUINT) with Convention=>Stdcall;
      GetSRT:access procedure(THIS:LPID3DXCompressedAnimationSet;PeriodicPosition:DOUBLE;Animation:UINT;pScale:LPD3DXVECTOR3;pRotation:LPD3DXQUATERNION;pTranslation:LPD3DXVECTOR3) with Convention=>Stdcall;
      GetCallback:access procedure(THIS:LPID3DXCompressedAnimationSet;Position:DOUBLE;Flags:DWORD;pCallbackPosition:LPDOUBLE;ppCallbackData:LPLPVOID) with Convention=>Stdcall;
      GetPlaybackType:access function(THIS:LPID3DXCompressedAnimationSet) return D3DXPLAYBACK_TYPE with Convention=>Stdcall;
      GetSourceTicksPerSecond:access function(THIS:LPID3DXCompressedAnimationSet) return DOUBLE with Convention=>Stdcall;
      GetCompressedData:access procedure(THIS:LPID3DXCompressedAnimationSet;ppCompressedData:LPLPD3DXBUFFER) with Convention=>Stdcall;
      GetNumCallbackKeys:access function(THIS:LPID3DXCompressedAnimationSet) return UINT with Convention=>Stdcall;
      GetCallbackKeys:access procedure(THIS:LPID3DXCompressedAnimationSet;pCallbackKeys:LPD3DXKEY_CALLBACK) with Convention=>Stdcall;
   end record;

   type tagD3DXPRIORITY_TYPE is (D3DXPRIORITY_LOW,
                                 D3DXPRIORITY_HIGH,
                                 D3DXPRIORITY_FORCE_DWORD);
   for tagD3DXPRIORITY_TYPE use (D3DXPRIORITY_LOW=>0,
                                 D3DXPRIORITY_HIGH=>1,
                                 D3DXPRIORITY_FORCE_DWORD=>16#7fffffff#);

   subtype D3DXPRIORITY_TYPE is tagD3DXPRIORITY_TYPE;

   type tagD3DXTRACK_DESC is record
      Priority:D3DXPRIORITY_TYPE;
      Weight:FLOAT;
      Speed:FLOAT;
      Position:DOUBLE;
      Enable:BOOL;
   end record;

   subtype D3DXTRACK_DESC is tagD3DXTRACK_DESC;

   type LPD3DXTRACK_DESC is access all tagD3DXTRACK_DESC;

   type tagD3DXEVENT_TYPE is (D3DXEVENT_TRACKSPEED,
                              D3DXEVENT_TRACKWEIGHT,
                              D3DXEVENT_TRACKPOSITION,
                              D3DXEVENT_TRACKENABLE,
                              D3DXEVENT_PRIORITYBLEND,
                              D3DXEVENT_FORCE_DWORD);
   for tagD3DXEVENT_TYPE use (D3DXEVENT_TRACKSPEED=>0,
                              D3DXEVENT_TRACKWEIGHT=>1,
                              D3DXEVENT_TRACKPOSITION=>2,
                              D3DXEVENT_TRACKENABLE=>3,
                              D3DXEVENT_PRIORITYBLEND=>4,
                              D3DXEVENT_FORCE_DWORD=>16#7fffffff#);


   subtype D3DXEVENT_TYPE is tagD3DXEVENT_TYPE;

   type tagD3DXTRANSITION_TYPE is (D3DXTRANSITION_LINEAR,
                                   D3DXTRANSITION_EASEINEASEOUT,
                                   D3DXTRANSITION_FORCE_DWORD);
   for tagD3DXTRANSITION_TYPE use (D3DXTRANSITION_LINEAR=>16#000#,
                                   D3DXTRANSITION_EASEINEASEOUT=>16#001#,
                                   D3DXTRANSITION_FORCE_DWORD=>16#7fffffff#);


   subtype D3DXTRANSITION_TYPE is tagD3DXTRANSITION_TYPE;
   
   type tagD3DXEVENT_DESC(C:Integer:=0) is record
      Typ:D3DXEVENT_TYPE;
      Track:uint;
      StartTime:double;
      Duration:double;
      Transition:D3DXTRANSITION_TYPE;
      case C is
         when 0=>
            Weight:float;
         when 1=>
            Speed:float;
         when 2=>
            Position:double;
         when others=>
            Enable:bool;
      end case;
   end record with unchecked_union;
   subtype D3DXEVENT_DESC is tagD3DXEVENT_DESC;
   type LPD3DXEVENT_DESC is access all tagD3DXEVENT_DESC;
   
   
   subtype D3DXEVENTHANDLE is DWORD;
   type LPD3DXEVENTHANDLE is access all D3DXEVENTHANDLE;

   type ID3DXAnimationCallbackHandler;
   type LPID3DXANIMATIONCALLBACKHANDLER is access all ID3DXAnimationCallbackHandler;
   subtype LPD3DXANIMATIONCALLBACKHANDLER is LPID3DXANIMATIONCALLBACKHANDLER;

   type ID3DXAnimationCallbackHandler is record
      HandleCallback:access procedure(THIS:LPID3DXAnimationCallbackHandler;Track:UINT;pCallbackData:LPVOID) with Convention=>Stdcall;
   end record;

   type ID3DXAnimationController;
   type LPID3DXANIMATIONCONTROLLER is access all ID3DXAnimationController;
   subtype LPD3DXANIMATIONCONTROLLER is LPID3DXANIMATIONCONTROLLER;
   type LPLPID3DXANIMATIONCONTROLLER is access all LPID3DXANIMATIONCONTROLLER;
   subtype LPLPD3DXANIMATIONCONTROLLER is LPLPID3DXANIMATIONCONTROLLER;

   type ID3DXAnimationController is record
      QueryInterface:access procedure(THIS:LPID3DXAnimationController;iid:REFIID;ppv:LPLPVOID) with Convention=>Stdcall;
      AddRef:access function(THIS:LPID3DXAnimationController) return ULONG with Convention=>Stdcall;
      Release:access function(THIS:LPID3DXAnimationController) return ULONG with Convention=>Stdcall;
      GetMaxNumAnimationOutputs:access function(THIS:LPID3DXAnimationController) return UINT with Convention=>Stdcall;
      GetMaxNumAnimationSets:access function(THIS:LPID3DXAnimationController) return UINT with Convention=>Stdcall;
      GetMaxNumTracks:access function(THIS:LPID3DXAnimationController) return UINT with Convention=>Stdcall;
      GetMaxNumEvents:access function(THIS:LPID3DXAnimationController) return UINT with Convention=>Stdcall;
      RegisterAnimationOutput:access procedure(THIS:LPID3DXAnimationController;pName:LPCSTR;pMatrix:LPD3DMATRIX;pScale:LPD3DXVECTOR3;pRotation:LPD3DXQUATERNION;pTranslation:LPD3DXVECTOR3) with Convention=>Stdcall;
      RegisterAnimationSet:access procedure(THIS:LPID3DXAnimationController;pAnimSet:LPD3DXANIMATIONSET) with Convention=>Stdcall;
      UnregisterAnimationSet:access procedure(THIS:LPID3DXAnimationController;pAnimSet:LPD3DXANIMATIONSET) with Convention=>Stdcall;
      GetNumAnimationSets:access function(THIS:LPID3DXAnimationController) return UINT with Convention=>Stdcall;
      GetAnimationSet:access procedure(THIS:LPID3DXAnimationController;Index:UINT;ppAnimationSet:LPLPD3DXANIMATIONSET) with Convention=>Stdcall;
      GetAnimationSetByName:access procedure(THIS:LPID3DXAnimationController;szName:LPCSTR;ppAnimationSet:LPLPD3DXANIMATIONSET) with Convention=>Stdcall;
      AdvanceTime:access procedure(THIS:LPID3DXAnimationController;TimeDelta:DOUBLE;pCallbackHandler:LPD3DXANIMATIONCALLBACKHANDLER) with Convention=>Stdcall;
      ResetTime:access procedure(THIS:LPID3DXAnimationController) with Convention=>Stdcall;
      GetTime:access function(THIS:LPID3DXAnimationController) return DOUBLE with Convention=>Stdcall;
      SetTrackAnimationSet:access procedure(THIS:LPID3DXAnimationController;Track:UINT;pAnimSet:LPD3DXANIMATIONSET) with Convention=>Stdcall;
      GetTrackAnimationSet:access procedure(THIS:LPID3DXAnimationController;Track:UINT;ppAnimSet:LPLPD3DXANIMATIONSET) with Convention=>Stdcall;
      SetTrackPriority:access procedure(THIS:LPID3DXAnimationController;Track:UINT;Priority:D3DXPRIORITY_TYPE) with Convention=>Stdcall;
      SetTrackSpeed:access procedure(THIS:LPID3DXAnimationController;Track:UINT;Speed:FLOAT) with Convention=>Stdcall;
      SetTrackWeight:access procedure(THIS:LPID3DXAnimationController;Track:UINT;Weight:FLOAT) with Convention=>Stdcall;
      SetTrackPosition:access procedure(THIS:LPID3DXAnimationController;Track:UINT;Position:DOUBLE) with Convention=>Stdcall;
      SetTrackEnable:access procedure(THIS:LPID3DXAnimationController;Track:UINT;Enable:BOOL) with Convention=>Stdcall;
      SetTrackDesc:access procedure(THIS:LPID3DXAnimationController;Track:UINT;pDesc:LPD3DXTRACK_DESC) with Convention=>Stdcall;
      GetTrackDesc:access procedure(THIS:LPID3DXAnimationController;Track:UINT;pDesc:LPD3DXTRACK_DESC) with Convention=>Stdcall;
      SetPriorityBlend:access procedure(THIS:LPID3DXAnimationController;BlendWeight:FLOAT) with Convention=>Stdcall;
      GetPriorityBlend:access function(THIS:LPID3DXAnimationController) return FLOAT with Convention=>Stdcall;
      KeyTrackSpeed:access function(THIS:LPID3DXAnimationController;Track:UINT;NewSpeed:FLOAT;StartTime:DOUBLE;Duration:DOUBLE;Transition:D3DXTRANSITION_TYPE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      KeyTrackWeight:access function(THIS:LPID3DXAnimationController;Track:UINT;NewWeight:FLOAT;StartTime:DOUBLE;Duration:DOUBLE;Transition:D3DXTRANSITION_TYPE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      KeyTrackPosition:access function(THIS:LPID3DXAnimationController;Track:UINT;NewPosition:DOUBLE;StartTime:DOUBLE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      KeyTrackEnable:access function(THIS:LPID3DXAnimationController;Track:UINT;NewEnable:BOOL;StartTime:DOUBLE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      KeyPriorityBlend:access function(THIS:LPID3DXAnimationController;NewBlendWeight:FLOAT;StartTime:DOUBLE;Duration:DOUBLE;Transition:D3DXTRANSITION_TYPE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      UnkeyEvent:access procedure(THIS:LPID3DXAnimationController;hEvent:D3DXEVENTHANDLE) with Convention=>Stdcall;
      UnkeyAllTrackEvents:access procedure(THIS:LPID3DXAnimationController;Track:UINT) with Convention=>Stdcall;
      UnkeyAllPriorityBlends:access procedure(THIS:LPID3DXAnimationController) with Convention=>Stdcall;
      GetCurrentTrackEvent:access function(THIS:LPID3DXAnimationController;Track:UINT;EventType:D3DXEVENT_TYPE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      GetCurrentPriorityBlend:access function(THIS:LPID3DXAnimationController) return D3DXEVENTHANDLE with Convention=>Stdcall;
      GetUpcomingTrackEvent:access function(THIS:LPID3DXAnimationController;Track:UINT;hEvent:D3DXEVENTHANDLE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      GetUpcomingPriorityBlend:access function(THIS:LPID3DXAnimationController;hEvent:D3DXEVENTHANDLE) return D3DXEVENTHANDLE with Convention=>Stdcall;
      ValidateEvent:access procedure(THIS:LPID3DXAnimationController;hEvent:D3DXEVENTHANDLE) with Convention=>Stdcall;
      GetEventDesc:access procedure(THIS:LPID3DXAnimationController;hEvent:D3DXEVENTHANDLE;pDesc:LPD3DXEVENT_DESC) with Convention=>Stdcall;
      CloneAnimationController:access procedure(THIS:LPID3DXAnimationController;MaxNumAnimationOutputs:UINT;MaxNumAnimationSets:UINT;MaxNumTracks:UINT;MaxNumEvents:UINT;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) with Convention=>Stdcall;
   end record;

   function D3DXLoadMeshHierarchyFromXA(Filename:LPCSTR;MeshOptions:DWORD;pD3DDevice:LPDIRECT3DDEVICE9;pAlloc:LPD3DXALLOCATEHIERARCHY;pUserDataLoader:LPD3DXLOADUSERDATA;ppFrameHierarchy:LPLPD3DXFRAME;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXLoadMeshHierarchyFromXA";
   function D3DXLoadMeshHierarchyFromX(Filename:LPCSTR;MeshOptions:DWORD;pD3DDevice:LPDIRECT3DDEVICE9;pAlloc:LPD3DXALLOCATEHIERARCHY;pUserDataLoader:LPD3DXLOADUSERDATA;ppFrameHierarchy:LPLPD3DXFRAME;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXLoadMeshHierarchyFromXA";

   function D3DXLoadMeshHierarchyFromXW(Filename:LPCWSTR;MeshOptions:DWORD;pD3DDevice:LPDIRECT3DDEVICE9;pAlloc:LPD3DXALLOCATEHIERARCHY;pUserDataLoader:LPD3DXLOADUSERDATA;ppFrameHierarchy:LPLPD3DXFRAME;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXLoadMeshHierarchyFromXW";



   function D3DXLoadMeshHierarchyFromXInMemory(Memory:LPCVOID;SizeOfMemory:DWORD;MeshOptions:DWORD;pD3DDevice:LPDIRECT3DDEVICE9;pAlloc:LPD3DXALLOCATEHIERARCHY;pUserDataLoader:LPD3DXLOADUSERDATA;ppFrameHierarchy:LPLPD3DXFRAME;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXLoadMeshHierarchyFromXInMemory";

   function D3DXSaveMeshHierarchyToFileA(Filename:LPCSTR;XFormat:DWORD;pFrameRoot:LPCD3DXFRAME;pAnimcontroller:LPD3DXANIMATIONCONTROLLER;pUserDataSaver:LPD3DXSAVEUSERDATA) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXSaveMeshHierarchyToFileA";
   function D3DXSaveMeshHierarchyToFile(Filename:LPCSTR;XFormat:DWORD;pFrameRoot:LPCD3DXFRAME;pAnimcontroller:LPD3DXANIMATIONCONTROLLER;pUserDataSaver:LPD3DXSAVEUSERDATA) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXSaveMeshHierarchyToFileA";

   function D3DXSaveMeshHierarchyToFileW(Filename:LPCWSTR;XFormat:DWORD;pFrameRoot:LPCD3DXFRAME;pAnimController:LPD3DXANIMATIONCONTROLLER;pUserDataSaver:LPD3DXSAVEUSERDATA) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXSaveMeshHierarchyToFileW";


   function D3DXFrameDestroy(pFrameRoot:LPD3DXFRAME;pAlloc:LPD3DXALLOCATEHIERARCHY) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXFrameDestroy";

   function D3DXFrameAppendChild(pFrameParent:LPD3DXFRAME;pFrameChild:LPCD3DXFRAME) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXFrameAppendChild";

   function D3DXFrameFind(pFrameRoot:LPCD3DXFRAME;Name:LPCSTR) return LPD3DXFRAME with Import,Convention=>stdcall,external_name=>"D3DXFrameFind";

   function D3DXFrameRegisterNamedMatrices(pFrameRoot:LPD3DXFRAME;pAnimController:LPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXFrameRegisterNamedMatrices";

   function D3DXFrameNumNamedMatrices(pFrameRoot:LPCD3DXFRAME) return UINT with Import,Convention=>stdcall,external_name=>"D3DXFrameNumNamedMatrices";

   function D3DXFrameCalculateBoundingSphere(pFrameRoot:LPCD3DXFRAME;pObjectCenter:LPD3DXVECTOR3;pObjectRadius:LPFLOAT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXFrameCalculateBoundingSphere";

   function D3DXCreateKeyframedAnimationSet(pName:LPCSTR;TicksPerSecond:DOUBLE;Playback:D3DXPLAYBACK_TYPE;NumAnimations:UINT;NumCallbackKeys:UINT;pCallbackKeys:LPCD3DXKEY_CALLBACK;ppAnimationSet:LPLPD3DXKEYFRAMEDANIMATIONSET) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXCreateKeyframedAnimationSet";

   function D3DXCreateCompressedAnimationSet(pName:LPCSTR;TicksPerSecond:DOUBLE;Playback:D3DXPLAYBACK_TYPE;pCompressedData:LPD3DXBUFFER;NumCallbackKeys:UINT;pCallbackKeys:LPCD3DXKEY_CALLBACK;ppAnimationSet:LPLPD3DXCOMPRESSEDANIMATIONSET) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXCreateCompressedAnimationSet";

   function D3DXCreateAnimationController(MaxNumMatrices:UINT;MaxNumAnimationSets:UINT;MaxNumTracks:UINT;MaxNumEvents:UINT;ppAnimController:LPLPD3DXANIMATIONCONTROLLER) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DXCreateAnimationController";





   --
   -- THE END
   --




end d3dx9anim;

 

接着到版本10了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值