Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx9anim.h
  6. //  Content:    D3DX mesh types and functions
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9.  
  10. #ifndef __D3DX9ANIM_H__
  11. #define __D3DX9ANIM_H__
  12.  
  13. // {698CFB3F-9289-4d95-9A57-33A94B5A65F9}
  14. DEFINE_GUID(IID_ID3DXAnimationSet,
  15. 0x698cfb3f, 0x9289, 0x4d95, 0x9a, 0x57, 0x33, 0xa9, 0x4b, 0x5a, 0x65, 0xf9);
  16.  
  17. // {FA4E8E3A-9786-407d-8B4C-5995893764AF}
  18. DEFINE_GUID(IID_ID3DXKeyframedAnimationSet,
  19. 0xfa4e8e3a, 0x9786, 0x407d, 0x8b, 0x4c, 0x59, 0x95, 0x89, 0x37, 0x64, 0xaf);
  20.  
  21. // {6CC2480D-3808-4739-9F88-DE49FACD8D4C}
  22. DEFINE_GUID(IID_ID3DXCompressedAnimationSet,
  23. 0x6cc2480d, 0x3808, 0x4739, 0x9f, 0x88, 0xde, 0x49, 0xfa, 0xcd, 0x8d, 0x4c);
  24.  
  25. // {AC8948EC-F86D-43e2-96DE-31FC35F96D9E}
  26. DEFINE_GUID(IID_ID3DXAnimationController,
  27. 0xac8948ec, 0xf86d, 0x43e2, 0x96, 0xde, 0x31, 0xfc, 0x35, 0xf9, 0x6d, 0x9e);
  28.  
  29.  
  30. //----------------------------------------------------------------------------
  31. // D3DXMESHDATATYPE:
  32. // -----------------
  33. // This enum defines the type of mesh data present in a MeshData structure.
  34. //----------------------------------------------------------------------------
  35. typedef enum _D3DXMESHDATATYPE {
  36.     D3DXMESHTYPE_MESH      = 0x001,             // Normal ID3DXMesh data
  37.     D3DXMESHTYPE_PMESH     = 0x002,             // Progressive Mesh - ID3DXPMesh
  38.     D3DXMESHTYPE_PATCHMESH = 0x003,             // Patch Mesh - ID3DXPatchMesh
  39.  
  40.     D3DXMESHTYPE_FORCE_DWORD    = 0x7fffffff,   /* force 32-bit size enum */
  41. } D3DXMESHDATATYPE;
  42.  
  43. //----------------------------------------------------------------------------
  44. // D3DXMESHDATA:
  45. // -------------
  46. // This struct encapsulates a the mesh data that can be present in a mesh
  47. // container.  The supported mesh types are pMesh, pPMesh, pPatchMesh.
  48. // The valid way to access this is determined by the Type enum.
  49. //----------------------------------------------------------------------------
  50. typedef struct _D3DXMESHDATA
  51. {
  52.     D3DXMESHDATATYPE Type;
  53.  
  54.     // current mesh data interface
  55.     union
  56.     {
  57.         LPD3DXMESH              pMesh;
  58.         LPD3DXPMESH             pPMesh;
  59.         LPD3DXPATCHMESH         pPatchMesh;
  60.     };
  61. } D3DXMESHDATA, *LPD3DXMESHDATA;
  62.  
  63. //----------------------------------------------------------------------------
  64. // D3DXMESHCONTAINER:
  65. // ------------------
  66. // This struct encapsulates a mesh object in a transformation frame
  67. // hierarchy. The app can derive from this structure to add other app specific
  68. // data to this.
  69. //----------------------------------------------------------------------------
  70. typedef struct _D3DXMESHCONTAINER
  71. {
  72.     LPSTR                   Name;
  73.  
  74.     D3DXMESHDATA            MeshData;
  75.  
  76.     LPD3DXMATERIAL          pMaterials;
  77.     LPD3DXEFFECTINSTANCE    pEffects;
  78.     DWORD                   NumMaterials;
  79.     DWORD                  *pAdjacency;
  80.  
  81.     LPD3DXSKININFO          pSkinInfo;
  82.  
  83.     struct _D3DXMESHCONTAINER *pNextMeshContainer;
  84. } D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER;
  85.  
  86. //----------------------------------------------------------------------------
  87. // D3DXFRAME:
  88. // ----------
  89. // This struct is the encapsulates a transform frame in a transformation frame
  90. // hierarchy. The app can derive from this structure to add other app specific
  91. // data to this
  92. //----------------------------------------------------------------------------
  93. typedef struct _D3DXFRAME
  94. {
  95.     LPSTR                   Name;
  96.     D3DXMATRIX              TransformationMatrix;
  97.  
  98.     LPD3DXMESHCONTAINER     pMeshContainer;
  99.  
  100.     struct _D3DXFRAME       *pFrameSibling;
  101.     struct _D3DXFRAME       *pFrameFirstChild;
  102. } D3DXFRAME, *LPD3DXFRAME;
  103.  
  104.  
  105. //----------------------------------------------------------------------------
  106. // ID3DXAllocateHierarchy:
  107. // -----------------------
  108. // This interface is implemented by the application to allocate/free frame and
  109. // mesh container objects. Methods on this are called during loading and
  110. // destroying frame hierarchies
  111. //----------------------------------------------------------------------------
  112. typedef interface ID3DXAllocateHierarchy ID3DXAllocateHierarchy;
  113. typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY;
  114.  
  115. #undef INTERFACE
  116. #define INTERFACE ID3DXAllocateHierarchy
  117.  
  118. DECLARE_INTERFACE(ID3DXAllocateHierarchy)
  119. {
  120.     // ID3DXAllocateHierarchy
  121.  
  122.         //------------------------------------------------------------------------
  123.         // CreateFrame:
  124.         // ------------
  125.         // Requests allocation of a frame object.
  126.         //
  127.         // Parameters:
  128.         //  Name
  129.         //              Name of the frame to be created
  130.         //      ppNewFrame
  131.         //              Returns the created frame object
  132.         //
  133.         //------------------------------------------------------------------------
  134.     STDMETHOD(CreateFrame)(THIS_ LPCSTR Name,
  135.                             LPD3DXFRAME *ppNewFrame) PURE;
  136.  
  137.         //------------------------------------------------------------------------
  138.         // CreateMeshContainer:
  139.         // --------------------
  140.         // Requests allocation of a mesh container object.
  141.         //
  142.         // Parameters:
  143.         //  Name
  144.         //              Name of the mesh
  145.         //      pMesh
  146.         //              Pointer to the mesh object if basic polygon data found
  147.         //      pPMesh
  148.         //              Pointer to the progressive mesh object if progressive mesh data found
  149.         //      pPatchMesh
  150.         //              Pointer to the patch mesh object if patch data found
  151.         //      pMaterials
  152.         //              Array of materials used in the mesh
  153.         //      pEffectInstances
  154.         //              Array of effect instances used in the mesh
  155.         //      NumMaterials
  156.         //              Num elements in the pMaterials array
  157.         //      pAdjacency
  158.         //              Adjacency array for the mesh
  159.         //      pSkinInfo
  160.         //              Pointer to the skininfo object if the mesh is skinned
  161.         //      pBoneNames
  162.         //              Array of names, one for each bone in the skinned mesh.
  163.         //              The numberof bones can be found from the pSkinMesh object
  164.         //      pBoneOffsetMatrices
  165.         //              Array of matrices, one for each bone in the skinned mesh.
  166.         //
  167.         //------------------------------------------------------------------------
  168.     STDMETHOD(CreateMeshContainer)(THIS_
  169.         LPCSTR Name,
  170.         CONST D3DXMESHDATA *pMeshData,
  171.         CONST D3DXMATERIAL *pMaterials,
  172.         CONST D3DXEFFECTINSTANCE *pEffectInstances,
  173.         DWORD NumMaterials,
  174.         CONST DWORD *pAdjacency,
  175.         LPD3DXSKININFO pSkinInfo,
  176.         LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE;
  177.  
  178.         //------------------------------------------------------------------------
  179.         // DestroyFrame:
  180.         // -------------
  181.         // Requests de-allocation of a frame object.
  182.         //
  183.         // Parameters:
  184.         //  pFrameToFree
  185.         //              Pointer to the frame to be de-allocated
  186.         //
  187.         //------------------------------------------------------------------------
  188.     STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE;
  189.  
  190.         //------------------------------------------------------------------------
  191.         // DestroyMeshContainer:
  192.         // ---------------------
  193.         // Requests de-allocation of a mesh container object.
  194.         //
  195.         // Parameters:
  196.         //  pMeshContainerToFree
  197.         //              Pointer to the mesh container object to be de-allocated
  198.         //
  199.         //------------------------------------------------------------------------
  200.     STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE;
  201. };
  202.  
  203. //----------------------------------------------------------------------------
  204. // ID3DXLoadUserData:
  205. // ------------------
  206. // This interface is implemented by the application to load user data in a .X file
  207. // When user data is found, these callbacks will be used to allow the application
  208. // to load the data.
  209. //----------------------------------------------------------------------------
  210. typedef interface ID3DXLoadUserData ID3DXLoadUserData;
  211. typedef interface ID3DXLoadUserData *LPD3DXLOADUSERDATA;
  212.  
  213. #undef INTERFACE
  214. #define INTERFACE ID3DXLoadUserData
  215.  
  216. DECLARE_INTERFACE(ID3DXLoadUserData)
  217. {
  218.     STDMETHOD(LoadTopLevelData)(LPD3DXFILEDATA pXofChildData) PURE;
  219.                            
  220.     STDMETHOD(LoadFrameChildData)(LPD3DXFRAME pFrame,
  221.                             LPD3DXFILEDATA pXofChildData) PURE;
  222.                            
  223.     STDMETHOD(LoadMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer,
  224.                             LPD3DXFILEDATA pXofChildData) PURE;                            
  225. };
  226.  
  227. //----------------------------------------------------------------------------
  228. // ID3DXSaveUserData:
  229. // ------------------
  230. // This interface is implemented by the application to save user data in a .X file
  231. // The callbacks are called for all data saved.  The user can then add any
  232. // child data objects to the object provided to the callback.
  233. //----------------------------------------------------------------------------
  234. typedef interface ID3DXSaveUserData ID3DXSaveUserData;
  235. typedef interface ID3DXSaveUserData *LPD3DXSAVEUSERDATA;
  236.  
  237. #undef INTERFACE
  238. #define INTERFACE ID3DXSaveUserData
  239.  
  240. DECLARE_INTERFACE(ID3DXSaveUserData)
  241. {
  242.     STDMETHOD(AddFrameChildData)(CONST D3DXFRAME *pFrame,
  243.                             LPD3DXFILESAVEOBJECT pXofSave,
  244.                             LPD3DXFILESAVEDATA pXofFrameData) PURE;
  245.                            
  246.     STDMETHOD(AddMeshChildData)(CONST D3DXMESHCONTAINER *pMeshContainer,
  247.                             LPD3DXFILESAVEOBJECT pXofSave,
  248.                             LPD3DXFILESAVEDATA pXofMeshData) PURE;
  249.                            
  250.     // NOTE: this is called once per Save.  All top level objects should be added using the
  251.     //    provided interface.  One call adds objects before the frame hierarchy, the other after
  252.     STDMETHOD(AddTopLevelDataObjectsPre)(LPD3DXFILESAVEOBJECT pXofSave) PURE;
  253.     STDMETHOD(AddTopLevelDataObjectsPost)(LPD3DXFILESAVEOBJECT pXofSave) PURE;                            
  254.  
  255.     // callbacks for the user to register and then save templates to the XFile
  256.     STDMETHOD(RegisterTemplates)(LPD3DXFILE pXFileApi) PURE;                            
  257.     STDMETHOD(SaveTemplates)(LPD3DXFILESAVEOBJECT pXofSave) PURE;                            
  258. };
  259.  
  260.  
  261. //----------------------------------------------------------------------------
  262. // D3DXCALLBACK_SEARCH_FLAGS:
  263. // --------------------------
  264. // Flags that can be passed into ID3DXAnimationSet::GetCallback.
  265. //----------------------------------------------------------------------------
  266. typedef enum _D3DXCALLBACK_SEARCH_FLAGS
  267. {
  268.     D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION = 0x01,  // exclude callbacks at the initial position from the search
  269.     D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION    = 0x02,  // reverse the callback search direction
  270.  
  271.     D3DXCALLBACK_SEARCH_FORCE_DWORD                = 0x7fffffff,
  272. } D3DXCALLBACK_SEARCH_FLAGS;
  273.  
  274. //----------------------------------------------------------------------------
  275. // ID3DXAnimationSet:
  276. // ------------------
  277. // This interface implements an animation set.
  278. //----------------------------------------------------------------------------
  279. typedef interface ID3DXAnimationSet ID3DXAnimationSet;
  280. typedef interface ID3DXAnimationSet *LPD3DXANIMATIONSET;
  281.  
  282. #undef INTERFACE
  283. #define INTERFACE ID3DXAnimationSet
  284.  
  285. DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown)
  286. {
  287.     // IUnknown
  288.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  289.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  290.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  291.  
  292.     // Name
  293.     STDMETHOD_(LPCSTR, GetName)(THIS) PURE;
  294.  
  295.     // Period
  296.     STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE;
  297.     STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE;    // Maps position into animation period
  298.  
  299.     // Animation names
  300.     STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE;
  301.     STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE;
  302.     STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE;
  303.  
  304.     // SRT
  305.     STDMETHOD(GetSRT)(THIS_
  306.         DOUBLE PeriodicPosition,            // Position mapped to period (use GetPeriodicPosition)
  307.         UINT Animation,                     // Animation index
  308.         D3DXVECTOR3 *pScale,                // Returns the scale
  309.         D3DXQUATERNION *pRotation,          // Returns the rotation as a quaternion
  310.         D3DXVECTOR3 *pTranslation) PURE;    // Returns the translation
  311.  
  312.     // Callbacks
  313.     STDMETHOD(GetCallback)(THIS_
  314.         DOUBLE Position,                    // Position from which to find callbacks
  315.         DWORD Flags,                        // Callback search flags
  316.         DOUBLE *pCallbackPosition,          // Returns the position of the callback
  317.         LPVOID *ppCallbackData) PURE;       // Returns the callback data pointer
  318. };
  319.  
  320.  
  321. //----------------------------------------------------------------------------
  322. // D3DXPLAYBACK_TYPE:
  323. // ------------------
  324. // This enum defines the type of animation set loop modes.
  325. //----------------------------------------------------------------------------
  326. typedef enum _D3DXPLAYBACK_TYPE
  327. {
  328.     D3DXPLAY_LOOP          = 0,
  329.     D3DXPLAY_ONCE          = 1,
  330.     D3DXPLAY_PINGPONG      = 2,
  331.  
  332.     D3DXPLAY_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  333. } D3DXPLAYBACK_TYPE;
  334.  
  335.  
  336. //----------------------------------------------------------------------------
  337. // D3DXKEY_VECTOR3:
  338. // ----------------
  339. // This structure describes a vector key for use in keyframe animation.
  340. // It specifies a vector Value at a given Time. This is used for scale and
  341. // translation keys.
  342. //----------------------------------------------------------------------------
  343. typedef struct _D3DXKEY_VECTOR3
  344. {
  345.     FLOAT Time;
  346.     D3DXVECTOR3 Value;
  347. } D3DXKEY_VECTOR3, *LPD3DXKEY_VECTOR3;
  348.  
  349.  
  350. //----------------------------------------------------------------------------
  351. // D3DXKEY_QUATERNION:
  352. // -------------------
  353. // This structure describes a quaternion key for use in keyframe animation.
  354. // It specifies a quaternion Value at a given Time. This is used for rotation
  355. // keys.
  356. //----------------------------------------------------------------------------
  357. typedef struct _D3DXKEY_QUATERNION
  358. {
  359.     FLOAT Time;
  360.     D3DXQUATERNION Value;
  361. } D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION;
  362.  
  363.  
  364. //----------------------------------------------------------------------------
  365. // D3DXKEY_CALLBACK:
  366. // -----------------
  367. // This structure describes an callback key for use in keyframe animation.
  368. // It specifies a pointer to user data at a given Time.
  369. //----------------------------------------------------------------------------
  370. typedef struct _D3DXKEY_CALLBACK
  371. {
  372.     FLOAT Time;
  373.     LPVOID pCallbackData;
  374. } D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK;
  375.  
  376.  
  377. //----------------------------------------------------------------------------
  378. // D3DXCOMPRESSION_FLAGS:
  379. // ----------------------
  380. // Flags that can be passed into ID3DXKeyframedAnimationSet::Compress.
  381. //----------------------------------------------------------------------------
  382. typedef enum _D3DXCOMPRESSION_FLAGS
  383. {
  384.     D3DXCOMPRESS_DEFAULT     = 0x00,
  385.  
  386.     D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff,
  387. } D3DXCOMPRESSION_FLAGS;
  388.  
  389.  
  390. //----------------------------------------------------------------------------
  391. // ID3DXKeyframedAnimationSet:
  392. // ---------------------------
  393. // This interface implements a compressable keyframed animation set.
  394. //----------------------------------------------------------------------------
  395. typedef interface ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet;
  396. typedef interface ID3DXKeyframedAnimationSet *LPD3DXKEYFRAMEDANIMATIONSET;
  397.  
  398. #undef INTERFACE
  399. #define INTERFACE ID3DXKeyframedAnimationSet
  400.  
  401. DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet)
  402. {
  403.     // ID3DXAnimationSet
  404.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  405.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  406.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  407.  
  408.     // Name
  409.     STDMETHOD_(LPCSTR, GetName)(THIS) PURE;
  410.  
  411.     // Period
  412.     STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE;
  413.     STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE;    // Maps position into animation period
  414.  
  415.     // Animation names
  416.     STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE;
  417.     STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE;
  418.     STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE;
  419.  
  420.     // SRT
  421.     STDMETHOD(GetSRT)(THIS_
  422.         DOUBLE PeriodicPosition,            // Position mapped to period (use GetPeriodicPosition)
  423.         UINT Animation,                     // Animation index
  424.         D3DXVECTOR3 *pScale,                // Returns the scale
  425.         D3DXQUATERNION *pRotation,          // Returns the rotation as a quaternion
  426.         D3DXVECTOR3 *pTranslation) PURE;    // Returns the translation
  427.  
  428.     // Callbacks
  429.     STDMETHOD(GetCallback)(THIS_
  430.         DOUBLE Position,                    // Position from which to find callbacks
  431.         DWORD Flags,                        // Callback search flags
  432.         DOUBLE *pCallbackPosition,          // Returns the position of the callback
  433.         LPVOID *ppCallbackData) PURE;       // Returns the callback data pointer
  434.  
  435.     // Playback
  436.     STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE;
  437.     STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE;
  438.  
  439.     // Scale keys
  440.     STDMETHOD_(UINT, GetNumScaleKeys)(THIS_ UINT Animation) PURE;
  441.         STDMETHOD(GetScaleKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pScaleKeys) PURE;
  442.         STDMETHOD(GetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE;
  443.         STDMETHOD(SetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE;
  444.  
  445.     // Rotation keys
  446.     STDMETHOD_(UINT, GetNumRotationKeys)(THIS_ UINT Animation) PURE;
  447.         STDMETHOD(GetRotationKeys)(THIS_ UINT Animation, LPD3DXKEY_QUATERNION pRotationKeys) PURE;
  448.         STDMETHOD(GetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE;
  449.         STDMETHOD(SetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE;
  450.  
  451.     // Translation keys
  452.     STDMETHOD_(UINT, GetNumTranslationKeys)(THIS_ UINT Animation) PURE;
  453.         STDMETHOD(GetTranslationKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pTranslationKeys) PURE;
  454.         STDMETHOD(GetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE;
  455.         STDMETHOD(SetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE;
  456.  
  457.     // Callback keys
  458.     STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE;
  459.         STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE;
  460.         STDMETHOD(GetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE;
  461.         STDMETHOD(SetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE;
  462.  
  463.         // Key removal methods. These are slow, and should not be used once the animation starts playing
  464.         STDMETHOD(UnregisterScaleKey)(THIS_ UINT Animation, UINT Key) PURE;
  465.         STDMETHOD(UnregisterRotationKey)(THIS_ UINT Animation, UINT Key) PURE;
  466.         STDMETHOD(UnregisterTranslationKey)(THIS_ UINT Animation, UINT Key) PURE;
  467.  
  468.     // One-time animaton SRT keyframe registration
  469.     STDMETHOD(RegisterAnimationSRTKeys)(THIS_
  470.         LPCSTR pName,                                   // Animation name
  471.         UINT NumScaleKeys,                              // Number of scale keys
  472.         UINT NumRotationKeys,                           // Number of rotation keys
  473.         UINT NumTranslationKeys,                        // Number of translation keys
  474.         CONST D3DXKEY_VECTOR3 *pScaleKeys,              // Array of scale keys
  475.         CONST D3DXKEY_QUATERNION *pRotationKeys,        // Array of rotation keys
  476.         CONST D3DXKEY_VECTOR3 *pTranslationKeys,                // Array of translation keys
  477.                 DWORD *pAnimationIndex) PURE;                                   // Returns the animation index
  478.  
  479.     // Compression
  480.     STDMETHOD(Compress)(THIS_
  481.         DWORD Flags,                            // Compression flags (use D3DXCOMPRESS_STRONG for better results)
  482.         FLOAT Lossiness,                        // Compression loss ratio in the [0, 1] range
  483.         LPD3DXFRAME pHierarchy,                 // Frame hierarchy (optional)
  484.         LPD3DXBUFFER *ppCompressedData) PURE;   // Returns the compressed animation set
  485.  
  486.     STDMETHOD(UnregisterAnimation)(THIS_ UINT Index) PURE;
  487. };
  488.  
  489.  
  490. //----------------------------------------------------------------------------
  491. // ID3DXCompressedAnimationSet:
  492. // ----------------------------
  493. // This interface implements a compressed keyframed animation set.
  494. //----------------------------------------------------------------------------
  495. typedef interface ID3DXCompressedAnimationSet ID3DXCompressedAnimationSet;
  496. typedef interface ID3DXCompressedAnimationSet *LPD3DXCOMPRESSEDANIMATIONSET;
  497.  
  498. #undef INTERFACE
  499. #define INTERFACE ID3DXCompressedAnimationSet
  500.  
  501. DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet)
  502. {
  503.     // ID3DXAnimationSet
  504.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  505.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  506.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  507.  
  508.     // Name
  509.     STDMETHOD_(LPCSTR, GetName)(THIS) PURE;
  510.  
  511.     // Period
  512.     STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE;
  513.     STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE;    // Maps position into animation period
  514.  
  515.     // Animation names
  516.     STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE;
  517.     STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE;
  518.     STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE;
  519.  
  520.     // SRT
  521.     STDMETHOD(GetSRT)(THIS_
  522.         DOUBLE PeriodicPosition,            // Position mapped to period (use GetPeriodicPosition)
  523.         UINT Animation,                     // Animation index
  524.         D3DXVECTOR3 *pScale,                // Returns the scale
  525.         D3DXQUATERNION *pRotation,          // Returns the rotation as a quaternion
  526.         D3DXVECTOR3 *pTranslation) PURE;    // Returns the translation
  527.  
  528.     // Callbacks
  529.     STDMETHOD(GetCallback)(THIS_
  530.         DOUBLE Position,                    // Position from which to find callbacks
  531.         DWORD Flags,                        // Callback search flags
  532.         DOUBLE *pCallbackPosition,          // Returns the position of the callback
  533.         LPVOID *ppCallbackData) PURE;       // Returns the callback data pointer
  534.  
  535.     // Playback
  536.     STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE;
  537.     STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE;
  538.  
  539.     // Scale keys
  540.     STDMETHOD(GetCompressedData)(THIS_ LPD3DXBUFFER *ppCompressedData) PURE;
  541.  
  542.     // Callback keys
  543.     STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE;
  544.     STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE;
  545. };
  546.  
  547.  
  548. //----------------------------------------------------------------------------
  549. // D3DXPRIORITY_TYPE:
  550. // ------------------
  551. // This enum defines the type of priority group that a track can be assigned to.
  552. //----------------------------------------------------------------------------
  553. typedef enum _D3DXPRIORITY_TYPE {
  554.     D3DXPRIORITY_LOW         = 0,           // This track should be blended with all low priority tracks before mixed with the high priority result
  555.     D3DXPRIORITY_HIGH        = 1,           // This track should be blended with all high priority tracks before mixed with the low priority result
  556.  
  557.     D3DXPRIORITY_FORCE_DWORD = 0x7fffffff,  /* force 32-bit size enum */
  558. } D3DXPRIORITY_TYPE;
  559.  
  560. //----------------------------------------------------------------------------
  561. // D3DXTRACK_DESC:
  562. // ---------------
  563. // This structure describes the mixing information of an animation track.
  564. // The mixing information consists of the current position, speed, and blending
  565. // weight for the track.  The Flags field also specifies whether the track is
  566. // low or high priority.  Tracks with the same priority are blended together
  567. // and then the two resulting values are blended using the priority blend factor.
  568. // A track also has an animation set (stored separately) associated with it.  
  569. //----------------------------------------------------------------------------
  570. typedef struct _D3DXTRACK_DESC
  571. {
  572.     D3DXPRIORITY_TYPE   Priority;
  573.     FLOAT               Weight;
  574.     FLOAT               Speed;
  575.     DOUBLE              Position;
  576.     BOOL                Enable;
  577. } D3DXTRACK_DESC, *LPD3DXTRACK_DESC;
  578.  
  579. //----------------------------------------------------------------------------
  580. // D3DXEVENT_TYPE:
  581. // ---------------
  582. // This enum defines the type of events keyable via the animation controller.
  583. //----------------------------------------------------------------------------
  584. typedef enum _D3DXEVENT_TYPE
  585. {
  586.     D3DXEVENT_TRACKSPEED    = 0,
  587.     D3DXEVENT_TRACKWEIGHT   = 1,
  588.     D3DXEVENT_TRACKPOSITION = 2,
  589.     D3DXEVENT_TRACKENABLE   = 3,
  590.     D3DXEVENT_PRIORITYBLEND = 4,
  591.  
  592.     D3DXEVENT_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  593. } D3DXEVENT_TYPE;
  594.  
  595. //----------------------------------------------------------------------------
  596. // D3DXTRANSITION_TYPE:
  597. // --------------------
  598. // This enum defines the type of transtion performed on a event that
  599. // transitions from one value to another.
  600. //----------------------------------------------------------------------------
  601. typedef enum _D3DXTRANSITION_TYPE {
  602.     D3DXTRANSITION_LINEAR        = 0x000,     // Linear transition from one value to the next
  603.     D3DXTRANSITION_EASEINEASEOUT = 0x001,     // Ease-In Ease-Out spline transtion from one value to the next
  604.  
  605.     D3DXTRANSITION_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  606. } D3DXTRANSITION_TYPE;
  607.  
  608. //----------------------------------------------------------------------------
  609. // D3DXEVENT_DESC:
  610. // ---------------
  611. // This structure describes a animation controller event.
  612. // It gives the event's type, track (if the event is a track event), global
  613. // start time, duration, transition method, and target value.
  614. //----------------------------------------------------------------------------
  615. typedef struct _D3DXEVENT_DESC
  616. {
  617.     D3DXEVENT_TYPE      Type;
  618.     UINT                Track;
  619.     DOUBLE              StartTime;
  620.     DOUBLE              Duration;
  621.     D3DXTRANSITION_TYPE Transition;
  622.     union
  623.     {
  624.         FLOAT           Weight;
  625.         FLOAT           Speed;
  626.         DOUBLE          Position;
  627.         BOOL            Enable;
  628.     };
  629. } D3DXEVENT_DESC, *LPD3DXEVENT_DESC;
  630.  
  631. //----------------------------------------------------------------------------
  632. // D3DXEVENTHANDLE:
  633. // ----------------
  634. // Handle values used to efficiently reference animation controller events.
  635. //----------------------------------------------------------------------------
  636. typedef DWORD D3DXEVENTHANDLE;
  637. typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE;
  638.  
  639.  
  640. //----------------------------------------------------------------------------
  641. // ID3DXAnimationCallbackHandler:
  642. // ------------------------------
  643. // This interface is intended to be implemented by the application, and can
  644. // be used to handle callbacks in animation sets generated when
  645. // ID3DXAnimationController::AdvanceTime() is called.  
  646. //----------------------------------------------------------------------------
  647. typedef interface ID3DXAnimationCallbackHandler ID3DXAnimationCallbackHandler;
  648. typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER;
  649.  
  650. #undef INTERFACE
  651. #define INTERFACE ID3DXAnimationCallbackHandler
  652.  
  653. DECLARE_INTERFACE(ID3DXAnimationCallbackHandler)
  654. {
  655.     //----------------------------------------------------------------------------
  656.     // ID3DXAnimationCallbackHandler::HandleCallback:
  657.     // ----------------------------------------------
  658.     // This method gets called when a callback occurs for an animation set in one
  659.     // of the tracks during the ID3DXAnimationController::AdvanceTime() call.  
  660.     //
  661.     // Parameters:
  662.     //  Track
  663.     //      Index of the track on which the callback occured.
  664.     //  pCallbackData
  665.     //      Pointer to user owned callback data.
  666.     //
  667.     //----------------------------------------------------------------------------
  668.     STDMETHOD(HandleCallback)(THIS_ UINT Track, LPVOID pCallbackData) PURE;
  669. };
  670.  
  671.  
  672. //----------------------------------------------------------------------------
  673. // ID3DXAnimationController:
  674. // -------------------------
  675. // This interface implements the main animation functionality. It connects
  676. // animation sets with the transform frames that are being animated. Allows
  677. // mixing multiple animations for blended animations or for transistions
  678. // It adds also has methods to modify blending parameters over time to
  679. // enable smooth transistions and other effects.
  680. //----------------------------------------------------------------------------
  681. typedef interface ID3DXAnimationController ID3DXAnimationController;
  682. typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER;
  683.  
  684. #undef INTERFACE
  685. #define INTERFACE ID3DXAnimationController
  686.  
  687. DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown)
  688. {
  689.     // IUnknown
  690.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  691.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  692.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  693.  
  694.     // Max sizes
  695.     STDMETHOD_(UINT, GetMaxNumAnimationOutputs)(THIS) PURE;
  696.     STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE;
  697.     STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE;
  698.     STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE;
  699.  
  700.     // Animation output registration
  701.     STDMETHOD(RegisterAnimationOutput)(THIS_
  702.         LPCSTR pName,
  703.         D3DXMATRIX *pMatrix,
  704.         D3DXVECTOR3 *pScale,
  705.         D3DXQUATERNION *pRotation,
  706.         D3DXVECTOR3 *pTranslation) PURE;
  707.  
  708.     // Animation set registration
  709.     STDMETHOD(RegisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE;
  710.     STDMETHOD(UnregisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE;
  711.  
  712.     STDMETHOD_(UINT, GetNumAnimationSets)(THIS) PURE;
  713.     STDMETHOD(GetAnimationSet)(THIS_ UINT Index, LPD3DXANIMATIONSET *ppAnimationSet) PURE;
  714.     STDMETHOD(GetAnimationSetByName)(THIS_ LPCSTR szName, LPD3DXANIMATIONSET *ppAnimationSet) PURE;
  715.  
  716.     // Global time
  717.     STDMETHOD(AdvanceTime)(THIS_ DOUBLE TimeDelta, LPD3DXANIMATIONCALLBACKHANDLER pCallbackHandler) PURE;
  718.     STDMETHOD(ResetTime)(THIS) PURE;
  719.     STDMETHOD_(DOUBLE, GetTime)(THIS) PURE;
  720.  
  721.     // Tracks
  722.     STDMETHOD(SetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET pAnimSet) PURE;
  723.     STDMETHOD(GetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET *ppAnimSet) PURE;
  724.  
  725.     STDMETHOD(SetTrackPriority)(THIS_ UINT Track, D3DXPRIORITY_TYPE Priority) PURE;
  726.  
  727.     STDMETHOD(SetTrackSpeed)(THIS_ UINT Track, FLOAT Speed) PURE;
  728.     STDMETHOD(SetTrackWeight)(THIS_ UINT Track, FLOAT Weight) PURE;
  729.     STDMETHOD(SetTrackPosition)(THIS_ UINT Track, DOUBLE Position) PURE;
  730.     STDMETHOD(SetTrackEnable)(THIS_ UINT Track, BOOL Enable) PURE;
  731.  
  732.     STDMETHOD(SetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE;
  733.     STDMETHOD(GetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE;
  734.  
  735.     // Priority blending
  736.     STDMETHOD(SetPriorityBlend)(THIS_ FLOAT BlendWeight) PURE;
  737.     STDMETHOD_(FLOAT, GetPriorityBlend)(THIS) PURE;
  738.  
  739.     // Event keying
  740.     STDMETHOD_(D3DXEVENTHANDLE, KeyTrackSpeed)(THIS_ UINT Track, FLOAT NewSpeed, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE;
  741.     STDMETHOD_(D3DXEVENTHANDLE, KeyTrackWeight)(THIS_ UINT Track, FLOAT NewWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE;
  742.     STDMETHOD_(D3DXEVENTHANDLE, KeyTrackPosition)(THIS_ UINT Track, DOUBLE NewPosition, DOUBLE StartTime) PURE;
  743.     STDMETHOD_(D3DXEVENTHANDLE, KeyTrackEnable)(THIS_ UINT Track, BOOL NewEnable, DOUBLE StartTime) PURE;
  744.  
  745.     STDMETHOD_(D3DXEVENTHANDLE, KeyPriorityBlend)(THIS_ FLOAT NewBlendWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE;
  746.  
  747.     // Event unkeying
  748.     STDMETHOD(UnkeyEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE;
  749.  
  750.     STDMETHOD(UnkeyAllTrackEvents)(THIS_ UINT Track) PURE;
  751.     STDMETHOD(UnkeyAllPriorityBlends)(THIS) PURE;
  752.  
  753.     // Event enumeration
  754.     STDMETHOD_(D3DXEVENTHANDLE, GetCurrentTrackEvent)(THIS_ UINT Track, D3DXEVENT_TYPE EventType) PURE;
  755.     STDMETHOD_(D3DXEVENTHANDLE, GetCurrentPriorityBlend)(THIS) PURE;
  756.  
  757.     STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingTrackEvent)(THIS_ UINT Track, D3DXEVENTHANDLE hEvent) PURE;
  758.     STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingPriorityBlend)(THIS_ D3DXEVENTHANDLE hEvent) PURE;
  759.  
  760.     STDMETHOD(ValidateEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE;
  761.  
  762.     STDMETHOD(GetEventDesc)(THIS_ D3DXEVENTHANDLE hEvent, LPD3DXEVENT_DESC pDesc) PURE;
  763.  
  764.     // Cloning
  765.     STDMETHOD(CloneAnimationController)(THIS_
  766.         UINT MaxNumAnimationOutputs,
  767.         UINT MaxNumAnimationSets,
  768.         UINT MaxNumTracks,
  769.         UINT MaxNumEvents,
  770.         LPD3DXANIMATIONCONTROLLER *ppAnimController) PURE;
  771. };
  772.  
  773. #ifdef __cplusplus
  774. extern "C" {
  775. #endif //__cplusplus
  776.  
  777.  
  778. //----------------------------------------------------------------------------
  779. // D3DXLoadMeshHierarchyFromX:
  780. // ---------------------------
  781. // Loads the first frame hierarchy in a .X file.
  782. //
  783. // Parameters:
  784. //  Filename
  785. //      Name of the .X file
  786. //  MeshOptions
  787. //      Mesh creation options for meshes in the file (see d3dx9mesh.h)
  788. //  pD3DDevice
  789. //      D3D9 device on which meshes in the file are created in
  790. //  pAlloc
  791. //      Allocation interface used to allocate nodes of the frame hierarchy
  792. //  pUserDataLoader
  793. //      Application provided interface to allow loading of user data
  794. //  ppFrameHierarchy
  795. //      Returns root node pointer of the loaded frame hierarchy
  796. //  ppAnimController
  797. //      Returns pointer to an animation controller corresponding to animation
  798. //              in the .X file. This is created with default max tracks and events
  799. //
  800. //----------------------------------------------------------------------------
  801. HRESULT WINAPI
  802. D3DXLoadMeshHierarchyFromXA
  803.     (
  804.     LPCSTR Filename,
  805.     DWORD MeshOptions,
  806.     LPDIRECT3DDEVICE9 pD3DDevice,
  807.     LPD3DXALLOCATEHIERARCHY pAlloc,
  808.     LPD3DXLOADUSERDATA pUserDataLoader,
  809.     LPD3DXFRAME *ppFrameHierarchy,
  810.     LPD3DXANIMATIONCONTROLLER *ppAnimController
  811.     );
  812.  
  813. HRESULT WINAPI
  814. D3DXLoadMeshHierarchyFromXW
  815.     (
  816.     LPCWSTR Filename,
  817.     DWORD MeshOptions,
  818.     LPDIRECT3DDEVICE9 pD3DDevice,
  819.     LPD3DXALLOCATEHIERARCHY pAlloc,
  820.     LPD3DXLOADUSERDATA pUserDataLoader,
  821.     LPD3DXFRAME *ppFrameHierarchy,
  822.     LPD3DXANIMATIONCONTROLLER *ppAnimController
  823.     );
  824.  
  825. #ifdef UNICODE
  826. #define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXW
  827. #else
  828. #define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXA
  829. #endif
  830.  
  831. HRESULT WINAPI
  832. D3DXLoadMeshHierarchyFromXInMemory
  833.     (
  834.     LPCVOID Memory,
  835.     DWORD SizeOfMemory,
  836.     DWORD MeshOptions,
  837.     LPDIRECT3DDEVICE9 pD3DDevice,
  838.     LPD3DXALLOCATEHIERARCHY pAlloc,
  839.     LPD3DXLOADUSERDATA pUserDataLoader,
  840.     LPD3DXFRAME *ppFrameHierarchy,
  841.     LPD3DXANIMATIONCONTROLLER *ppAnimController
  842.     );
  843.  
  844. //----------------------------------------------------------------------------
  845. // D3DXSaveMeshHierarchyToFile:
  846. // ----------------------------
  847. // Creates a .X file and saves the mesh hierarchy and corresponding animations
  848. // in it
  849. //
  850. // Parameters:
  851. //  Filename
  852. //      Name of the .X file
  853. //  XFormat
  854. //      Format of the .X file (text or binary, compressed or not, etc)
  855. //  pFrameRoot
  856. //      Root node of the hierarchy to be saved
  857. //  pAnimController
  858. //      The animation controller whose animation sets are to be stored
  859. //  pUserDataSaver
  860. //      Application provided interface to allow adding of user data to
  861. //        data objects saved to .X file
  862. //
  863. //----------------------------------------------------------------------------
  864. HRESULT WINAPI
  865. D3DXSaveMeshHierarchyToFileA
  866.     (
  867.     LPCSTR Filename,
  868.     DWORD XFormat,
  869.     CONST D3DXFRAME *pFrameRoot,
  870.     LPD3DXANIMATIONCONTROLLER pAnimcontroller,
  871.     LPD3DXSAVEUSERDATA pUserDataSaver
  872.     );
  873.  
  874. HRESULT WINAPI
  875. D3DXSaveMeshHierarchyToFileW
  876.     (
  877.     LPCWSTR Filename,
  878.     DWORD XFormat,
  879.     CONST D3DXFRAME *pFrameRoot,
  880.     LPD3DXANIMATIONCONTROLLER pAnimController,
  881.     LPD3DXSAVEUSERDATA pUserDataSaver
  882.     );
  883.  
  884. #ifdef UNICODE
  885. #define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileW
  886. #else
  887. #define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileA
  888. #endif
  889.  
  890. //----------------------------------------------------------------------------
  891. // D3DXFrameDestroy:
  892. // -----------------
  893. // Destroys the subtree of frames under the root, including the root
  894. //
  895. // Parameters:
  896. //      pFrameRoot
  897. //              Pointer to the root node
  898. //  pAlloc
  899. //      Allocation interface used to de-allocate nodes of the frame hierarchy
  900. //
  901. //----------------------------------------------------------------------------
  902. HRESULT WINAPI
  903. D3DXFrameDestroy
  904.     (
  905.     LPD3DXFRAME pFrameRoot,
  906.     LPD3DXALLOCATEHIERARCHY pAlloc
  907.     );
  908.  
  909. //----------------------------------------------------------------------------
  910. // D3DXFrameAppendChild:
  911. // ---------------------
  912. // Add a child frame to a frame
  913. //
  914. // Parameters:
  915. //      pFrameParent
  916. //              Pointer to the parent node
  917. //  pFrameChild
  918. //      Pointer to the child node
  919. //
  920. //----------------------------------------------------------------------------
  921. HRESULT WINAPI
  922. D3DXFrameAppendChild
  923.     (
  924.     LPD3DXFRAME pFrameParent,
  925.     CONST D3DXFRAME *pFrameChild
  926.     );
  927.  
  928. //----------------------------------------------------------------------------
  929. // D3DXFrameFind:
  930. // --------------
  931. // Finds a frame with the given name.  Returns NULL if no frame found.
  932. //
  933. // Parameters:
  934. //      pFrameRoot
  935. //              Pointer to the root node
  936. //  Name
  937. //      Name of frame to find
  938. //
  939. //----------------------------------------------------------------------------
  940. LPD3DXFRAME WINAPI
  941. D3DXFrameFind
  942.     (
  943.     CONST D3DXFRAME *pFrameRoot,
  944.     LPCSTR Name
  945.     );
  946.  
  947. //----------------------------------------------------------------------------
  948. // D3DXFrameRegisterNamedMatrices:
  949. // -------------------------------
  950. // Finds all frames that have non-null names and registers each of those frame
  951. // matrices to the given animation controller
  952. //
  953. // Parameters:
  954. //      pFrameRoot
  955. //              Pointer to the root node
  956. //      pAnimController
  957. //              Pointer to the animation controller where the matrices are registered
  958. //
  959. //----------------------------------------------------------------------------
  960. HRESULT WINAPI
  961. D3DXFrameRegisterNamedMatrices
  962.     (
  963.     LPD3DXFRAME pFrameRoot,
  964.     LPD3DXANIMATIONCONTROLLER pAnimController
  965.     );
  966.  
  967. //----------------------------------------------------------------------------
  968. // D3DXFrameNumNamedMatrices:
  969. // --------------------------
  970. // Counts number of frames in a subtree that have non-null names
  971. //
  972. // Parameters:
  973. //      pFrameRoot
  974. //              Pointer to the root node of the subtree
  975. // Return Value:
  976. //              Count of frames
  977. //
  978. //----------------------------------------------------------------------------
  979. UINT WINAPI
  980. D3DXFrameNumNamedMatrices
  981.     (
  982.     CONST D3DXFRAME *pFrameRoot
  983.     );
  984.  
  985. //----------------------------------------------------------------------------
  986. // D3DXFrameCalculateBoundingSphere:
  987. // ---------------------------------
  988. // Computes the bounding sphere of all the meshes in the frame hierarchy.
  989. //
  990. // Parameters:
  991. //      pFrameRoot
  992. //              Pointer to the root node
  993. //      pObjectCenter
  994. //              Returns the center of the bounding sphere
  995. //      pObjectRadius
  996. //              Returns the radius of the bounding sphere
  997. //
  998. //----------------------------------------------------------------------------
  999. HRESULT WINAPI
  1000. D3DXFrameCalculateBoundingSphere
  1001.     (
  1002.     CONST D3DXFRAME *pFrameRoot,      
  1003.     LPD3DXVECTOR3 pObjectCenter,  
  1004.     FLOAT *pObjectRadius          
  1005.     );
  1006.  
  1007.  
  1008. //----------------------------------------------------------------------------
  1009. // D3DXCreateKeyframedAnimationSet:
  1010. // --------------------------------
  1011. // This function creates a compressable keyframed animations set interface.
  1012. //
  1013. // Parameters:
  1014. //  pName
  1015. //      Name of the animation set
  1016. //  TicksPerSecond
  1017. //      Number of keyframe ticks that elapse per second
  1018. //  Playback
  1019. //      Playback mode of keyframe looping
  1020. //  NumAnimations
  1021. //      Number of SRT animations
  1022. //  NumCallbackKeys
  1023. //      Number of callback keys
  1024. //  pCallbackKeys
  1025. //      Array of callback keys
  1026. //  ppAnimationSet
  1027. //      Returns the animation set interface
  1028. //
  1029. //-----------------------------------------------------------------------------        
  1030. HRESULT WINAPI
  1031. D3DXCreateKeyframedAnimationSet
  1032.     (
  1033.     LPCSTR pName,                              
  1034.     DOUBLE TicksPerSecond,
  1035.     D3DXPLAYBACK_TYPE Playback,
  1036.     UINT NumAnimations,                        
  1037.     UINT NumCallbackKeys,                      
  1038.     CONST D3DXKEY_CALLBACK *pCallbackKeys,          
  1039.     LPD3DXKEYFRAMEDANIMATIONSET *ppAnimationSet
  1040.     );
  1041.  
  1042.  
  1043. //----------------------------------------------------------------------------
  1044. // D3DXCreateCompressedAnimationSet:
  1045. // --------------------------------
  1046. // This function creates a compressed animations set interface from
  1047. // compressed data.
  1048. //
  1049. // Parameters:
  1050. //  pName
  1051. //      Name of the animation set
  1052. //  TicksPerSecond
  1053. //      Number of keyframe ticks that elapse per second
  1054. //  Playback
  1055. //      Playback mode of keyframe looping
  1056. //  pCompressedData
  1057. //      Compressed animation SRT data
  1058. //  NumCallbackKeys
  1059. //      Number of callback keys
  1060. //  pCallbackKeys
  1061. //      Array of callback keys
  1062. //  ppAnimationSet
  1063. //      Returns the animation set interface
  1064. //
  1065. //-----------------------------------------------------------------------------        
  1066. HRESULT WINAPI
  1067. D3DXCreateCompressedAnimationSet
  1068.     (
  1069.     LPCSTR pName,                              
  1070.     DOUBLE TicksPerSecond,
  1071.     D3DXPLAYBACK_TYPE Playback,
  1072.     LPD3DXBUFFER pCompressedData,                        
  1073.     UINT NumCallbackKeys,                      
  1074.     CONST D3DXKEY_CALLBACK *pCallbackKeys,          
  1075.     LPD3DXCOMPRESSEDANIMATIONSET *ppAnimationSet
  1076.     );
  1077.  
  1078.  
  1079. //----------------------------------------------------------------------------
  1080. // D3DXCreateAnimationController:
  1081. // ------------------------------
  1082. // This function creates an animation controller object.
  1083. //
  1084. // Parameters:
  1085. //  MaxNumMatrices
  1086. //      Maximum number of matrices that can be animated
  1087. //  MaxNumAnimationSets
  1088. //      Maximum number of animation sets that can be played
  1089. //  MaxNumTracks
  1090. //      Maximum number of animation sets that can be blended
  1091. //  MaxNumEvents
  1092. //      Maximum number of outstanding events that can be scheduled at any given time
  1093. //  ppAnimController
  1094. //      Returns the animation controller interface
  1095. //
  1096. //-----------------------------------------------------------------------------        
  1097. HRESULT WINAPI
  1098. D3DXCreateAnimationController
  1099.     (
  1100.     UINT MaxNumMatrices,                      
  1101.     UINT MaxNumAnimationSets,                  
  1102.     UINT MaxNumTracks,                        
  1103.     UINT MaxNumEvents,                        
  1104.     LPD3DXANIMATIONCONTROLLER *ppAnimController
  1105.     );
  1106.  
  1107.  
  1108. #ifdef __cplusplus
  1109. }
  1110. #endif //__cplusplus
  1111.  
  1112. #endif //__D3DX9ANIM_H__
  1113.  
  1114.  
  1115.