PageRenderTime 45ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/common/dx9/include/d3dx9mesh.h

https://bitbucket.org/ayufan/ayuine2b
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

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: d3dx9mesh.h
  6. // Content: D3DX mesh types and functions
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. #include "d3dx9.h"
  10. #ifndef __D3DX9MESH_H__
  11. #define __D3DX9MESH_H__
  12. // {7ED943DD-52E8-40b5-A8D8-76685C406330}
  13. DEFINE_GUID(IID_ID3DXBaseMesh,
  14. 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30);
  15. // {4020E5C2-1403-4929-883F-E2E849FAC195}
  16. DEFINE_GUID(IID_ID3DXMesh,
  17. 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95);
  18. // {8875769A-D579-4088-AAEB-534D1AD84E96}
  19. DEFINE_GUID(IID_ID3DXPMesh,
  20. 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96);
  21. // {667EA4C7-F1CD-4386-B523-7C0290B83CC5}
  22. DEFINE_GUID(IID_ID3DXSPMesh,
  23. 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5);
  24. // {11EAA540-F9A6-4d49-AE6A-E19221F70CC4}
  25. DEFINE_GUID(IID_ID3DXSkinInfo,
  26. 0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4);
  27. // {3CE6CC22-DBF2-44f4-894D-F9C34A337139}
  28. DEFINE_GUID(IID_ID3DXPatchMesh,
  29. 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39);
  30. //patch mesh can be quads or tris
  31. typedef enum _D3DXPATCHMESHTYPE {
  32. D3DXPATCHMESH_RECT = 0x001,
  33. D3DXPATCHMESH_TRI = 0x002,
  34. D3DXPATCHMESH_NPATCH = 0x003,
  35. D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
  36. } D3DXPATCHMESHTYPE;
  37. // Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags
  38. enum _D3DXMESH {
  39. D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices.
  40. D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB.
  41. D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB.
  42. D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB.
  43. D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB.
  44. D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER
  45. D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB.
  46. D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB.
  47. D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB.
  48. D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB.
  49. D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER
  50. D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB.
  51. D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB.
  52. D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB.
  53. D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB.
  54. D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer
  55. D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh
  56. // Helper options
  57. D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM
  58. D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED
  59. D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY
  60. D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC
  61. D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING
  62. };
  63. //patch mesh options
  64. enum _D3DXPATCHMESH {
  65. D3DXPATCHMESH_DEFAULT = 000,
  66. };
  67. // option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh
  68. enum _D3DXMESHSIMP
  69. {
  70. D3DXMESHSIMP_VERTEX = 0x1,
  71. D3DXMESHSIMP_FACE = 0x2,
  72. };
  73. typedef enum _D3DXCLEANTYPE {
  74. D3DXCLEAN_BACKFACING = 0x00000001,
  75. D3DXCLEAN_BOWTIES = 0x00000002,
  76. // Helper options
  77. D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning
  78. D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING,
  79. D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES,
  80. } D3DXCLEANTYPE;
  81. enum _MAX_FVF_DECL_SIZE
  82. {
  83. MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END
  84. };
  85. typedef enum _D3DXTANGENT
  86. {
  87. D3DXTANGENT_WRAP_U = 0x01,
  88. D3DXTANGENT_WRAP_V = 0x02,
  89. D3DXTANGENT_WRAP_UV = 0x03,
  90. D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x04,
  91. D3DXTANGENT_DONT_ORTHOGONALIZE = 0x08,
  92. D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x010,
  93. D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x020,
  94. D3DXTANGENT_WEIGHT_BY_AREA = 0x040,
  95. D3DXTANGENT_WEIGHT_EQUAL = 0x080,
  96. D3DXTANGENT_WIND_CW = 0x0100,
  97. D3DXTANGENT_CALCULATE_NORMALS = 0x0200,
  98. D3DXTANGENT_GENERATE_IN_PLACE = 0x0400,
  99. } D3DXTANGENT;
  100. // D3DXIMT_WRAP_U means the texture wraps in the U direction
  101. // D3DXIMT_WRAP_V means the texture wraps in the V direction
  102. // D3DXIMT_WRAP_UV means the texture wraps in both directions
  103. typedef enum _D3DXIMT
  104. {
  105. D3DXIMT_WRAP_U = 0x01,
  106. D3DXIMT_WRAP_V = 0x02,
  107. D3DXIMT_WRAP_UV = 0x03,
  108. } D3DXIMT;
  109. typedef struct ID3DXBaseMesh *LPD3DXBASEMESH;
  110. typedef struct ID3DXMesh *LPD3DXMESH;
  111. typedef struct ID3DXPMesh *LPD3DXPMESH;
  112. typedef struct ID3DXSPMesh *LPD3DXSPMESH;
  113. typedef struct ID3DXSkinInfo *LPD3DXSKININFO;
  114. typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH;
  115. typedef interface ID3DXTextureGutterHelper *LPD3DXTEXTUREGUTTERHELPER;
  116. typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER;
  117. typedef struct _D3DXATTRIBUTERANGE
  118. {
  119. DWORD AttribId;
  120. DWORD FaceStart;
  121. DWORD FaceCount;
  122. DWORD VertexStart;
  123. DWORD VertexCount;
  124. } D3DXATTRIBUTERANGE;
  125. typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
  126. typedef struct _D3DXMATERIAL
  127. {
  128. D3DMATERIAL9 MatD3D;
  129. LPSTR pTextureFilename;
  130. } D3DXMATERIAL;
  131. typedef D3DXMATERIAL *LPD3DXMATERIAL;
  132. typedef enum _D3DXEFFECTDEFAULTTYPE
  133. {
  134. D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string
  135. D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
  136. D3DXEDT_DWORD = 0x3, // pValue points to a DWORD
  137. D3DXEDT_FORCEDWORD = 0x7fffffff
  138. } D3DXEFFECTDEFAULTTYPE;
  139. typedef struct _D3DXEFFECTDEFAULT
  140. {
  141. LPSTR pParamName;
  142. D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue
  143. DWORD NumBytes; // size in bytes of the data pointed to by pValue
  144. LPVOID pValue; // data for the default of the effect
  145. } D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT;
  146. typedef struct _D3DXEFFECTINSTANCE
  147. {
  148. LPSTR pEffectFilename;
  149. DWORD NumDefaults;
  150. LPD3DXEFFECTDEFAULT pDefaults;
  151. } D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE;
  152. typedef struct _D3DXATTRIBUTEWEIGHTS
  153. {
  154. FLOAT Position;
  155. FLOAT Boundary;
  156. FLOAT Normal;
  157. FLOAT Diffuse;
  158. FLOAT Specular;
  159. FLOAT Texcoord[8];
  160. FLOAT Tangent;
  161. FLOAT Binormal;
  162. } D3DXATTRIBUTEWEIGHTS, *LPD3DXATTRIBUTEWEIGHTS;
  163. enum _D3DXWELDEPSILONSFLAGS
  164. {
  165. D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping
  166. D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched
  167. // vertices so that both components identical AND if all components "equal"
  168. // remove one of the vertices
  169. D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal
  170. // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set
  171. // useful to modify vertices to be equal, but not allow vertices to be removed
  172. D3DXWELDEPSILONS_DONOTSPLIT = 0x8, // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT)
  173. // if this flag is not set, all vertices that are in separate attribute groups
  174. // will remain split and not welded. Setting this flag can slow down software vertex processing
  175. };
  176. typedef struct _D3DXWELDEPSILONS
  177. {
  178. FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency
  179. // in general, it should be the same value or greater than the one passed to GeneratedAdjacency
  180. FLOAT BlendWeights;
  181. FLOAT Normal;
  182. FLOAT PSize;
  183. FLOAT Specular;
  184. FLOAT Diffuse;
  185. FLOAT Texcoord[8];
  186. FLOAT Tangent;
  187. FLOAT Binormal;
  188. FLOAT TessFactor;
  189. } D3DXWELDEPSILONS;
  190. typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS;
  191. #undef INTERFACE
  192. #define INTERFACE ID3DXBaseMesh
  193. DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
  194. {
  195. // IUnknown
  196. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  197. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  198. STDMETHOD_(ULONG, Release)(THIS) PURE;
  199. // ID3DXBaseMesh
  200. STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
  201. STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
  202. STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
  203. STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
  204. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  205. STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
  206. STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
  207. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  208. STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
  209. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  210. STDMETHOD(CloneMesh)(THIS_ DWORD Options,
  211. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  212. STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
  213. STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
  214. STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  215. STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
  216. STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  217. STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
  218. STDMETHOD(GetAttributeTable)(
  219. THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
  220. STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
  221. STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
  222. STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
  223. STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  224. };
  225. #undef INTERFACE
  226. #define INTERFACE ID3DXMesh
  227. DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh)
  228. {
  229. // IUnknown
  230. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  231. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  232. STDMETHOD_(ULONG, Release)(THIS) PURE;
  233. // ID3DXBaseMesh
  234. STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
  235. STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
  236. STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
  237. STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
  238. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  239. STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
  240. STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
  241. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  242. STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
  243. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  244. STDMETHOD(CloneMesh)(THIS_ DWORD Options,
  245. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  246. STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
  247. STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
  248. STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  249. STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
  250. STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  251. STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
  252. STDMETHOD(GetAttributeTable)(
  253. THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
  254. STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
  255. STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
  256. STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
  257. STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  258. // ID3DXMesh
  259. STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE;
  260. STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
  261. STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
  262. DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
  263. LPD3DXMESH* ppOptMesh) PURE;
  264. STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
  265. DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE;
  266. STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE;
  267. };
  268. #undef INTERFACE
  269. #define INTERFACE ID3DXPMesh
  270. DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh)
  271. {
  272. // IUnknown
  273. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  274. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  275. STDMETHOD_(ULONG, Release)(THIS) PURE;
  276. // ID3DXBaseMesh
  277. STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
  278. STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
  279. STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
  280. STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
  281. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  282. STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
  283. STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
  284. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  285. STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
  286. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  287. STDMETHOD(CloneMesh)(THIS_ DWORD Options,
  288. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
  289. STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
  290. STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
  291. STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  292. STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
  293. STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
  294. STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
  295. STDMETHOD(GetAttributeTable)(
  296. THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
  297. STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
  298. STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
  299. STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
  300. STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  301. // ID3DXPMesh
  302. STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
  303. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
  304. STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
  305. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
  306. STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE;
  307. STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE;
  308. STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
  309. STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE;
  310. STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
  311. STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE;
  312. STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE;
  313. STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut,
  314. DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
  315. LPD3DXMESH* ppOptMesh) PURE;
  316. STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE;
  317. STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
  318. STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
  319. STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE;
  320. // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs
  321. // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh
  322. STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE;
  323. };
  324. #undef INTERFACE
  325. #define INTERFACE ID3DXSPMesh
  326. DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown)
  327. {
  328. // IUnknown
  329. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  330. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  331. STDMETHOD_(ULONG, Release)(THIS) PURE;
  332. // ID3DXSPMesh
  333. STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
  334. STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
  335. STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
  336. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  337. STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
  338. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  339. STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
  340. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
  341. STDMETHOD(CloneMesh)(THIS_ DWORD Options,
  342. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
  343. STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
  344. DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE;
  345. STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
  346. CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE;
  347. STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE;
  348. STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE;
  349. STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
  350. STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
  351. STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE;
  352. STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE;
  353. };
  354. #define UNUSED16 (0xffff)
  355. #define UNUSED32 (0xffffffff)
  356. // ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags
  357. enum _D3DXMESHOPT {
  358. D3DXMESHOPT_COMPACT = 0x01000000,
  359. D3DXMESHOPT_ATTRSORT = 0x02000000,
  360. D3DXMESHOPT_VERTEXCACHE = 0x04000000,
  361. D3DXMESHOPT_STRIPREORDER = 0x08000000,
  362. D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices
  363. D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting
  364. D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards
  365. // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead
  366. };
  367. // Subset of the mesh that has the same attribute and bone combination.
  368. // This subset can be rendered in a single draw call
  369. typedef struct _D3DXBONECOMBINATION
  370. {
  371. DWORD AttribId;
  372. DWORD FaceStart;
  373. DWORD FaceCount;
  374. DWORD VertexStart;
  375. DWORD VertexCount;
  376. DWORD* BoneId;
  377. } D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION;
  378. // The following types of patch combinations are supported:
  379. // Patch type Basis Degree
  380. // Rect Bezier 2,3,5
  381. // Rect B-Spline 2,3,5
  382. // Rect Catmull-Rom 3
  383. // Tri Bezier 2,3,5
  384. // N-Patch N/A 3
  385. typedef struct _D3DXPATCHINFO
  386. {
  387. D3DXPATCHMESHTYPE PatchType;
  388. D3DDEGREETYPE Degree;
  389. D3DBASISTYPE Basis;
  390. } D3DXPATCHINFO, *LPD3DXPATCHINFO;
  391. #undef INTERFACE
  392. #define INTERFACE ID3DXPatchMesh
  393. DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown)
  394. {
  395. // IUnknown
  396. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  397. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  398. STDMETHOD_(ULONG, Release)(THIS) PURE;
  399. // ID3DXPatchMesh
  400. // Return creation parameters
  401. STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE;
  402. STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
  403. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  404. STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE;
  405. STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
  406. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
  407. STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE;
  408. // Control mesh access
  409. STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
  410. STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
  411. STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
  412. STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
  413. STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
  414. STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
  415. STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE;
  416. STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
  417. // This function returns the size of the tessellated mesh given a tessellation level.
  418. // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must
  419. // be set to TRUE and TessellationLevel should be the max tessellation.
  420. // This will result in the max mesh size necessary for adaptive tessellation.
  421. STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE;
  422. //GenerateAdjacency determines which patches are adjacent with provided tolerance
  423. //this information is used internally to optimize tessellation
  424. STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE;
  425. //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer
  426. //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh
  427. //has adjacency, the new mesh will also have adjacency
  428. STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE;
  429. // Optimizes the patchmesh for efficient tessellation. This function is designed
  430. // to perform one time optimization for patch meshes that need to be tessellated
  431. // repeatedly by calling the Tessellate() method. The optimization performed is
  432. // independent of the actual tessellation level used.
  433. // Currently Flags is unused.
  434. // If vertices are changed, Optimize must be called again
  435. STDMETHOD(Optimize)(THIS_ DWORD flags) PURE;
  436. //gets and sets displacement parameters
  437. //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation
  438. STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture,
  439. D3DTEXTUREFILTERTYPE MinFilter,
  440. D3DTEXTUREFILTERTYPE MagFilter,
  441. D3DTEXTUREFILTERTYPE MipFilter,
  442. D3DTEXTUREADDRESS Wrap,
  443. DWORD dwLODBias) PURE;
  444. STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture,
  445. D3DTEXTUREFILTERTYPE *MinFilter,
  446. D3DTEXTUREFILTERTYPE *MagFilter,
  447. D3DTEXTUREFILTERTYPE *MipFilter,
  448. D3DTEXTUREADDRESS *Wrap,
  449. DWORD *dwLODBias) PURE;
  450. // Performs the uniform tessellation based on the tessellation level.
  451. // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
  452. STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE;
  453. // Performs adaptive tessellation based on the Z based adaptive tessellation criterion.
  454. // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex
  455. // adaptive tessellation amount. Each edge is tessellated to the average of the criterion
  456. // at the 2 vertices it connects.
  457. // MaxTessLevel specifies the upper limit for adaptive tesselation.
  458. // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
  459. STDMETHOD(TessellateAdaptive)(THIS_
  460. CONST D3DXVECTOR4 *pTrans,
  461. DWORD dwMaxTessLevel,
  462. DWORD dwMinTessLevel,
  463. LPD3DXMESH pMesh) PURE;
  464. };
  465. #undef INTERFACE
  466. #define INTERFACE ID3DXSkinInfo
  467. DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown)
  468. {
  469. // IUnknown
  470. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  471. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  472. STDMETHOD_(ULONG, Release)(THIS) PURE;
  473. // Specify the which vertices do each bones influence and by how much
  474. STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE;
  475. STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE;
  476. STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE;
  477. STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE;
  478. STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE;
  479. STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE;
  480. STDMETHOD_(DWORD, GetNumBones)(THIS) PURE;
  481. STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE;
  482. // This gets the max face influences based on a triangle mesh with the specified index buffer
  483. STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE;
  484. // Set min bone influence. Bone influences that are smaller than this are ignored
  485. STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE;
  486. // Get min bone influence.
  487. STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE;
  488. // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
  489. STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer
  490. STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this.
  491. // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
  492. STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer
  493. STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this.
  494. // Clone a skin info object
  495. STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE;
  496. // Update bone influence information to match vertices after they are reordered. This should be called
  497. // if the target vertex buffer has been reordered externally.
  498. STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE;
  499. // These methods enable the modification of the vertex layout of the vertices that will be skinned
  500. STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
  501. STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE;
  502. STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
  503. STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
  504. // Apply SW skinning based on current pose matrices to the target vertices.
  505. STDMETHOD(UpdateSkinnedMesh)(THIS_
  506. CONST D3DXMATRIX* pBoneTransforms,
  507. CONST D3DXMATRIX* pBoneInvTransposeTransforms,
  508. LPCVOID pVerticesSrc,
  509. PVOID pVerticesDst) PURE;
  510. // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
  511. // table that describes which bones affect which subsets of the mesh
  512. STDMETHOD(ConvertToBlendedMesh)(THIS_
  513. LPD3DXMESH pMesh,
  514. DWORD Options,
  515. CONST DWORD *pAdjacencyIn,
  516. LPDWORD pAdjacencyOut,
  517. DWORD* pFaceRemap,
  518. LPD3DXBUFFER *ppVertexRemap,
  519. DWORD* pMaxFaceInfl,
  520. DWORD* pNumBoneCombinations,
  521. LPD3DXBUFFER* ppBoneCombinationTable,
  522. LPD3DXMESH* ppMesh) PURE;
  523. // Takes a mesh and returns a new mesh with per vertex blend weights and indices
  524. // and a bone combination table that describes which bones palettes affect which subsets of the mesh
  525. STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_
  526. LPD3DXMESH pMesh,
  527. DWORD Options,
  528. DWORD paletteSize,
  529. CONST DWORD *pAdjacencyIn,
  530. LPDWORD pAdjacencyOut,
  531. DWORD* pFaceRemap,
  532. LPD3DXBUFFER *ppVertexRemap,
  533. DWORD* pMaxVertexInfl,
  534. DWORD* pNumBoneCombinations,
  535. LPD3DXBUFFER* ppBoneCombinationTable,
  536. LPD3DXMESH* ppMesh) PURE;
  537. };
  538. #ifdef __cplusplus
  539. extern "C" {
  540. #endif //__cplusplus
  541. HRESULT WINAPI
  542. D3DXCreateMesh(
  543. DWORD NumFaces,
  544. DWORD NumVertices,
  545. DWORD Options,
  546. CONST D3DVERTEXELEMENT9 *pDeclaration,
  547. LPDIRECT3DDEVICE9 pD3DDevice,
  548. LPD3DXMESH* ppMesh);
  549. HRESULT WINAPI
  550. D3DXCreateMeshFVF(
  551. DWORD NumFaces,
  552. DWORD NumVertices,
  553. DWORD Options,
  554. DWORD FVF,
  555. LPDIRECT3DDEVICE9 pD3DDevice,
  556. LPD3DXMESH* ppMesh);
  557. HRESULT WINAPI
  558. D3DXCreateSPMesh(
  559. LPD3DXMESH pMesh,
  560. CONST DWORD* pAdjacency,
  561. CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
  562. CONST FLOAT *pVertexWeights,
  563. LPD3DXSPMESH* ppSMesh);
  564. // clean a mesh up for simplification, try to make manifold
  565. HRESULT WINAPI
  566. D3DXCleanMesh(
  567. D3DXCLEANTYPE CleanType,
  568. LPD3DXMESH pMeshIn,
  569. CONST DWORD* pAdjacencyIn,
  570. LPD3DXMESH* ppMeshOut,
  571. DWORD* pAdjacencyOut,
  572. LPD3DXBUFFER* ppErrorsAndWarnings);
  573. HRESULT WINAPI
  574. D3DXValidMesh(
  575. LPD3DXMESH pMeshIn,
  576. CONST DWORD* pAdjacency,
  577. LPD3DXBUFFER* ppErrorsAndWarnings);
  578. HRESULT WINAPI
  579. D3DXGeneratePMesh(
  580. LPD3DXMESH pMesh,
  581. CONST DWORD* pAdjacency,
  582. CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
  583. CONST FLOAT *pVertexWeights,
  584. DWORD MinValue,
  585. DWORD Options,
  586. LPD3DXPMESH* ppPMesh);
  587. HRESULT WINAPI
  588. D3DXSimplifyMesh(
  589. LPD3DXMESH pMesh,
  590. CONST DWORD* pAdjacency,
  591. CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
  592. CONST FLOAT *pVertexWeights,
  593. DWORD MinValue,
  594. DWORD Options,
  595. LPD3DXMESH* ppMesh);
  596. HRESULT WINAPI
  597. D3DXComputeBoundingSphere(
  598. CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
  599. DWORD NumVertices,
  600. DWORD dwStride, // count in bytes to subsequent position vectors
  601. D3DXVECTOR3 *pCenter,
  602. FLOAT *pRadius);
  603. HRESULT WINAPI
  604. D3DXComputeBoundingBox(
  605. CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
  606. DWORD NumVertices,
  607. DWORD dwStride, // count in bytes to subsequent position vectors
  608. D3DXVECTOR3 *pMin,
  609. D3DXVECTOR3 *pMax);
  610. HRESULT WINAPI
  611. D3DXComputeNormals(
  612. LPD3DXBASEMESH pMesh,
  613. CONST DWORD *pAdjacency);
  614. HRESULT WINAPI
  615. D3DXCreateBuffer(
  616. DWORD NumBytes,
  617. LPD3DXBUFFER *ppBuffer);
  618. HRESULT WINAPI
  619. D3DXLoadMeshFromXA(
  620. LPCSTR pFilename,
  621. DWORD Options,
  622. LPDIRECT3DDEVICE9 pD3DDevice,
  623. LPD3DXBUFFER *ppAdjacency,
  624. LPD3DXBUFFER *ppMaterials,
  625. LPD3DXBUFFER *ppEffectInstances,
  626. DWORD *pNumMaterials,
  627. LPD3DXMESH *ppMesh);
  628. HRESULT WINAPI
  629. D3DXLoadMeshFromXW(
  630. LPCWSTR pFilename,
  631. DWORD Options,
  632. LPDIRECT3DDEVICE9 pD3DDevice,
  633. LPD3DXBUFFER *ppAdjacency,
  634. LPD3DXBUFFER *ppMaterials,
  635. LPD3DXBUFFER *ppEffectInstances,
  636. DWORD *pNumMaterials,
  637. LPD3DXMESH *ppMesh);
  638. #ifdef UNICODE
  639. #define D3DXLoadMeshFromX D3DXLoadMeshFromXW
  640. #else
  641. #define D3DXLoadMeshFromX D3DXLoadMeshFromXA
  642. #endif
  643. HRESULT WINAPI
  644. D3DXLoadMeshFromXInMemory(
  645. LPCVOID Memory,
  646. DWORD SizeOfMemory,
  647. DWORD Options,
  648. LPDIRECT3DDEVICE9 pD3DDevice,
  649. LPD3DXBUFFER *ppAdjacency,
  650. LPD3DXBUFFER *ppMaterials,
  651. LPD3DXBUFFER *ppEffectInstances,
  652. DWORD *pNumMaterials,
  653. LPD3DXMESH *ppMesh);
  654. HRESULT WINAPI
  655. D3DXLoadMeshFromXResource(
  656. HMODULE Module,
  657. LPCSTR Name,
  658. LPCSTR Type,
  659. DWORD Options,
  660. LPDIRECT3DDEVICE9 pD3DDevice,
  661. LPD3DXBUFFER *ppAdjacency,
  662. LPD3DXBUFFER *ppMaterials,
  663. LPD3DXBUFFER *ppEffectInstances,
  664. DWORD *pNumMaterials,
  665. LPD3DXMESH *ppMesh);
  666. HRESULT WINAPI
  667. D3DXSaveMeshToXA(
  668. LPCSTR pFilename,
  669. LPD3DXMESH pMesh,
  670. CONST DWORD* pAdjacency,
  671. CONST D3DXMATERIAL* pMaterials,
  672. CONST D3DXEFFECTINSTANCE* pEffectInstances,
  673. DWORD NumMaterials,
  674. DWORD Format
  675. );
  676. HRESULT WINAPI
  677. D3DXSaveMeshToXW(
  678. LPCWSTR pFilename,
  679. LPD3DXMESH pMesh,
  680. CONST DWORD* pAdjacency,
  681. CONST D3DXMATERIAL* pMaterials,
  682. CONST D3DXEFFECTINSTANCE* pEffectInstances,
  683. DWORD NumMaterials,
  684. DWORD Format
  685. );
  686. #ifdef UNICODE
  687. #define D3DXSaveMeshToX D3DXSaveMeshToXW
  688. #else
  689. #define D3DXSaveMeshToX D3DXSaveMeshToXA
  690. #endif
  691. HRESULT WINAPI
  692. D3DXCreatePMeshFromStream(
  693. IStream *pStream,
  694. DWORD Options,
  695. LPDIRECT3DDEVICE9 pD3DDevice,
  696. LPD3DXBUFFER *ppMaterials,
  697. LPD3DXBUFFER *ppEffectInstances,
  698. DWORD* pNumMaterials,
  699. LPD3DXPMESH *ppPMesh);
  700. // 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
  701. // The bone names and initial bone transforms are not filled in the skin info object by this method.
  702. HRESULT WINAPI
  703. D3DXCreateSkinInfo(
  704. DWORD NumVertices,
  705. CONST D3DVERTEXELEMENT9 *pDeclaration,
  706. DWORD NumBones,
  707. LPD3DXSKININFO* ppSkinInfo);
  708. // 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
  709. // The bone names and initial bone transforms are not filled in the skin info object by this method.
  710. HRESULT WINAPI
  711. D3DXCreateSkinInfoFVF(
  712. DWORD NumVertices,
  713. DWORD FVF,
  714. DWORD NumBones,
  715. LPD3DXSKININFO* ppSkinInfo);
  716. #ifdef __cplusplus
  717. }
  718. extern "C" {
  719. #endif //__cplusplus
  720. HRESULT WINAPI
  721. D3DXLoadMeshFromXof(
  722. LPD3DXFILEDATA pxofMesh,
  723. DWORD Options,
  724. LPDIRECT3DDEVICE9 pD3DDevice,
  725. LPD3DXBUFFER *ppAdjacency,
  726. LPD3DXBUFFER *ppMaterials,
  727. LPD3DXBUFFER *ppEffectInstances,
  728. DWORD *pNumMaterials,
  729. LPD3DXMESH *ppMesh);
  730. // This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file
  731. // If skinning info is not present, ppSkinInfo will be NULL
  732. HRESULT WINAPI
  733. D3DXLoadSkinMeshFromXof(
  734. LPD3DXFILEDATA pxofMesh,
  735. DWORD Options,
  736. LPDIRECT3DDEVICE9 pD3DDevice,
  737. LPD3DXBUFFER* ppAdjacency,
  738. LPD3DXBUFFER* ppMaterials,
  739. LPD3DXBUFFER *ppEffectInstances,
  740. DWORD *pMatOut,
  741. LPD3DXSKININFO* ppSkinInfo,
  742. LPD3DXMESH* ppMesh);
  743. // The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from
  744. // the mesh and the bone combination table and populates a skin info object with that data. The bone
  745. // names and initial bone transforms are not filled in the skin info object by this method. This works
  746. // with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to
  747. // determine what type it is.
  748. HRESULT WINAPI
  749. D3DXCreateSkinInfoFromBlendedMesh(
  750. LPD3DXBASEMESH pMesh,
  751. DWORD NumBones,
  752. CONST D3DXBONECOMBINATION *pBoneCombinationTable,
  753. LPD3DXSKININFO* ppSkinInfo);
  754. HRESULT WINAPI
  755. D3DXTessellateNPatches(
  756. LPD3DXMESH pMeshIn,
  757. CONST DWORD* pAdjacencyIn,
  758. FLOAT NumSegs,
  759. BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic
  760. LPD3DXMESH *ppMeshOut,
  761. LPD3DXBUFFER *ppAdjacencyOut);
  762. //generates implied outputdecl from input decl
  763. //the decl generated from this should be used to generate the output decl for
  764. //the tessellator subroutines.
  765. HRESULT WINAPI
  766. D3DXGenerateOutputDecl(
  767. D3DVERTEXELEMENT9 *pOutput,
  768. CONST D3DVERTEXELEMENT9 *pInput);
  769. //loads patches from an XFileData
  770. //since an X file can have up to 6 different patch meshes in it,
  771. //returns them in an array - pNumPatches will contain the number of
  772. //meshes in the actual file.
  773. HRESULT WINAPI
  774. D3DXLoadPatchMeshFromXof(
  775. LPD3DXFILEDATA pXofObjMesh,
  776. DWORD Options,
  777. LPDIRECT3DDEVICE9 pD3DDevice,
  778. LPD3DXBUFFER *ppMaterials,
  779. LPD3DXBUFFER *ppEffectInstances,
  780. PDWORD pNumMaterials,
  781. LPD3DXPATCHMESH *ppMesh);
  782. //computes the size a single rect patch.
  783. HRESULT WINAPI
  784. D3DXRectPatchSize(
  785. CONST FLOAT *pfNumSegs, //segments for each edge (4)
  786. DWORD *pdwTriangles, //output number of triangles
  787. DWORD *pdwVertices); //output number of vertices
  788. //computes the size of a single triangle patch
  789. HRESULT WINAPI
  790. D3DXTriPatchSize(
  791. CONST FLOAT *pfNumSegs, //segments for each edge (3)
  792. DWORD *pdwTriangles, //output number of triangles
  793. DWORD *pdwVertices); //output number of vertices
  794. //tessellates a patch into a created mesh
  795. //similar to D3D RT patch
  796. HRESULT WINAPI
  797. D3DXTessellateRectPatch(
  798. LPDIRECT3DVERTEXBUFFER9 pVB,
  799. CONST FLOAT *pNumSegs,
  800. CONST D3DVERTEXELEMENT9 *pdwInDecl,
  801. CONST D3DRECTPATCH_INFO *pRectPatchInfo,
  802. LPD3DXMESH pMesh);
  803. HRESULT WINAPI
  804. D3DXTessellateTriPatch(
  805. LPDIRECT3DVERTEXBUFFER9 pVB,
  806. CONST FLOAT *pNumSegs,
  807. CONST D3DVERTEXELEMENT9 *pInDecl,
  808. CONST D3DTRIPATCH_INFO *pTriPatchInfo,
  809. LPD3DXMESH pMesh);
  810. //creates an NPatch PatchMesh from a D3DXMESH
  811. HRESULT WINAPI
  812. D3DXCreateNPatchMesh(
  813. LPD3DXMESH pMeshSysMem,
  814. LPD3DXPATCHMESH *pPatchMesh);
  815. //creates a patch mesh
  816. HRESULT WINAPI
  817. D3DXCreatePatchMesh(
  818. CONST D3DXPATCHINFO *pInfo, //patch type
  819. DWORD dwNumPatches, //number of patches
  820. DWORD dwNumVertices, //number of control vertices
  821. DWORD dwOptions, //options
  822. CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices
  823. LPDIRECT3DDEVICE9 pD3DDevice,
  824. LPD3DXPATCHMESH *pPatchMesh);
  825. //returns the number of degenerates in a patch mesh -
  826. //text output put in string.
  827. HRESULT WINAPI
  828. D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh,
  829. DWORD *dwcDegenerateVertices,
  830. DWORD *dwcDegeneratePatches,
  831. LPD3DXBUFFER *ppErrorsAndWarnings);
  832. UINT WINAPI
  833. D3DXGetFVFVertexSize(DWORD FVF);
  834. UINT WINAPI
  835. D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream);
  836. UINT WINAPI
  837. D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl);
  838. HRESULT WINAPI
  839. D3DXDeclaratorFromFVF(
  840. DWORD FVF,
  841. D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]);
  842. HRESULT WINAPI
  843. D3DXFVFFromDeclarator(
  844. CONST D3DVERTEXELEMENT9 *pDeclarator,
  845. DWORD *pFVF);
  846. HRESULT WINAPI
  847. D3DXWeldVertices(
  848. LPD3DXMESH pMesh,
  849. DWORD Flags,
  850. CONST D3DXWELDEPSILONS *pEpsilons,
  851. CONST DWORD *pAdjacencyIn,
  852. DWORD *pAdjacencyOut,
  853. DWORD *pFaceRemap,
  854. LPD3DXBUFFER *ppVertexRemap);
  855. typedef struct _D3DXINTERSECTINFO
  856. {
  857. DWORD FaceIndex; // index of face intersected
  858. FLOAT U; // Barycentric Hit Coordinates
  859. FLOAT V; // Barycentric Hit Coordinates
  860. FLOAT Dist; // Ray-Intersection Parameter Distance
  861. } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO;
  862. HRESULT WINAPI
  863. D3DXIntersect(
  864. LPD3DXBASEMESH pMesh,
  865. CONST D3DXVECTOR3 *pRayPos,
  866. CONST D3DXVECTOR3 *pRayDir,
  867. BOOL *pHit, // True if any faces were intersected
  868. DWORD *pFaceIndex, // index of closest face intersected
  869. FLOAT *pU, // Barycentric Hit Coordinates
  870. FLOAT *pV, // Barycentric Hit Coordinates
  871. FLOAT *pDist, // Ray-Intersection Parameter Distance
  872. LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
  873. DWORD *pCountOfHits); // Number of entries in AllHits array
  874. HRESULT WINAPI
  875. D3DXIntersectSubset(
  876. LPD3DXBASEMESH pMesh,
  877. DWORD AttribId,
  878. CONST D3DXVECTOR3 *pRayPos,
  879. CONST D3DXVECTOR3 *pRayDir,
  880. BOOL *pHit, // True if any faces were intersected
  881. DWORD *pFaceIndex, // index of closest face intersected
  882. FLOAT *pU, // Barycentric Hit Coordinates
  883. FLOAT *pV, // Barycentric Hit Coordinates
  884. FLOAT *pDist, // Ray-Intersection Parameter Distance
  885. LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
  886. DWORD *pCountOfHits); // Number of entries in AllHits array
  887. HRESULT WINAPI D3DXSplitMesh
  888. (
  889. LPD3DXMESH pMeshIn,
  890. CONST DWORD *pAdjacencyIn,
  891. CONST DWORD MaxSize,
  892. CONST DWORD Options,
  893. DWORD *pMeshesOut,
  894. LPD3DXBUFFER *ppMeshArrayOut,
  895. LPD3DXBUFFER *ppAdjacencyArrayOut,
  896. LPD3DXBUFFER *ppFaceRemapArrayOut,
  897. LPD3DXBUFFER *ppVertRemapArrayOut
  898. );
  899. BOOL WINAPI D3DXIntersectTri
  900. (
  901. CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position
  902. CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position
  903. CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position
  904. CONST D3DXVECTOR3 *pRayPos, // Ray origin
  905. CONST D3DXVECTOR3 *pRayDir, // Ray direction
  906. FLOAT *pU, // Barycentric Hit Coordinates
  907. FLOAT *pV, // Barycentric Hit Coordinates
  908. FLOAT *pDist); // Ray-Intersection Parameter Distance
  909. BOOL WINAPI
  910. D3DXSphereBoundProbe(
  911. CONST D3DXVECTOR3 *pCenter,
  912. FLOAT Radius,
  913. CONST D3DXVECTOR3 *pRayPosition,
  914. CONST D3DXVECTOR3 *pRayDirection);
  915. BOOL WINAPI
  916. D3DXBoxBoundProbe(
  917. CONST D3DXVECTOR3 *pMin,
  918. CONST D3DXVECTOR3 *pMax,
  919. CONST D3DXVECTOR3 *pRayPosition,
  920. CONST D3DXVECTOR3 *pRayDirection);
  921. HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh,
  922. DWORD dwOptions);
  923. HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh,
  924. DWORD dwTextureInSemantic,
  925. DWORD dwTextureInIndex,
  926. DWORD dwUPartialOutSemantic,
  927. DWORD dwUPartialOutIndex,
  928. DWORD dwVPartialOutSemantic,
  929. DWORD dwVPartialOutIndex,
  930. DWORD dwNormalOutSemantic,
  931. DWORD dwNormalOutIndex,
  932. DWORD dwOptions,
  933. CONST DWORD *pdwAdjacency,
  934. FLOAT fPartialEdgeThreshold,
  935. FLOAT fSingularPointThreshold,
  936. FLOAT fNormalEdgeThreshold,
  937. ID3DXMesh **ppMeshOut,
  938. ID3DXBuffer **ppVertexMapping);
  939. //D3DXComputeTangent
  940. //
  941. //Computes the Tangent vectors for the TexStage texture coordinates
  942. //and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL
  943. //puts the binorm in BINORM[BinormIndex] also specified in the decl.
  944. //
  945. //If neither the binorm or the tangnet are in the meshes declaration,
  946. //the function will fail.
  947. //
  948. //If a tangent or Binorm field is in the Decl, but the user does not
  949. //wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified
  950. //in the TangentIndex or BinormIndex will cause it to ignore the specified
  951. //semantic.
  952. //
  953. //Wrap should be specified if the texture coordinates wrap.
  954. HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh,
  955. DWORD TexStage,
  956. DWORD TangentIndex,
  957. DWORD BinormIndex,
  958. DWORD Wrap,
  959. CONST DWORD *pAdjacency);
  960. //============================================================================
  961. //
  962. // UVAtlas apis
  963. //
  964. //============================================================================
  965. typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext);
  966. // This function creates atlases for meshes. There are two modes of operation,
  967. // either based on the number of charts, or the maximum allowed stretch. If the
  968. // maximum allowed stretch is 0, then each triangle will likely be in its own
  969. // chart.
  970. //
  971. // The parameters are as follows:
  972. // pMesh - Input mesh to calculate an atlas for. This must have a position
  973. // channel and at least a 2-d texture channel.
  974. // uMaxChartNumber - The maximum number of charts required for the atlas.
  975. // If this is 0, it will be parameterized based solely on
  976. // stretch.
  977. // fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed,
  978. // if 1, then any amount of stretching is allowed.
  979. // uWidth - The width of the texture the atlas will be used on.
  980. // uHeight - The height of the texture the atlas will be used on.
  981. // fGutter - The minimum distance, in texels between two charts on the atlas.
  982. // this gets scaled by the width, so if fGutter is 2.5, and it is
  983. // used on a 512x512 texture, then the minimum distance will be
  984. // 2.5 / 512 in u-v space.
  985. // dwTextureIndex - Specifies which texture coordinate to write to in the
  986. // output mesh (which is cloned from the input mesh). Useful
  987. // if your vertex has multiple texture coordinates.
  988. // pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating
  989. // which triangles are adjacent to each other.
  990. // pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating
  991. // at each face, whether an edge is a false edge or not (using
  992. // the same ordering as the adjacency data structure). If this
  993. // is NULL, then it is assumed that there are no false edges. If
  994. // not NULL, then a non-false edge is indicated by -1 and a false
  995. // edge is indicated by any other value (it is not required, but
  996. // it may be useful for the caller to use the original adjacency
  997. // value). This allows you to parameterize a mesh of quads, and
  998. // the edges down the middle of each quad will not be cut when
  999. // parameterizing the mesh.
  1000. // pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the
  1001. // integrated metric tensor for that face. This lets you control
  1002. // the way this triangle may be stretched in the atlas. The IMT
  1003. // passed in will be 3 floats (a,b,c) and specify a symmetric
  1004. // matrix (a b) that, given a vector (s,t), specifies the
  1005. // (b c)
  1006. // distance betw…

Large files files are truncated, but you can click here to view the full file