📄 d3dx9anim.h
字号:
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx9anim.h
// Content: D3DX mesh types and functions
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3DX9ANIM_H__
#define __D3DX9ANIM_H__
// {ADE2C06D-3747-4b9f-A514-3440B8284980}
DEFINE_GUID(IID_ID3DXInterpolator,
0xade2c06d, 0x3747, 0x4b9f, 0xa5, 0x14, 0x34, 0x40, 0xb8, 0x28, 0x49, 0x80);
// {6CAA71F8-0972-4cdb-A55B-43B968997515}
DEFINE_GUID(IID_ID3DXKeyFrameInterpolator,
0x6caa71f8, 0x972, 0x4cdb, 0xa5, 0x5b, 0x43, 0xb9, 0x68, 0x99, 0x75, 0x15);
// {54B569AC-0AEF-473e-9704-3FEF317F64AB}
DEFINE_GUID(IID_ID3DXAnimationSet,
0x54b569ac, 0xaef, 0x473e, 0x97, 0x4, 0x3f, 0xef, 0x31, 0x7f, 0x64, 0xab);
// {3A714D34-FF61-421e-909F-639F38356708}
DEFINE_GUID(IID_ID3DXAnimationController,
0x3a714d34, 0xff61, 0x421e, 0x90, 0x9f, 0x63, 0x9f, 0x38, 0x35, 0x67, 0x8);
typedef struct ID3DXInterpolator *LPD3DXINTERPOLATOR;
typedef struct ID3DXKeyFrameInterpolator *LPD3DXKEYFRAMEINTERPOLATOR;
typedef struct ID3DXAnimationSet *LPD3DXANIMATIONSET;
typedef struct ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER;
typedef struct ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY;
typedef struct ID3DXLoadUserData *LPD3DXLOADUSERDATA;
typedef struct ID3DXSaveUserData *LPD3DXSAVEUSERDATA;
//----------------------------------------------------------------------------
// 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 */
} D3DXMESHDATATYPE;
//----------------------------------------------------------------------------
// 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 MeshType enum
//----------------------------------------------------------------------------
typedef struct _D3DXMESHDATA
{
D3DXMESHDATATYPE Type;
// current mesh data interface
union
{
LPD3DXMESH pMesh;
LPD3DXPMESH pPMesh;
LPD3DXPATCHMESH pPatchMesh;
};
} D3DXMESHDATA, *LPD3DXMESHDATA;
//----------------------------------------------------------------------------
// 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;
D3DXMESHDATA MeshData;
LPD3DXMATERIAL pMaterials;
LPD3DXEFFECTINSTANCE pEffects;
DWORD NumMaterials;
DWORD *pAdjacency;
LPD3DXSKININFO pSkinInfo;
struct _D3DXMESHCONTAINER *pNextMeshContainer;
} D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER;
//----------------------------------------------------------------------------
// 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;
LPD3DXMESHCONTAINER pMeshContainer;
struct _D3DXFRAME *pFrameSibling;
struct _D3DXFRAME *pFrameFirstChild;
} D3DXFRAME, *LPD3DXFRAME;
#undef INTERFACE
#define INTERFACE 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
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// ID3DXAllocateHierarchy ////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE(ID3DXAllocateHierarchy)
{
// ID3DXAllocateHierarchy
//------------------------------------------------------------------------
// CreateFrame:
// ------------
// Requests allocation of a frame object.
//
// Parameters:
// Name
// Name of the frame to be created
// ppNewFrame
// Returns 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, LPD3DXMESHDATA pMeshData,
LPD3DXMATERIAL pMaterials, LPD3DXEFFECTINSTANCE pEffectInstances, DWORD NumMaterials,
DWORD *pAdjacency, 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;
};
//----------------------------------------------------------------------------
// 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
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// ID3DXLoadUserData ////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE(ID3DXLoadUserData)
{
STDMETHOD(LoadTopLevelData)(LPDIRECTXFILEDATA pXofChildData) PURE;
STDMETHOD(LoadFrameChildData)(LPD3DXFRAME pFrame,
LPDIRECTXFILEDATA pXofChildData) PURE;
STDMETHOD(LoadMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer,
LPDIRECTXFILEDATA pXofChildData) PURE;
};
//----------------------------------------------------------------------------
// 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
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// ID3DXSaveUserData /////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE(ID3DXSaveUserData)
{
STDMETHOD(AddFrameChildData)(LPD3DXFRAME pFrame,
LPDIRECTXFILESAVEOBJECT pXofSave,
LPDIRECTXFILEDATA pXofFrameData) PURE;
STDMETHOD(AddMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer,
LPDIRECTXFILESAVEOBJECT pXofSave,
LPDIRECTXFILEDATA pXofMeshData) PURE;
// NOTE: this is called once per Save. All top level objects should be added using the
// provided interface. One call adds objects before the frame hierarchy, the other after
STDMETHOD(AddTopLevelDataObjectsPre)(LPDIRECTXFILESAVEOBJECT pXofSave) PURE;
STDMETHOD(AddTopLevelDataObjectsPost)(LPDIRECTXFILESAVEOBJECT pXofSave) PURE;
// callbacks for the user to register and then save templates to the XFile
STDMETHOD(RegisterTemplates)(LPDIRECTXFILE pXFileApi) PURE;
STDMETHOD(SaveTemplates)(LPDIRECTXFILESAVEOBJECT pXofSave) PURE;
};
#ifdef __cplusplus
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -