/common/dx9/include/d3dx9mesh.h
C Header | 2992 lines | 1512 code | 384 blank | 1096 comment | 0 complexity | d19f0f1548a2233fcc49e6cdd4d008e6 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (C) Microsoft Corporation. All Rights Reserved.
- //
- // File: d3dx9mesh.h
- // Content: D3DX mesh types and functions
- //
- //////////////////////////////////////////////////////////////////////////////
-
- #include "d3dx9.h"
-
- #ifndef __D3DX9MESH_H__
- #define __D3DX9MESH_H__
-
- // {7ED943DD-52E8-40b5-A8D8-76685C406330}
- DEFINE_GUID(IID_ID3DXBaseMesh,
- 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30);
-
- // {4020E5C2-1403-4929-883F-E2E849FAC195}
- DEFINE_GUID(IID_ID3DXMesh,
- 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95);
-
- // {8875769A-D579-4088-AAEB-534D1AD84E96}
- DEFINE_GUID(IID_ID3DXPMesh,
- 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96);
-
- // {667EA4C7-F1CD-4386-B523-7C0290B83CC5}
- DEFINE_GUID(IID_ID3DXSPMesh,
- 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5);
-
- // {11EAA540-F9A6-4d49-AE6A-E19221F70CC4}
- DEFINE_GUID(IID_ID3DXSkinInfo,
- 0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4);
-
- // {3CE6CC22-DBF2-44f4-894D-F9C34A337139}
- DEFINE_GUID(IID_ID3DXPatchMesh,
- 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39);
-
- //patch mesh can be quads or tris
- typedef enum _D3DXPATCHMESHTYPE {
- D3DXPATCHMESH_RECT = 0x001,
- D3DXPATCHMESH_TRI = 0x002,
- D3DXPATCHMESH_NPATCH = 0x003,
-
- D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
- } D3DXPATCHMESHTYPE;
-
- // Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags
- enum _D3DXMESH {
- D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices.
- D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB.
- D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB.
- D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB.
- D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB.
- D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER
- D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB.
- D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB.
- D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB.
- D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB.
- D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER
- D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB.
- D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB.
- D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB.
- D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB.
-
- D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer
-
- D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh
-
- // Helper options
- D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM
- D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED
- D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY
- D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC
- D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING
-
- };
-
- //patch mesh options
- enum _D3DXPATCHMESH {
- D3DXPATCHMESH_DEFAULT = 000,
- };
- // option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh
- enum _D3DXMESHSIMP
- {
- D3DXMESHSIMP_VERTEX = 0x1,
- D3DXMESHSIMP_FACE = 0x2,
-
- };
-
- typedef enum _D3DXCLEANTYPE {
- D3DXCLEAN_BACKFACING = 0x00000001,
- D3DXCLEAN_BOWTIES = 0x00000002,
-
- // Helper options
- D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning
- D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING,
- D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES,
- } D3DXCLEANTYPE;
-
- enum _MAX_FVF_DECL_SIZE
- {
- MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END
- };
-
- typedef enum _D3DXTANGENT
- {
- D3DXTANGENT_WRAP_U = 0x01,
- D3DXTANGENT_WRAP_V = 0x02,
- D3DXTANGENT_WRAP_UV = 0x03,
- D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x04,
- D3DXTANGENT_DONT_ORTHOGONALIZE = 0x08,
- D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x010,
- D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x020,
- D3DXTANGENT_WEIGHT_BY_AREA = 0x040,
- D3DXTANGENT_WEIGHT_EQUAL = 0x080,
- D3DXTANGENT_WIND_CW = 0x0100,
- D3DXTANGENT_CALCULATE_NORMALS = 0x0200,
- D3DXTANGENT_GENERATE_IN_PLACE = 0x0400,
- } D3DXTANGENT;
-
- // D3DXIMT_WRAP_U means the texture wraps in the U direction
- // D3DXIMT_WRAP_V means the texture wraps in the V direction
- // D3DXIMT_WRAP_UV means the texture wraps in both directions
- typedef enum _D3DXIMT
- {
- D3DXIMT_WRAP_U = 0x01,
- D3DXIMT_WRAP_V = 0x02,
- D3DXIMT_WRAP_UV = 0x03,
- } D3DXIMT;
-
-
- typedef struct ID3DXBaseMesh *LPD3DXBASEMESH;
- typedef struct ID3DXMesh *LPD3DXMESH;
- typedef struct ID3DXPMesh *LPD3DXPMESH;
- typedef struct ID3DXSPMesh *LPD3DXSPMESH;
- typedef struct ID3DXSkinInfo *LPD3DXSKININFO;
- typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH;
- typedef interface ID3DXTextureGutterHelper *LPD3DXTEXTUREGUTTERHELPER;
- typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER;
-
-
- typedef struct _D3DXATTRIBUTERANGE
- {
- DWORD AttribId;
- DWORD FaceStart;
- DWORD FaceCount;
- DWORD VertexStart;
- DWORD VertexCount;
- } D3DXATTRIBUTERANGE;
-
- typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
-
- typedef struct _D3DXMATERIAL
- {
- D3DMATERIAL9 MatD3D;
- LPSTR pTextureFilename;
- } D3DXMATERIAL;
- typedef D3DXMATERIAL *LPD3DXMATERIAL;
-
- typedef enum _D3DXEFFECTDEFAULTTYPE
- {
- D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string
- D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
- D3DXEDT_DWORD = 0x3, // pValue points to a DWORD
-
- D3DXEDT_FORCEDWORD = 0x7fffffff
- } D3DXEFFECTDEFAULTTYPE;
-
- typedef struct _D3DXEFFECTDEFAULT
- {
- LPSTR pParamName;
- D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue
- DWORD NumBytes; // size in bytes of the data pointed to by pValue
- LPVOID pValue; // data for the default of the effect
- } D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT;
-
- typedef struct _D3DXEFFECTINSTANCE
- {
- LPSTR pEffectFilename;
- DWORD NumDefaults;
- LPD3DXEFFECTDEFAULT pDefaults;
- } D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE;
-
- typedef struct _D3DXATTRIBUTEWEIGHTS
- {
- FLOAT Position;
- FLOAT Boundary;
- FLOAT Normal;
- FLOAT Diffuse;
- FLOAT Specular;
- FLOAT Texcoord[8];
- FLOAT Tangent;
- FLOAT Binormal;
- } D3DXATTRIBUTEWEIGHTS, *LPD3DXATTRIBUTEWEIGHTS;
-
- enum _D3DXWELDEPSILONSFLAGS
- {
- D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping
-
- D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched
- // vertices so that both components identical AND if all components "equal"
- // remove one of the vertices
- D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal
- // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set
- // useful to modify vertices to be equal, but not allow vertices to be removed
-
- D3DXWELDEPSILONS_DONOTSPLIT = 0x8, // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT)
- // if this flag is not set, all vertices that are in separate attribute groups
- // will remain split and not welded. Setting this flag can slow down software vertex processing
-
- };
-
- typedef struct _D3DXWELDEPSILONS
- {
- FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency
- // in general, it should be the same value or greater than the one passed to GeneratedAdjacency
- FLOAT BlendWeights;
- FLOAT Normal;
- FLOAT PSize;
- FLOAT Specular;
- FLOAT Diffuse;
- FLOAT Texcoord[8];
- FLOAT Tangent;
- FLOAT Binormal;
- FLOAT TessFactor;
- } D3DXWELDEPSILONS;
-
- typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS;
-
-
- #undef INTERFACE
- #define INTERFACE ID3DXBaseMesh
-
- DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // ID3DXBaseMesh
- STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
- STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
- STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
- STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
- STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
- STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(CloneMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
- STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
- STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
- STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
- STDMETHOD(GetAttributeTable)(
- THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
-
- STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
- STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
- STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
-
- STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- };
-
-
- #undef INTERFACE
- #define INTERFACE ID3DXMesh
-
- DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // ID3DXBaseMesh
- STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
- STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
- STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
- STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
- STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
- STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(CloneMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
- STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
- STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
- STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
- STDMETHOD(GetAttributeTable)(
- THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
-
- STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
- STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
- STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
-
- STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
-
- // ID3DXMesh
- STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE;
- STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
- STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
- DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
- LPD3DXMESH* ppOptMesh) PURE;
- STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
- DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE;
- STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE;
- };
-
-
- #undef INTERFACE
- #define INTERFACE ID3DXPMesh
-
- DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // ID3DXBaseMesh
- STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
- STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
- STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
- STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
- STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
- STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(CloneMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
- STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
- STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
- STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
- STDMETHOD(GetAttributeTable)(
- THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
-
- STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
- STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
- STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
-
- STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
-
- // ID3DXPMesh
- STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
- STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
- STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE;
- STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE;
- STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
- STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE;
- STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE;
-
- STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut,
- DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
- LPD3DXMESH* ppOptMesh) PURE;
-
- STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE;
- STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
- STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
-
- STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE;
-
- // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs
- // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh
- STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE;
- };
-
-
- #undef INTERFACE
- #define INTERFACE ID3DXSPMesh
-
- DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // ID3DXSPMesh
- STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
- STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
- STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
- STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(CloneMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
- STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
- DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE;
- STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE;
- STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE;
- STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE;
- STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
- STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
- STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE;
- STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE;
- };
-
- #define UNUSED16 (0xffff)
- #define UNUSED32 (0xffffffff)
-
- // ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags
- enum _D3DXMESHOPT {
- D3DXMESHOPT_COMPACT = 0x01000000,
- D3DXMESHOPT_ATTRSORT = 0x02000000,
- D3DXMESHOPT_VERTEXCACHE = 0x04000000,
- D3DXMESHOPT_STRIPREORDER = 0x08000000,
- D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices
- D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting
- D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards
-
- // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead
-
- };
-
- // Subset of the mesh that has the same attribute and bone combination.
- // This subset can be rendered in a single draw call
- typedef struct _D3DXBONECOMBINATION
- {
- DWORD AttribId;
- DWORD FaceStart;
- DWORD FaceCount;
- DWORD VertexStart;
- DWORD VertexCount;
- DWORD* BoneId;
- } D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION;
-
- // The following types of patch combinations are supported:
- // Patch type Basis Degree
- // Rect Bezier 2,3,5
- // Rect B-Spline 2,3,5
- // Rect Catmull-Rom 3
- // Tri Bezier 2,3,5
- // N-Patch N/A 3
-
- typedef struct _D3DXPATCHINFO
- {
- D3DXPATCHMESHTYPE PatchType;
- D3DDEGREETYPE Degree;
- D3DBASISTYPE Basis;
- } D3DXPATCHINFO, *LPD3DXPATCHINFO;
-
- #undef INTERFACE
- #define INTERFACE ID3DXPatchMesh
-
- DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // ID3DXPatchMesh
-
- // Return creation parameters
- STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE;
- STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
- STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE;
- STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
- STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
- STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE;
-
- // Control mesh access
- STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
- STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
- STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
- STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
- STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
- STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE;
- STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
-
- // This function returns the size of the tessellated mesh given a tessellation level.
- // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must
- // be set to TRUE and TessellationLevel should be the max tessellation.
- // This will result in the max mesh size necessary for adaptive tessellation.
- STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE;
-
- //GenerateAdjacency determines which patches are adjacent with provided tolerance
- //this information is used internally to optimize tessellation
- STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE;
-
- //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer
- //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh
- //has adjacency, the new mesh will also have adjacency
- STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE;
-
- // Optimizes the patchmesh for efficient tessellation. This function is designed
- // to perform one time optimization for patch meshes that need to be tessellated
- // repeatedly by calling the Tessellate() method. The optimization performed is
- // independent of the actual tessellation level used.
- // Currently Flags is unused.
- // If vertices are changed, Optimize must be called again
- STDMETHOD(Optimize)(THIS_ DWORD flags) PURE;
-
- //gets and sets displacement parameters
- //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation
- STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture,
- D3DTEXTUREFILTERTYPE MinFilter,
- D3DTEXTUREFILTERTYPE MagFilter,
- D3DTEXTUREFILTERTYPE MipFilter,
- D3DTEXTUREADDRESS Wrap,
- DWORD dwLODBias) PURE;
-
- STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture,
- D3DTEXTUREFILTERTYPE *MinFilter,
- D3DTEXTUREFILTERTYPE *MagFilter,
- D3DTEXTUREFILTERTYPE *MipFilter,
- D3DTEXTUREADDRESS *Wrap,
- DWORD *dwLODBias) PURE;
-
- // Performs the uniform tessellation based on the tessellation level.
- // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
- STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE;
-
- // Performs adaptive tessellation based on the Z based adaptive tessellation criterion.
- // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex
- // adaptive tessellation amount. Each edge is tessellated to the average of the criterion
- // at the 2 vertices it connects.
- // MaxTessLevel specifies the upper limit for adaptive tesselation.
- // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
- STDMETHOD(TessellateAdaptive)(THIS_
- CONST D3DXVECTOR4 *pTrans,
- DWORD dwMaxTessLevel,
- DWORD dwMinTessLevel,
- LPD3DXMESH pMesh) PURE;
-
- };
-
- #undef INTERFACE
- #define INTERFACE ID3DXSkinInfo
-
- DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown)
- {
- // IUnknown
- STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- // Specify the which vertices do each bones influence and by how much
- STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE;
- STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE;
- STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE;
- STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE;
- STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE;
- STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE;
- STDMETHOD_(DWORD, GetNumBones)(THIS) PURE;
- STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE;
-
- // This gets the max face influences based on a triangle mesh with the specified index buffer
- STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE;
-
- // Set min bone influence. Bone influences that are smaller than this are ignored
- STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE;
- // Get min bone influence.
- STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE;
-
- // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
- STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer
- STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this.
-
- // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
- STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer
- STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this.
-
- // Clone a skin info object
- STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE;
-
- // Update bone influence information to match vertices after they are reordered. This should be called
- // if the target vertex buffer has been reordered externally.
- STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE;
-
- // These methods enable the modification of the vertex layout of the vertices that will be skinned
- STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
- STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE;
- STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
- STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
-
- // Apply SW skinning based on current pose matrices to the target vertices.
- STDMETHOD(UpdateSkinnedMesh)(THIS_
- CONST D3DXMATRIX* pBoneTransforms,
- CONST D3DXMATRIX* pBoneInvTransposeTransforms,
- LPCVOID pVerticesSrc,
- PVOID pVerticesDst) PURE;
-
- // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
- // table that describes which bones affect which subsets of the mesh
- STDMETHOD(ConvertToBlendedMesh)(THIS_
- LPD3DXMESH pMesh,
- DWORD Options,
- CONST DWORD *pAdjacencyIn,
- LPDWORD pAdjacencyOut,
- DWORD* pFaceRemap,
- LPD3DXBUFFER *ppVertexRemap,
- DWORD* pMaxFaceInfl,
- DWORD* pNumBoneCombinations,
- LPD3DXBUFFER* ppBoneCombinationTable,
- LPD3DXMESH* ppMesh) PURE;
-
- // Takes a mesh and returns a new mesh with per vertex blend weights and indices
- // and a bone combination table that describes which bones palettes affect which subsets of the mesh
- STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_
- LPD3DXMESH pMesh,
- DWORD Options,
- DWORD paletteSize,
- CONST DWORD *pAdjacencyIn,
- LPDWORD pAdjacencyOut,
- DWORD* pFaceRemap,
- LPD3DXBUFFER *ppVertexRemap,
- DWORD* pMaxVertexInfl,
- DWORD* pNumBoneCombinations,
- LPD3DXBUFFER* ppBoneCombinationTable,
- LPD3DXMESH* ppMesh) PURE;
- };
-
- #ifdef __cplusplus
- extern "C" {
- #endif //__cplusplus
-
-
- HRESULT WINAPI
- D3DXCreateMesh(
- DWORD NumFaces,
- DWORD NumVertices,
- DWORD Options,
- CONST D3DVERTEXELEMENT9 *pDeclaration,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXMESH* ppMesh);
-
- HRESULT WINAPI
- D3DXCreateMeshFVF(
- DWORD NumFaces,
- DWORD NumVertices,
- DWORD Options,
- DWORD FVF,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXMESH* ppMesh);
-
- HRESULT WINAPI
- D3DXCreateSPMesh(
- LPD3DXMESH pMesh,
- CONST DWORD* pAdjacency,
- CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
- CONST FLOAT *pVertexWeights,
- LPD3DXSPMESH* ppSMesh);
-
- // clean a mesh up for simplification, try to make manifold
- HRESULT WINAPI
- D3DXCleanMesh(
- D3DXCLEANTYPE CleanType,
- LPD3DXMESH pMeshIn,
- CONST DWORD* pAdjacencyIn,
- LPD3DXMESH* ppMeshOut,
- DWORD* pAdjacencyOut,
- LPD3DXBUFFER* ppErrorsAndWarnings);
-
- HRESULT WINAPI
- D3DXValidMesh(
- LPD3DXMESH pMeshIn,
- CONST DWORD* pAdjacency,
- LPD3DXBUFFER* ppErrorsAndWarnings);
-
- HRESULT WINAPI
- D3DXGeneratePMesh(
- LPD3DXMESH pMesh,
- CONST DWORD* pAdjacency,
- CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
- CONST FLOAT *pVertexWeights,
- DWORD MinValue,
- DWORD Options,
- LPD3DXPMESH* ppPMesh);
-
- HRESULT WINAPI
- D3DXSimplifyMesh(
- LPD3DXMESH pMesh,
- CONST DWORD* pAdjacency,
- CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
- CONST FLOAT *pVertexWeights,
- DWORD MinValue,
- DWORD Options,
- LPD3DXMESH* ppMesh);
-
- HRESULT WINAPI
- D3DXComputeBoundingSphere(
- CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
- DWORD NumVertices,
- DWORD dwStride, // count in bytes to subsequent position vectors
- D3DXVECTOR3 *pCenter,
- FLOAT *pRadius);
-
- HRESULT WINAPI
- D3DXComputeBoundingBox(
- CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
- DWORD NumVertices,
- DWORD dwStride, // count in bytes to subsequent position vectors
- D3DXVECTOR3 *pMin,
- D3DXVECTOR3 *pMax);
-
- HRESULT WINAPI
- D3DXComputeNormals(
- LPD3DXBASEMESH pMesh,
- CONST DWORD *pAdjacency);
-
- HRESULT WINAPI
- D3DXCreateBuffer(
- DWORD NumBytes,
- LPD3DXBUFFER *ppBuffer);
-
-
- HRESULT WINAPI
- D3DXLoadMeshFromXA(
- LPCSTR pFilename,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppAdjacency,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pNumMaterials,
- LPD3DXMESH *ppMesh);
-
- HRESULT WINAPI
- D3DXLoadMeshFromXW(
- LPCWSTR pFilename,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppAdjacency,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pNumMaterials,
- LPD3DXMESH *ppMesh);
-
- #ifdef UNICODE
- #define D3DXLoadMeshFromX D3DXLoadMeshFromXW
- #else
- #define D3DXLoadMeshFromX D3DXLoadMeshFromXA
- #endif
-
- HRESULT WINAPI
- D3DXLoadMeshFromXInMemory(
- LPCVOID Memory,
- DWORD SizeOfMemory,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppAdjacency,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pNumMaterials,
- LPD3DXMESH *ppMesh);
-
- HRESULT WINAPI
- D3DXLoadMeshFromXResource(
- HMODULE Module,
- LPCSTR Name,
- LPCSTR Type,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppAdjacency,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pNumMaterials,
- LPD3DXMESH *ppMesh);
-
- HRESULT WINAPI
- D3DXSaveMeshToXA(
- LPCSTR pFilename,
- LPD3DXMESH pMesh,
- CONST DWORD* pAdjacency,
- CONST D3DXMATERIAL* pMaterials,
- CONST D3DXEFFECTINSTANCE* pEffectInstances,
- DWORD NumMaterials,
- DWORD Format
- );
-
- HRESULT WINAPI
- D3DXSaveMeshToXW(
- LPCWSTR pFilename,
- LPD3DXMESH pMesh,
- CONST DWORD* pAdjacency,
- CONST D3DXMATERIAL* pMaterials,
- CONST D3DXEFFECTINSTANCE* pEffectInstances,
- DWORD NumMaterials,
- DWORD Format
- );
-
- #ifdef UNICODE
- #define D3DXSaveMeshToX D3DXSaveMeshToXW
- #else
- #define D3DXSaveMeshToX D3DXSaveMeshToXA
- #endif
-
-
- HRESULT WINAPI
- D3DXCreatePMeshFromStream(
- IStream *pStream,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD* pNumMaterials,
- LPD3DXPMESH *ppPMesh);
-
- // Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices
- // The bone names and initial bone transforms are not filled in the skin info object by this method.
- HRESULT WINAPI
- D3DXCreateSkinInfo(
- DWORD NumVertices,
- CONST D3DVERTEXELEMENT9 *pDeclaration,
- DWORD NumBones,
- LPD3DXSKININFO* ppSkinInfo);
-
- // Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices
- // The bone names and initial bone transforms are not filled in the skin info object by this method.
- HRESULT WINAPI
- D3DXCreateSkinInfoFVF(
- DWORD NumVertices,
- DWORD FVF,
- DWORD NumBones,
- LPD3DXSKININFO* ppSkinInfo);
-
- #ifdef __cplusplus
- }
-
- extern "C" {
- #endif //__cplusplus
-
- HRESULT WINAPI
- D3DXLoadMeshFromXof(
- LPD3DXFILEDATA pxofMesh,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppAdjacency,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pNumMaterials,
- LPD3DXMESH *ppMesh);
-
- // This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file
- // If skinning info is not present, ppSkinInfo will be NULL
- HRESULT WINAPI
- D3DXLoadSkinMeshFromXof(
- LPD3DXFILEDATA pxofMesh,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER* ppAdjacency,
- LPD3DXBUFFER* ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- DWORD *pMatOut,
- LPD3DXSKININFO* ppSkinInfo,
- LPD3DXMESH* ppMesh);
-
-
- // The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from
- // the mesh and the bone combination table and populates a skin info object with that data. The bone
- // names and initial bone transforms are not filled in the skin info object by this method. This works
- // with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to
- // determine what type it is.
- HRESULT WINAPI
- D3DXCreateSkinInfoFromBlendedMesh(
- LPD3DXBASEMESH pMesh,
- DWORD NumBones,
- CONST D3DXBONECOMBINATION *pBoneCombinationTable,
- LPD3DXSKININFO* ppSkinInfo);
-
- HRESULT WINAPI
- D3DXTessellateNPatches(
- LPD3DXMESH pMeshIn,
- CONST DWORD* pAdjacencyIn,
- FLOAT NumSegs,
- BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic
- LPD3DXMESH *ppMeshOut,
- LPD3DXBUFFER *ppAdjacencyOut);
-
-
- //generates implied outputdecl from input decl
- //the decl generated from this should be used to generate the output decl for
- //the tessellator subroutines.
-
- HRESULT WINAPI
- D3DXGenerateOutputDecl(
- D3DVERTEXELEMENT9 *pOutput,
- CONST D3DVERTEXELEMENT9 *pInput);
-
- //loads patches from an XFileData
- //since an X file can have up to 6 different patch meshes in it,
- //returns them in an array - pNumPatches will contain the number of
- //meshes in the actual file.
- HRESULT WINAPI
- D3DXLoadPatchMeshFromXof(
- LPD3DXFILEDATA pXofObjMesh,
- DWORD Options,
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXBUFFER *ppMaterials,
- LPD3DXBUFFER *ppEffectInstances,
- PDWORD pNumMaterials,
- LPD3DXPATCHMESH *ppMesh);
-
- //computes the size a single rect patch.
- HRESULT WINAPI
- D3DXRectPatchSize(
- CONST FLOAT *pfNumSegs, //segments for each edge (4)
- DWORD *pdwTriangles, //output number of triangles
- DWORD *pdwVertices); //output number of vertices
-
- //computes the size of a single triangle patch
- HRESULT WINAPI
- D3DXTriPatchSize(
- CONST FLOAT *pfNumSegs, //segments for each edge (3)
- DWORD *pdwTriangles, //output number of triangles
- DWORD *pdwVertices); //output number of vertices
-
-
- //tessellates a patch into a created mesh
- //similar to D3D RT patch
- HRESULT WINAPI
- D3DXTessellateRectPatch(
- LPDIRECT3DVERTEXBUFFER9 pVB,
- CONST FLOAT *pNumSegs,
- CONST D3DVERTEXELEMENT9 *pdwInDecl,
- CONST D3DRECTPATCH_INFO *pRectPatchInfo,
- LPD3DXMESH pMesh);
-
-
- HRESULT WINAPI
- D3DXTessellateTriPatch(
- LPDIRECT3DVERTEXBUFFER9 pVB,
- CONST FLOAT *pNumSegs,
- CONST D3DVERTEXELEMENT9 *pInDecl,
- CONST D3DTRIPATCH_INFO *pTriPatchInfo,
- LPD3DXMESH pMesh);
-
-
-
- //creates an NPatch PatchMesh from a D3DXMESH
- HRESULT WINAPI
- D3DXCreateNPatchMesh(
- LPD3DXMESH pMeshSysMem,
- LPD3DXPATCHMESH *pPatchMesh);
-
-
- //creates a patch mesh
- HRESULT WINAPI
- D3DXCreatePatchMesh(
- CONST D3DXPATCHINFO *pInfo, //patch type
- DWORD dwNumPatches, //number of patches
- DWORD dwNumVertices, //number of control vertices
- DWORD dwOptions, //options
- CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices
- LPDIRECT3DDEVICE9 pD3DDevice,
- LPD3DXPATCHMESH *pPatchMesh);
-
-
- //returns the number of degenerates in a patch mesh -
- //text output put in string.
- HRESULT WINAPI
- D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh,
- DWORD *dwcDegenerateVertices,
- DWORD *dwcDegeneratePatches,
- LPD3DXBUFFER *ppErrorsAndWarnings);
-
- UINT WINAPI
- D3DXGetFVFVertexSize(DWORD FVF);
-
- UINT WINAPI
- D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream);
-
- UINT WINAPI
- D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl);
-
- HRESULT WINAPI
- D3DXDeclaratorFromFVF(
- DWORD FVF,
- D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]);
-
- HRESULT WINAPI
- D3DXFVFFromDeclarator(
- CONST D3DVERTEXELEMENT9 *pDeclarator,
- DWORD *pFVF);
-
- HRESULT WINAPI
- D3DXWeldVertices(
- LPD3DXMESH pMesh,
- DWORD Flags,
- CONST D3DXWELDEPSILONS *pEpsilons,
- CONST DWORD *pAdjacencyIn,
- DWORD *pAdjacencyOut,
- DWORD *pFaceRemap,
- LPD3DXBUFFER *ppVertexRemap);
-
- typedef struct _D3DXINTERSECTINFO
- {
- DWORD FaceIndex; // index of face intersected
- FLOAT U; // Barycentric Hit Coordinates
- FLOAT V; // Barycentric Hit Coordinates
- FLOAT Dist; // Ray-Intersection Parameter Distance
- } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO;
-
-
- HRESULT WINAPI
- D3DXIntersect(
- LPD3DXBASEMESH pMesh,
- CONST D3DXVECTOR3 *pRayPos,
- CONST D3DXVECTOR3 *pRayDir,
- BOOL *pHit, // True if any faces were intersected
- DWORD *pFaceIndex, // index of closest face intersected
- FLOAT *pU, // Barycentric Hit Coordinates
- FLOAT *pV, // Barycentric Hit Coordinates
- FLOAT *pDist, // Ray-Intersection Parameter Distance
- LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
- DWORD *pCountOfHits); // Number of entries in AllHits array
-
- HRESULT WINAPI
- D3DXIntersectSubset(
- LPD3DXBASEMESH pMesh,
- DWORD AttribId,
- CONST D3DXVECTOR3 *pRayPos,
- CONST D3DXVECTOR3 *pRayDir,
- BOOL *pHit, // True if any faces were intersected
- DWORD *pFaceIndex, // index of closest face intersected
- FLOAT *pU, // Barycentric Hit Coordinates
- FLOAT *pV, // Barycentric Hit Coordinates
- FLOAT *pDist, // Ray-Intersection Parameter Distance
- LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
- DWORD *pCountOfHits); // Number of entries in AllHits array
-
-
- HRESULT WINAPI D3DXSplitMesh
- (
- LPD3DXMESH pMeshIn,
- CONST DWORD *pAdjacencyIn,
- CONST DWORD MaxSize,
- CONST DWORD Options,
- DWORD *pMeshesOut,
- LPD3DXBUFFER *ppMeshArrayOut,
- LPD3DXBUFFER *ppAdjacencyArrayOut,
- LPD3DXBUFFER *ppFaceRemapArrayOut,
- LPD3DXBUFFER *ppVertRemapArrayOut
- );
-
- BOOL WINAPI D3DXIntersectTri
- (
- CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position
- CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position
- CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position
- CONST D3DXVECTOR3 *pRayPos, // Ray origin
- CONST D3DXVECTOR3 *pRayDir, // Ray direction
- FLOAT *pU, // Barycentric Hit Coordinates
- FLOAT *pV, // Barycentric Hit Coordinates
- FLOAT *pDist); // Ray-Intersection Parameter Distance
-
- BOOL WINAPI
- D3DXSphereBoundProbe(
- CONST D3DXVECTOR3 *pCenter,
- FLOAT Radius,
- CONST D3DXVECTOR3 *pRayPosition,
- CONST D3DXVECTOR3 *pRayDirection);
-
- BOOL WINAPI
- D3DXBoxBoundProbe(
- CONST D3DXVECTOR3 *pMin,
- CONST D3DXVECTOR3 *pMax,
- CONST D3DXVECTOR3 *pRayPosition,
- CONST D3DXVECTOR3 *pRayDirection);
-
-
- HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh,
- DWORD dwOptions);
-
- HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh,
- DWORD dwTextureInSemantic,
- DWORD dwTextureInIndex,
- DWORD dwUPartialOutSemantic,
- DWORD dwUPartialOutIndex,
- DWORD dwVPartialOutSemantic,
- DWORD dwVPartialOutIndex,
- DWORD dwNormalOutSemantic,
- DWORD dwNormalOutIndex,
- DWORD dwOptions,
- CONST DWORD *pdwAdjacency,
- FLOAT fPartialEdgeThreshold,
- FLOAT fSingularPointThreshold,
- FLOAT fNormalEdgeThreshold,
- ID3DXMesh **ppMeshOut,
- ID3DXBuffer **ppVertexMapping);
-
-
- //D3DXComputeTangent
- //
- //Computes the Tangent vectors for the TexStage texture coordinates
- //and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL
- //puts the binorm in BINORM[BinormIndex] also specified in the decl.
- //
- //If neither the binorm or the tangnet are in the meshes declaration,
- //the function will fail.
- //
- //If a tangent or Binorm field is in the Decl, but the user does not
- //wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified
- //in the TangentIndex or BinormIndex will cause it to ignore the specified
- //semantic.
- //
- //Wrap should be specified if the texture coordinates wrap.
-
- HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh,
- DWORD TexStage,
- DWORD TangentIndex,
- DWORD BinormIndex,
- DWORD Wrap,
- CONST DWORD *pAdjacency);
-
- //============================================================================
- //
- // UVAtlas apis
- //
- //============================================================================
- typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext);
-
- // This function creates atlases for meshes. There are two modes of operation,
- // either based on the number of charts, or the maximum allowed stretch. If the
- // maximum allowed stretch is 0, then each triangle will likely be in its own
- // chart.
-
- //
- // The parameters are as follows:
- // pMesh - Input mesh to calculate an atlas for. This must have a position
- // channel and at least a 2-d texture channel.
- // uMaxChartNumber - The maximum number of charts required for the atlas.
- // If this is 0, it will be parameterized based solely on
- // stretch.
- // fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed,
- // if 1, then any amount of stretching is allowed.
- // uWidth - The width of the texture the atlas will be used on.
- // uHeight - The height of the texture the atlas will be used on.
- // fGutter - The minimum distance, in texels between two charts on the atlas.
- // this gets scaled by the width, so if fGutter is 2.5, and it is
- // used on a 512x512 texture, then the minimum distance will be
- // 2.5 / 512 in u-v space.
- // dwTextureIndex - Specifies which texture coordinate to write to in the
- // output mesh (which is cloned from the input mesh). Useful
- // if your vertex has multiple texture coordinates.
- // pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating
- // which triangles are adjacent to each other.
- // pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating
- // at each face, whether an edge is a false edge or not (using
- // the same ordering as the adjacency data structure). If this
- // is NULL, then it is assumed that there are no false edges. If
- // not NULL, then a non-false edge is indicated by -1 and a false
- // edge is indicated by any other value (it is not required, but
- // it may be useful for the caller to use the original adjacency
- // value). This allows you to parameterize a mesh of quads, and
- // the edges down the middle of each quad will not be cut when
- // parameterizing the mesh.
- // pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the
- // integrated metric tensor for that face. This lets you control
- // the way this triangle may be stretched in the atlas. The IMT
- // passed in will be 3 floats (a,b,c) and specify a symmetric
- // matrix (a b) that, given a vector (s,t), specifies the
- // (b c)
- // distance betw…
Large files files are truncated, but you can click here to view the full file