From bcce88e516db523c32b7b53b0e1b1b969248a6b9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 21 Apr 2017 21:00:22 +0200 Subject: [PATCH] (D3D) Cleanup d3dx9anim.h header --- gfx/include/d3d9/d3dx9anim.h | 459 +++++------------------------------ 1 file changed, 57 insertions(+), 402 deletions(-) diff --git a/gfx/include/d3d9/d3dx9anim.h b/gfx/include/d3d9/d3dx9anim.h index 093cbf203d..33d52eb0ee 100644 --- a/gfx/include/d3d9/d3dx9anim.h +++ b/gfx/include/d3d9/d3dx9anim.h @@ -26,89 +26,55 @@ DEFINE_GUID(IID_ID3DXCompressedAnimationSet, DEFINE_GUID(IID_ID3DXAnimationController, 0xac8948ec, 0xf86d, 0x43e2, 0x96, 0xde, 0x31, 0xfc, 0x35, 0xf9, 0x6d, 0x9e); +typedef enum _D3DXMESHDATATYPE +{ + D3DXMESHTYPE_MESH = 0x001, /* Normal ID3DXMesh data */ + D3DXMESHTYPE_PMESH = 0x002, /* Progressive Mesh - ID3DXPMesh */ + D3DXMESHTYPE_PATCHMESH = 0x003, /* Patch Mesh - ID3DXPatchMesh */ -//---------------------------------------------------------------------------- -// D3DXMESHDATATYPE: -// ----------------- -// This enum defines the type of mesh data present in a MeshData structure. -//---------------------------------------------------------------------------- -typedef enum _D3DXMESHDATATYPE { - D3DXMESHTYPE_MESH = 0x001, // Normal ID3DXMesh data - D3DXMESHTYPE_PMESH = 0x002, // Progressive Mesh - ID3DXPMesh - D3DXMESHTYPE_PATCHMESH = 0x003, // Patch Mesh - ID3DXPatchMesh - - D3DXMESHTYPE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXMESHTYPE_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DXMESHDATATYPE; -//---------------------------------------------------------------------------- -// D3DXMESHDATA: -// ------------- -// This struct encapsulates a the mesh data that can be present in a mesh -// container. The supported mesh types are pMesh, pPMesh, pPatchMesh. -// The valid way to access this is determined by the Type enum. -//---------------------------------------------------------------------------- typedef struct _D3DXMESHDATA { - D3DXMESHDATATYPE Type; + D3DXMESHDATATYPE Type; - // current mesh data interface - union - { - LPD3DXMESH pMesh; - LPD3DXPMESH pPMesh; - LPD3DXPATCHMESH pPatchMesh; - }; + /* current mesh data interface */ + union + { + LPD3DXMESH pMesh; + LPD3DXPMESH pPMesh; + LPD3DXPATCHMESH pPatchMesh; + }; } D3DXMESHDATA, *LPD3DXMESHDATA; -//---------------------------------------------------------------------------- -// D3DXMESHCONTAINER: -// ------------------ -// This struct encapsulates a mesh object in a transformation frame -// hierarchy. The app can derive from this structure to add other app specific -// data to this. -//---------------------------------------------------------------------------- typedef struct _D3DXMESHCONTAINER { - LPSTR Name; + LPSTR Name; - D3DXMESHDATA MeshData; + D3DXMESHDATA MeshData; - LPD3DXMATERIAL pMaterials; - LPD3DXEFFECTINSTANCE pEffects; - DWORD NumMaterials; - DWORD *pAdjacency; + LPD3DXMATERIAL pMaterials; + LPD3DXEFFECTINSTANCE pEffects; + DWORD NumMaterials; + DWORD *pAdjacency; - LPD3DXSKININFO pSkinInfo; + LPD3DXSKININFO pSkinInfo; - struct _D3DXMESHCONTAINER *pNextMeshContainer; + struct _D3DXMESHCONTAINER *pNextMeshContainer; } D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER; -//---------------------------------------------------------------------------- -// D3DXFRAME: -// ---------- -// This struct is the encapsulates a transform frame in a transformation frame -// hierarchy. The app can derive from this structure to add other app specific -// data to this -//---------------------------------------------------------------------------- typedef struct _D3DXFRAME { - LPSTR Name; - D3DXMATRIX TransformationMatrix; + LPSTR Name; + D3DXMATRIX TransformationMatrix; - LPD3DXMESHCONTAINER pMeshContainer; + LPD3DXMESHCONTAINER pMeshContainer; - struct _D3DXFRAME *pFrameSibling; - struct _D3DXFRAME *pFrameFirstChild; + struct _D3DXFRAME *pFrameSibling; + struct _D3DXFRAME *pFrameFirstChild; } D3DXFRAME, *LPD3DXFRAME; - -//---------------------------------------------------------------------------- -// ID3DXAllocateHierarchy: -// ----------------------- -// This interface is implemented by the application to allocate/free frame and -// mesh container objects. Methods on this are called during loading and -// destroying frame hierarchies -//---------------------------------------------------------------------------- typedef interface ID3DXAllocateHierarchy ID3DXAllocateHierarchy; typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY; @@ -117,54 +83,9 @@ typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY; DECLARE_INTERFACE(ID3DXAllocateHierarchy) { - // ID3DXAllocateHierarchy - - //------------------------------------------------------------------------ - // CreateFrame: - // ------------ - // Requests allocation of a frame object. - // - // Parameters: - // Name - // Name of the frame to be created - // ppNewFrame - // Returns the created frame object - // - //------------------------------------------------------------------------ STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, LPD3DXFRAME *ppNewFrame) PURE; - //------------------------------------------------------------------------ - // CreateMeshContainer: - // -------------------- - // Requests allocation of a mesh container object. - // - // Parameters: - // Name - // Name of the mesh - // pMesh - // Pointer to the mesh object if basic polygon data found - // pPMesh - // Pointer to the progressive mesh object if progressive mesh data found - // pPatchMesh - // Pointer to the patch mesh object if patch data found - // pMaterials - // Array of materials used in the mesh - // pEffectInstances - // Array of effect instances used in the mesh - // NumMaterials - // Num elements in the pMaterials array - // pAdjacency - // Adjacency array for the mesh - // pSkinInfo - // Pointer to the skininfo object if the mesh is skinned - // pBoneNames - // Array of names, one for each bone in the skinned mesh. - // The numberof bones can be found from the pSkinMesh object - // pBoneOffsetMatrices - // Array of matrices, one for each bone in the skinned mesh. - // - //------------------------------------------------------------------------ STDMETHOD(CreateMeshContainer)(THIS_ LPCSTR Name, CONST D3DXMESHDATA *pMeshData, @@ -175,38 +96,11 @@ DECLARE_INTERFACE(ID3DXAllocateHierarchy) LPD3DXSKININFO pSkinInfo, LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE; - //------------------------------------------------------------------------ - // DestroyFrame: - // ------------- - // Requests de-allocation of a frame object. - // - // Parameters: - // pFrameToFree - // Pointer to the frame to be de-allocated - // - //------------------------------------------------------------------------ STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE; - //------------------------------------------------------------------------ - // DestroyMeshContainer: - // --------------------- - // Requests de-allocation of a mesh container object. - // - // Parameters: - // pMeshContainerToFree - // Pointer to the mesh container object to be de-allocated - // - //------------------------------------------------------------------------ STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE; }; -//---------------------------------------------------------------------------- -// ID3DXLoadUserData: -// ------------------ -// This interface is implemented by the application to load user data in a .X file -// When user data is found, these callbacks will be used to allow the application -// to load the data. -//---------------------------------------------------------------------------- typedef interface ID3DXLoadUserData ID3DXLoadUserData; typedef interface ID3DXLoadUserData *LPD3DXLOADUSERDATA; @@ -224,13 +118,6 @@ DECLARE_INTERFACE(ID3DXLoadUserData) LPD3DXFILEDATA pXofChildData) PURE; }; -//---------------------------------------------------------------------------- -// ID3DXSaveUserData: -// ------------------ -// This interface is implemented by the application to save user data in a .X file -// The callbacks are called for all data saved. The user can then add any -// child data objects to the object provided to the callback. -//---------------------------------------------------------------------------- typedef interface ID3DXSaveUserData ID3DXSaveUserData; typedef interface ID3DXSaveUserData *LPD3DXSAVEUSERDATA; @@ -257,12 +144,6 @@ DECLARE_INTERFACE(ID3DXSaveUserData) STDMETHOD(SaveTemplates)(LPD3DXFILESAVEOBJECT pXofSave) PURE; }; - -//---------------------------------------------------------------------------- -// D3DXCALLBACK_SEARCH_FLAGS: -// -------------------------- -// Flags that can be passed into ID3DXAnimationSet::GetCallback. -//---------------------------------------------------------------------------- typedef enum _D3DXCALLBACK_SEARCH_FLAGS { D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION = 0x01, // exclude callbacks at the initial position from the search @@ -271,11 +152,6 @@ typedef enum _D3DXCALLBACK_SEARCH_FLAGS D3DXCALLBACK_SEARCH_FORCE_DWORD = 0x7fffffff, } D3DXCALLBACK_SEARCH_FLAGS; -//---------------------------------------------------------------------------- -// ID3DXAnimationSet: -// ------------------ -// This interface implements an animation set. -//---------------------------------------------------------------------------- typedef interface ID3DXAnimationSet ID3DXAnimationSet; typedef interface ID3DXAnimationSet *LPD3DXANIMATIONSET; @@ -317,81 +193,40 @@ DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) LPVOID *ppCallbackData) PURE; // Returns the callback data pointer }; - -//---------------------------------------------------------------------------- -// D3DXPLAYBACK_TYPE: -// ------------------ -// This enum defines the type of animation set loop modes. -//---------------------------------------------------------------------------- typedef enum _D3DXPLAYBACK_TYPE { D3DXPLAY_LOOP = 0, D3DXPLAY_ONCE = 1, D3DXPLAY_PINGPONG = 2, - D3DXPLAY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXPLAY_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DXPLAYBACK_TYPE; - -//---------------------------------------------------------------------------- -// D3DXKEY_VECTOR3: -// ---------------- -// This structure describes a vector key for use in keyframe animation. -// It specifies a vector Value at a given Time. This is used for scale and -// translation keys. -//---------------------------------------------------------------------------- typedef struct _D3DXKEY_VECTOR3 { FLOAT Time; D3DXVECTOR3 Value; } D3DXKEY_VECTOR3, *LPD3DXKEY_VECTOR3; - -//---------------------------------------------------------------------------- -// D3DXKEY_QUATERNION: -// ------------------- -// This structure describes a quaternion key for use in keyframe animation. -// It specifies a quaternion Value at a given Time. This is used for rotation -// keys. -//---------------------------------------------------------------------------- typedef struct _D3DXKEY_QUATERNION { FLOAT Time; D3DXQUATERNION Value; } D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION; - -//---------------------------------------------------------------------------- -// D3DXKEY_CALLBACK: -// ----------------- -// This structure describes an callback key for use in keyframe animation. -// It specifies a pointer to user data at a given Time. -//---------------------------------------------------------------------------- typedef struct _D3DXKEY_CALLBACK { FLOAT Time; LPVOID pCallbackData; } D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK; - -//---------------------------------------------------------------------------- -// D3DXCOMPRESSION_FLAGS: -// ---------------------- -// Flags that can be passed into ID3DXKeyframedAnimationSet::Compress. -//---------------------------------------------------------------------------- typedef enum _D3DXCOMPRESSION_FLAGS { D3DXCOMPRESS_DEFAULT = 0x00, - D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff, + D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff } D3DXCOMPRESSION_FLAGS; - -//---------------------------------------------------------------------------- -// ID3DXKeyframedAnimationSet: -// --------------------------- -// This interface implements a compressable keyframed animation set. -//---------------------------------------------------------------------------- typedef interface ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet; typedef interface ID3DXKeyframedAnimationSet *LPD3DXKEYFRAMEDANIMATIONSET; @@ -544,43 +379,23 @@ DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; }; +typedef enum _D3DXPRIORITY_TYPE +{ + D3DXPRIORITY_LOW = 0, // This track should be blended with all low priority tracks before mixed with the high priority result + D3DXPRIORITY_HIGH = 1, // This track should be blended with all high priority tracks before mixed with the low priority result -//---------------------------------------------------------------------------- -// D3DXPRIORITY_TYPE: -// ------------------ -// This enum defines the type of priority group that a track can be assigned to. -//---------------------------------------------------------------------------- -typedef enum _D3DXPRIORITY_TYPE { - D3DXPRIORITY_LOW = 0, // This track should be blended with all low priority tracks before mixed with the high priority result - D3DXPRIORITY_HIGH = 1, // This track should be blended with all high priority tracks before mixed with the low priority result - - D3DXPRIORITY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXPRIORITY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ } D3DXPRIORITY_TYPE; -//---------------------------------------------------------------------------- -// D3DXTRACK_DESC: -// --------------- -// This structure describes the mixing information of an animation track. -// The mixing information consists of the current position, speed, and blending -// weight for the track. The Flags field also specifies whether the track is -// low or high priority. Tracks with the same priority are blended together -// and then the two resulting values are blended using the priority blend factor. -// A track also has an animation set (stored separately) associated with it. -//---------------------------------------------------------------------------- typedef struct _D3DXTRACK_DESC { - D3DXPRIORITY_TYPE Priority; - FLOAT Weight; - FLOAT Speed; - DOUBLE Position; - BOOL Enable; + D3DXPRIORITY_TYPE Priority; + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; } D3DXTRACK_DESC, *LPD3DXTRACK_DESC; -//---------------------------------------------------------------------------- -// D3DXEVENT_TYPE: -// --------------- -// This enum defines the type of events keyable via the animation controller. -//---------------------------------------------------------------------------- typedef enum _D3DXEVENT_TYPE { D3DXEVENT_TRACKSPEED = 0, @@ -589,61 +404,36 @@ typedef enum _D3DXEVENT_TYPE D3DXEVENT_TRACKENABLE = 3, D3DXEVENT_PRIORITYBLEND = 4, - D3DXEVENT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXEVENT_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DXEVENT_TYPE; -//---------------------------------------------------------------------------- -// D3DXTRANSITION_TYPE: -// -------------------- -// This enum defines the type of transtion performed on a event that -// transitions from one value to another. -//---------------------------------------------------------------------------- -typedef enum _D3DXTRANSITION_TYPE { - D3DXTRANSITION_LINEAR = 0x000, // Linear transition from one value to the next - D3DXTRANSITION_EASEINEASEOUT = 0x001, // Ease-In Ease-Out spline transtion from one value to the next +typedef enum _D3DXTRANSITION_TYPE +{ + D3DXTRANSITION_LINEAR = 0x000, /* Linear transition from one value to the next */ + D3DXTRANSITION_EASEINEASEOUT = 0x001, /* Ease-In Ease-Out spline transition from one value to the next */ - D3DXTRANSITION_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXTRANSITION_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DXTRANSITION_TYPE; -//---------------------------------------------------------------------------- -// D3DXEVENT_DESC: -// --------------- -// This structure describes a animation controller event. -// It gives the event's type, track (if the event is a track event), global -// start time, duration, transition method, and target value. -//---------------------------------------------------------------------------- typedef struct _D3DXEVENT_DESC { - D3DXEVENT_TYPE Type; - UINT Track; - DOUBLE StartTime; - DOUBLE Duration; - D3DXTRANSITION_TYPE Transition; - union - { - FLOAT Weight; - FLOAT Speed; - DOUBLE Position; - BOOL Enable; - }; + D3DXEVENT_TYPE Type; + UINT Track; + DOUBLE StartTime; + DOUBLE Duration; + D3DXTRANSITION_TYPE Transition; + union + { + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; + }; } D3DXEVENT_DESC, *LPD3DXEVENT_DESC; -//---------------------------------------------------------------------------- -// D3DXEVENTHANDLE: -// ---------------- -// Handle values used to efficiently reference animation controller events. -//---------------------------------------------------------------------------- typedef DWORD D3DXEVENTHANDLE; typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE; - -//---------------------------------------------------------------------------- -// ID3DXAnimationCallbackHandler: -// ------------------------------ -// This interface is intended to be implemented by the application, and can -// be used to handle callbacks in animation sets generated when -// ID3DXAnimationController::AdvanceTime() is called. -//---------------------------------------------------------------------------- typedef interface ID3DXAnimationCallbackHandler ID3DXAnimationCallbackHandler; typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER; @@ -652,32 +442,9 @@ typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER; DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) { - //---------------------------------------------------------------------------- - // ID3DXAnimationCallbackHandler::HandleCallback: - // ---------------------------------------------- - // This method gets called when a callback occurs for an animation set in one - // of the tracks during the ID3DXAnimationController::AdvanceTime() call. - // - // Parameters: - // Track - // Index of the track on which the callback occured. - // pCallbackData - // Pointer to user owned callback data. - // - //---------------------------------------------------------------------------- STDMETHOD(HandleCallback)(THIS_ UINT Track, LPVOID pCallbackData) PURE; }; - -//---------------------------------------------------------------------------- -// ID3DXAnimationController: -// ------------------------- -// This interface implements the main animation functionality. It connects -// animation sets with the transform frames that are being animated. Allows -// mixing multiple animations for blended animations or for transistions -// It adds also has methods to modify blending parameters over time to -// enable smooth transistions and other effects. -//---------------------------------------------------------------------------- typedef interface ID3DXAnimationController ID3DXAnimationController; typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER; @@ -774,30 +541,6 @@ DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) extern "C" { #endif //__cplusplus - -//---------------------------------------------------------------------------- -// D3DXLoadMeshHierarchyFromX: -// --------------------------- -// Loads the first frame hierarchy in a .X file. -// -// Parameters: -// Filename -// Name of the .X file -// MeshOptions -// Mesh creation options for meshes in the file (see d3dx9mesh.h) -// pD3DDevice -// D3D9 device on which meshes in the file are created in -// pAlloc -// Allocation interface used to allocate nodes of the frame hierarchy -// pUserDataLoader -// Application provided interface to allow loading of user data -// ppFrameHierarchy -// Returns root node pointer of the loaded frame hierarchy -// ppAnimController -// Returns pointer to an animation controller corresponding to animation -// in the .X file. This is created with default max tracks and events -// -//---------------------------------------------------------------------------- HRESULT WINAPI D3DXLoadMeshHierarchyFromXA ( @@ -841,26 +584,6 @@ D3DXLoadMeshHierarchyFromXInMemory LPD3DXANIMATIONCONTROLLER *ppAnimController ); -//---------------------------------------------------------------------------- -// D3DXSaveMeshHierarchyToFile: -// ---------------------------- -// Creates a .X file and saves the mesh hierarchy and corresponding animations -// in it -// -// Parameters: -// Filename -// Name of the .X file -// XFormat -// Format of the .X file (text or binary, compressed or not, etc) -// pFrameRoot -// Root node of the hierarchy to be saved -// pAnimController -// The animation controller whose animation sets are to be stored -// pUserDataSaver -// Application provided interface to allow adding of user data to -// data objects saved to .X file -// -//---------------------------------------------------------------------------- HRESULT WINAPI D3DXSaveMeshHierarchyToFileA ( @@ -887,18 +610,6 @@ D3DXSaveMeshHierarchyToFileW #define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileA #endif -//---------------------------------------------------------------------------- -// D3DXFrameDestroy: -// ----------------- -// Destroys the subtree of frames under the root, including the root -// -// Parameters: -// pFrameRoot -// Pointer to the root node -// pAlloc -// Allocation interface used to de-allocate nodes of the frame hierarchy -// -//---------------------------------------------------------------------------- HRESULT WINAPI D3DXFrameDestroy ( @@ -906,18 +617,6 @@ D3DXFrameDestroy LPD3DXALLOCATEHIERARCHY pAlloc ); -//---------------------------------------------------------------------------- -// D3DXFrameAppendChild: -// --------------------- -// Add a child frame to a frame -// -// Parameters: -// pFrameParent -// Pointer to the parent node -// pFrameChild -// Pointer to the child node -// -//---------------------------------------------------------------------------- HRESULT WINAPI D3DXFrameAppendChild ( @@ -925,18 +624,6 @@ D3DXFrameAppendChild CONST D3DXFRAME *pFrameChild ); -//---------------------------------------------------------------------------- -// D3DXFrameFind: -// -------------- -// Finds a frame with the given name. Returns NULL if no frame found. -// -// Parameters: -// pFrameRoot -// Pointer to the root node -// Name -// Name of frame to find -// -//---------------------------------------------------------------------------- LPD3DXFRAME WINAPI D3DXFrameFind ( @@ -944,19 +631,6 @@ D3DXFrameFind LPCSTR Name ); -//---------------------------------------------------------------------------- -// D3DXFrameRegisterNamedMatrices: -// ------------------------------- -// Finds all frames that have non-null names and registers each of those frame -// matrices to the given animation controller -// -// Parameters: -// pFrameRoot -// Pointer to the root node -// pAnimController -// Pointer to the animation controller where the matrices are registered -// -//---------------------------------------------------------------------------- HRESULT WINAPI D3DXFrameRegisterNamedMatrices ( @@ -1075,25 +749,6 @@ D3DXCreateCompressedAnimationSet LPD3DXCOMPRESSEDANIMATIONSET *ppAnimationSet ); - -//---------------------------------------------------------------------------- -// D3DXCreateAnimationController: -// ------------------------------ -// This function creates an animation controller object. -// -// Parameters: -// MaxNumMatrices -// Maximum number of matrices that can be animated -// MaxNumAnimationSets -// Maximum number of animation sets that can be played -// MaxNumTracks -// Maximum number of animation sets that can be blended -// MaxNumEvents -// Maximum number of outstanding events that can be scheduled at any given time -// ppAnimController -// Returns the animation controller interface -// -//----------------------------------------------------------------------------- HRESULT WINAPI D3DXCreateAnimationController (