RetroArch
d3dx9mesh.h
Go to the documentation of this 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 
10 #include "d3dx9.h"
11 
12 #ifndef __D3DX9MESH_H__
13 #define __D3DX9MESH_H__
14 
15 /* {7ED943DD-52E8-40b5-A8D8-76685C406330} */
16 DEFINE_GUID(IID_ID3DXBaseMesh,
17 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30);
18 
19 /* {4020E5C2-1403-4929-883F-E2E849FAC195} */
20 DEFINE_GUID(IID_ID3DXMesh,
21 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95);
22 
23 /* {8875769A-D579-4088-AAEB-534D1AD84E96} */
24 DEFINE_GUID(IID_ID3DXPMesh,
25 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96);
26 
27 /* {667EA4C7-F1CD-4386-B523-7C0290B83CC5} */
28 DEFINE_GUID(IID_ID3DXSPMesh,
29 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5);
30 
31 /* {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} */
32 DEFINE_GUID(IID_ID3DXSkinInfo,
33 0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4);
34 
35 /* {3CE6CC22-DBF2-44f4-894D-F9C34A337139} */
36 DEFINE_GUID(IID_ID3DXPatchMesh,
37 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39);
38 
39 /* patch mesh can be quads or tris */
40 typedef enum _D3DXPATCHMESHTYPE
41 {
45 
46  D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */
48 
49 /* Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags */
50 enum _D3DXMESH {
51  D3DXMESH_32BIT = 0x001, /* If set, then use 32 bit indices, if not set use 16 bit indices. */
52  D3DXMESH_DONOTCLIP = 0x002, /* Use D3DUSAGE_DONOTCLIP for VB & IB. */
53  D3DXMESH_POINTS = 0x004, /* Use D3DUSAGE_POINTS for VB & IB. */
54  D3DXMESH_RTPATCHES = 0x008, /* Use D3DUSAGE_RTPATCHES for VB & IB. */
55  D3DXMESH_NPATCHES = 0x4000,/* Use D3DUSAGE_NPATCHES for VB & IB. */
56  D3DXMESH_VB_SYSTEMMEM = 0x010, /* Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER */
57  D3DXMESH_VB_MANAGED = 0x020, /* Use D3DPOOL_MANAGED for VB. */
58  D3DXMESH_VB_WRITEONLY = 0x040, /* Use D3DUSAGE_WRITEONLY for VB. */
59  D3DXMESH_VB_DYNAMIC = 0x080, /* Use D3DUSAGE_DYNAMIC for VB. */
60  D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, /* Use D3DUSAGE_SOFTWAREPROCESSING for VB. */
61  D3DXMESH_IB_SYSTEMMEM = 0x100, /* Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER */
62  D3DXMESH_IB_MANAGED = 0x200, /* Use D3DPOOL_MANAGED for IB. */
63  D3DXMESH_IB_WRITEONLY = 0x400, /* Use D3DUSAGE_WRITEONLY for IB. */
64  D3DXMESH_IB_DYNAMIC = 0x800, /* Use D3DUSAGE_DYNAMIC for IB. */
65  D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, /* Use D3DUSAGE_SOFTWAREPROCESSING for IB. */
66 
67  D3DXMESH_VB_SHARE = 0x1000, /* Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer */
68 
69  D3DXMESH_USEHWONLY = 0x2000, /* Valid for ID3DXSkinInfo::ConvertToBlendedMesh */
70 
71  /* Helper options */
72  D3DXMESH_SYSTEMMEM = 0x110, /* D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM */
73  D3DXMESH_MANAGED = 0x220, /* D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED */
74  D3DXMESH_WRITEONLY = 0x440, /* D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY */
75  D3DXMESH_DYNAMIC = 0x880, /* D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC */
76  D3DXMESH_SOFTWAREPROCESSING = 0x18000 /* D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING */
77 };
78 
79 /* patch mesh options */
82 };
83 
84 /* option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh */
86 {
89 };
90 
91 typedef enum _D3DXCLEANTYPE {
92  D3DXCLEAN_BACKFACING = 0x00000001,
93  D3DXCLEAN_BOWTIES = 0x00000002,
94 
95  /* Helper options */
96  D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, /* Bowtie cleaning modifies geometry and breaks skinning */
100 
102 {
103  MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 /* +1 for END */
104 };
105 
106 typedef enum _D3DXTANGENT
107 {
120 } D3DXTANGENT;
121 
122 /* D3DXIMT_WRAP_U means the texture wraps in the U direction
123  * D3DXIMT_WRAP_V means the texture wraps in the V direction
124  * D3DXIMT_WRAP_UV means the texture wraps in both directions
125  */
126 typedef enum _D3DXIMT
127 {
131 } D3DXIMT;
132 
133 /* These options are only valid for UVAtlasCreate and UVAtlasPartition, we may add more for UVAtlasPack if necessary
134  * D3DXUVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality
135  * D3DXUVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts.
136  * D3DXUVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast.
137  */
138 typedef enum _D3DXUVATLAS
139 {
143 } D3DXUVATLAS;
144 
145 typedef struct ID3DXBaseMesh *LPD3DXBASEMESH;
146 typedef struct ID3DXMesh *LPD3DXMESH;
147 typedef struct ID3DXPMesh *LPD3DXPMESH;
148 typedef struct ID3DXSPMesh *LPD3DXSPMESH;
149 typedef struct ID3DXSkinInfo *LPD3DXSKININFO;
150 typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH;
152 typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER;
153 
154 
155 typedef struct _D3DXATTRIBUTERANGE
156 {
157  DWORD AttribId;
158  DWORD FaceStart;
159  DWORD FaceCount;
160  DWORD VertexStart;
161  DWORD VertexCount;
163 
165 
166 typedef struct _D3DXMATERIAL
167 {
170 } D3DXMATERIAL;
172 
174 {
175  D3DXEDT_STRING = 0x1, /* pValue points to a null terminated ASCII string */
176  D3DXEDT_FLOATS = 0x2, /* pValue points to an array of floats - number of floats is NumBytes / sizeof(float) */
177  D3DXEDT_DWORD = 0x3, /* pValue points to a DWORD */
178 
179  D3DXEDT_FORCEDWORD = 0x7fffffff
181 
182 typedef struct _D3DXEFFECTDEFAULT
183 {
184  LPSTR pParamName;
185  D3DXEFFECTDEFAULTTYPE Type; /* type of the data pointed to by pValue */
186  DWORD NumBytes; /* size in bytes of the data pointed to by pValue */
187  LPVOID pValue; /* data for the default of the effect */
189 
190 typedef struct _D3DXEFFECTINSTANCE
191 {
193  DWORD NumDefaults;
196 
197 typedef struct _D3DXATTRIBUTEWEIGHTS
198 {
199  FLOAT Position;
200  FLOAT Boundary;
201  FLOAT Normal;
202  FLOAT Diffuse;
203  FLOAT Specular;
208 
210 {
211  D3DXWELDEPSILONS_WELDALL = 0x1, /* weld all vertices marked by adjacency as being overlapping */
212 
213  D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, /* if a given vertex component is within epsilon, modify partial matched
214  * vertices so that both components identical AND if all components "equal"
215  * remove one of the vertices
216  */
217  D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, /* instructs weld to only allow modifications to vertices and not removal
218  * ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set
219  * useful to modify vertices to be equal, but not allow vertices to be removed
220  */
221 
222  D3DXWELDEPSILONS_DONOTSPLIT = 0x8 /* instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT)
223  * if this flag is not set, all vertices that are in separate attribute groups
224  * will remain split and not welded. Setting this flag can slow down software vertex processing
225  */
226 
227 };
228 
229 typedef struct _D3DXWELDEPSILONS
230 {
231  FLOAT Position; /* NOTE: This does NOT replace the epsilon in GenerateAdjacency
232  * in general, it should be the same value or greater than the one passed to GeneratedAdjacency
233  */
235  FLOAT Normal;
244 
246 
247 
248 #undef INTERFACE
249 #define INTERFACE ID3DXBaseMesh
250 
251 DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
252 {
253  /* IUnknown */
254  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
255  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
256  STDMETHOD_(ULONG, Release)(THIS) PURE;
257 
258  /* ID3DXBaseMesh */
259  STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
260  STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
261  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
262  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
263  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
264  STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
265  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
266  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
267  STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
268  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
269  STDMETHOD(CloneMesh)(THIS_ DWORD Options,
270  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
271  STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
272  STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
273  STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
274  STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
275  STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
276  STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
277  STDMETHOD(GetAttributeTable)(
278  THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
279 
280  STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
281  STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
282  STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
283 
284  STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
285 };
286 
287 
288 #undef INTERFACE
289 #define INTERFACE ID3DXMesh
290 
291 DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh)
292 {
293  /* IUnknown */
294  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
295  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
296  STDMETHOD_(ULONG, Release)(THIS) PURE;
297 
298  /* ID3DXBaseMesh */
299  STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
300  STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
301  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
302  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
303  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
304  STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
305  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
306  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
307  STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
308  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
309  STDMETHOD(CloneMesh)(THIS_ DWORD Options,
310  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
311  STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
312  STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
313  STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
314  STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
315  STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
316  STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
317  STDMETHOD(GetAttributeTable)(
318  THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
319 
320  STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
321  STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
322  STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
323 
324  STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
325 
326  /* ID3DXMesh */
327  STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE;
328  STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
329  STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
330  DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
331  LPD3DXMESH* ppOptMesh) PURE;
332  STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
333  DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE;
334  STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE;
335 };
336 
337 
338 #undef INTERFACE
339 #define INTERFACE ID3DXPMesh
340 
341 DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh)
342 {
343  /* IUnknown */
344  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
345  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
346  STDMETHOD_(ULONG, Release)(THIS) PURE;
347 
348  /* ID3DXBaseMesh */
349  STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
350  STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
351  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
352  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
353  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
354  STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
355  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
356  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
357  STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
358  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
359  STDMETHOD(CloneMesh)(THIS_ DWORD Options,
360  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
361  STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
362  STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
363  STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
364  STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
365  STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
366  STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
367  STDMETHOD(GetAttributeTable)(
368  THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;
369 
370  STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
371  STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
372  STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;
373 
374  STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
375 
376  /* ID3DXPMesh */
377  STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
378  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
379  STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
380  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE;
381  STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE;
382  STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE;
383  STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
384  STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE;
385  STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
386  STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE;
387  STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE;
388 
389  STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut,
390  DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap,
391  LPD3DXMESH* ppOptMesh) PURE;
392 
393  STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE;
394  STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
395  STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE;
396 
397  STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE;
398 
399  /* Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs
400  * Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh */
401  STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE;
402 };
403 
404 
405 #undef INTERFACE
406 #define INTERFACE ID3DXSPMesh
407 
408 DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown)
409 {
410  /* IUnknown */
411  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
412  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
413  STDMETHOD_(ULONG, Release)(THIS) PURE;
414 
415  /* ID3DXSPMesh */
416  STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
417  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
418  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
419  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
420  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
421  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
422  STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
423  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
424  STDMETHOD(CloneMesh)(THIS_ DWORD Options,
425  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE;
426  STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options,
427  DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE;
428  STDMETHOD(ClonePMesh)(THIS_ DWORD Options,
429  CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE;
430  STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE;
431  STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE;
432  STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE;
433  STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE;
434  STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE;
435  STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE;
436 };
437 
438 #define UNUSED16 (0xffff)
439 #define UNUSED32 (0xffffffff)
440 
441 /* ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags */
443 {
444  D3DXMESHOPT_COMPACT = 0x01000000,
445  D3DXMESHOPT_ATTRSORT = 0x02000000,
448  D3DXMESHOPT_IGNOREVERTS = 0x10000000, /* optimize faces only, don't touch vertices */
449  D3DXMESHOPT_DONOTSPLIT = 0x20000000, /* do not split vertices shared between attribute groups when attribute sorting */
450  D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000 /* Only affects VCache. uses a static known good cache size for all cards */
451 
452  /* D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead */
453 
454 };
455 
456 /* Subset of the mesh that has the same attribute and bone combination.
457  * This subset can be rendered in a single draw call */
458 typedef struct _D3DXBONECOMBINATION
459 {
460  DWORD AttribId;
461  DWORD FaceStart;
462  DWORD FaceCount;
463  DWORD VertexStart;
464  DWORD VertexCount;
465  DWORD* BoneId;
467 
468 /* The following types of patch combinations are supported:
469  * Patch type Basis Degree
470  * Rect Bezier 2,3,5
471  * Rect B-Spline 2,3,5
472  * Rect Catmull-Rom 3
473  * Tri Bezier 2,3,5
474  * N-Patch N/A 3
475  */
476 
477 typedef struct _D3DXPATCHINFO
478 {
483 
484 #undef INTERFACE
485 #define INTERFACE ID3DXPatchMesh
486 
487 DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown)
488 {
489  /* IUnknown */
490  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
491  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
492  STDMETHOD_(ULONG, Release)(THIS) PURE;
493 
494  /* ID3DXPatchMesh */
495 
496  /* Return creation parameters */
497  STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE;
498  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
499  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
500  STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE;
501  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
502  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
503  STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE;
504 
505  /* Control mesh access */
506  STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
507  STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
508  STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
509  STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
510  STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE;
511  STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
512  STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE;
513  STDMETHOD(UnlockAttributeBuffer)(THIS) PURE;
514 
515  /* This function returns the size of the tessellated mesh given a tessellation level.
516  * This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must
517  * be set to TRUE and TessellationLevel should be the max tessellation.
518  * This will result in the max mesh size necessary for adaptive tessellation.
519  */
520  STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE;
521 
522  /*GenerateAdjacency determines which patches are adjacent with provided tolerance
523  *this information is used internally to optimize tessellation */
524  STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE;
525 
526  /*CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer
527  *to the new decl. Entries in the new decl which are new are set to 0. If the current mesh
528  *has adjacency, the new mesh will also have adjacency
529  */
530  STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE;
531 
532  /* Optimizes the patchmesh for efficient tessellation. This function is designed
533  * to perform one time optimization for patch meshes that need to be tessellated
534  * repeatedly by calling the Tessellate() method. The optimization performed is
535  * independent of the actual tessellation level used.
536  * Currently Flags is unused.
537  * If vertices are changed, Optimize must be called again
538  */
539  STDMETHOD(Optimize)(THIS_ DWORD flags) PURE;
540 
541  /*gets and sets displacement parameters
542  *displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation
543  */
544  STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture,
545  D3DTEXTUREFILTERTYPE MinFilter,
546  D3DTEXTUREFILTERTYPE MagFilter,
547  D3DTEXTUREFILTERTYPE MipFilter,
548  D3DTEXTUREADDRESS Wrap,
549  DWORD dwLODBias) PURE;
550 
551  STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture,
552  D3DTEXTUREFILTERTYPE *MinFilter,
553  D3DTEXTUREFILTERTYPE *MagFilter,
554  D3DTEXTUREFILTERTYPE *MipFilter,
555  D3DTEXTUREADDRESS *Wrap,
556  DWORD *dwLODBias) PURE;
557 
558  /* Performs the uniform tessellation based on the tessellation level.
559  * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
560  */
561  STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE;
562 
563  /* Performs adaptive tessellation based on the Z based adaptive tessellation criterion.
564  * pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex
565  * adaptive tessellation amount. Each edge is tessellated to the average of the criterion
566  * at the 2 vertices it connects.
567  * MaxTessLevel specifies the upper limit for adaptive tesselation.
568  * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
569  */
570  STDMETHOD(TessellateAdaptive)(THIS_
571  CONST D3DXVECTOR4 *pTrans,
572  DWORD dwMaxTessLevel,
573  DWORD dwMinTessLevel,
574  LPD3DXMESH pMesh) PURE;
575 
576 };
577 
578 #undef INTERFACE
579 #define INTERFACE ID3DXSkinInfo
580 
581 DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown)
582 {
583  /* IUnknown */
584  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
585  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
586  STDMETHOD_(ULONG, Release)(THIS) PURE;
587 
588  /* Specify the which vertices do each bones influence and by how much */
589  STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE;
590  STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE;
591  STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE;
592  STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE;
593  STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE;
594  STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE;
595  STDMETHOD_(DWORD, GetNumBones)(THIS) PURE;
596  STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE;
597 
598  /* This gets the max face influences based on a triangle mesh with the specified index buffer */
599  STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE;
600 
601  /* Set min bone influence. Bone influences that are smaller than this are ignored */
602  STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE;
603  /* Get min bone influence. */
604  STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE;
605 
606  /* Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */
607  STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; /* pName is copied to an internal string buffer */
608  STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; /* A pointer to an internal string buffer is returned. Do not free this. */
609 
610  /* Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */
611  STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; /* pBoneTransform is copied to an internal buffer */
612  STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; /* A pointer to an internal matrix is returned. Do not free this. */
613 
614  /* Clone a skin info object */
615  STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE;
616 
617  /* Update bone influence information to match vertices after they are reordered. This should be called
618  * if the target vertex buffer has been reordered externally. */
619  STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE;
620 
621  /* These methods enable the modification of the vertex layout of the vertices that will be skinned */
622  STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
623  STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE;
624  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
625  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
626 
627  /* Apply SW skinning based on current pose matrices to the target vertices. */
628  STDMETHOD(UpdateSkinnedMesh)(THIS_
629  CONST D3DXMATRIX* pBoneTransforms,
630  CONST D3DXMATRIX* pBoneInvTransposeTransforms,
631  LPCVOID pVerticesSrc,
632  PVOID pVerticesDst) PURE;
633 
634  /* Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
635  * table that describes which bones affect which subsets of the mesh */
636  STDMETHOD(ConvertToBlendedMesh)(THIS_
637  LPD3DXMESH pMesh,
638  DWORD Options,
639  CONST DWORD *pAdjacencyIn,
640  LPDWORD pAdjacencyOut,
641  DWORD* pFaceRemap,
642  LPD3DXBUFFER *ppVertexRemap,
643  DWORD* pMaxFaceInfl,
644  DWORD* pNumBoneCombinations,
645  LPD3DXBUFFER* ppBoneCombinationTable,
646  LPD3DXMESH* ppMesh) PURE;
647 
648  /* Takes a mesh and returns a new mesh with per vertex blend weights and indices
649  * and a bone combination table that describes which bones palettes affect which subsets of the mesh */
650  STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_
651  LPD3DXMESH pMesh,
652  DWORD Options,
653  DWORD paletteSize,
654  CONST DWORD *pAdjacencyIn,
655  LPDWORD pAdjacencyOut,
656  DWORD* pFaceRemap,
657  LPD3DXBUFFER *ppVertexRemap,
658  DWORD* pMaxVertexInfl,
659  DWORD* pNumBoneCombinations,
660  LPD3DXBUFFER* ppBoneCombinationTable,
661  LPD3DXMESH* ppMesh) PURE;
662 };
663 
664 #ifdef __cplusplus
665 extern "C" {
666 #endif /* __cplusplus */
667 
668 HRESULT WINAPI
670  DWORD NumFaces,
671  DWORD NumVertices,
672  DWORD Options,
673  CONST D3DVERTEXELEMENT9 *pDeclaration,
674  LPDIRECT3DDEVICE9 pD3DDevice,
675  LPD3DXMESH* ppMesh);
676 
677 HRESULT WINAPI
679  DWORD NumFaces,
680  DWORD NumVertices,
681  DWORD Options,
682  DWORD FVF,
683  LPDIRECT3DDEVICE9 pD3DDevice,
684  LPD3DXMESH* ppMesh);
685 
686 HRESULT WINAPI
688  LPD3DXMESH pMesh,
689  CONST DWORD* pAdjacency,
690  CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
691  CONST FLOAT *pVertexWeights,
692  LPD3DXSPMESH* ppSMesh);
693 
694 /* clean a mesh up for simplification, try to make manifold */
695 HRESULT WINAPI
697  D3DXCLEANTYPE CleanType,
698  LPD3DXMESH pMeshIn,
699  CONST DWORD* pAdjacencyIn,
700  LPD3DXMESH* ppMeshOut,
701  DWORD* pAdjacencyOut,
702  LPD3DXBUFFER* ppErrorsAndWarnings);
703 
704 HRESULT WINAPI
706  LPD3DXMESH pMeshIn,
707  CONST DWORD* pAdjacency,
708  LPD3DXBUFFER* ppErrorsAndWarnings);
709 
710 HRESULT WINAPI
712  LPD3DXMESH pMesh,
713  CONST DWORD* pAdjacency,
714  CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
715  CONST FLOAT *pVertexWeights,
716  DWORD MinValue,
717  DWORD Options,
718  LPD3DXPMESH* ppPMesh);
719 
720 HRESULT WINAPI
722  LPD3DXMESH pMesh,
723  CONST DWORD* pAdjacency,
724  CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
725  CONST FLOAT *pVertexWeights,
726  DWORD MinValue,
727  DWORD Options,
728  LPD3DXMESH* ppMesh);
729 
730 HRESULT WINAPI
732  CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */
733  DWORD NumVertices,
734  DWORD dwStride, /* count in bytes to subsequent position vectors */
735  D3DXVECTOR3 *pCenter,
736  FLOAT *pRadius);
737 
738 HRESULT WINAPI
740  CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */
741  DWORD NumVertices,
742  DWORD dwStride, /* count in bytes to subsequent position vectors */
743  D3DXVECTOR3 *pMin,
744  D3DXVECTOR3 *pMax);
745 
746 HRESULT WINAPI
748  LPD3DXBASEMESH pMesh,
749  CONST DWORD *pAdjacency);
750 
751 HRESULT WINAPI
753  DWORD NumBytes,
754  LPD3DXBUFFER *ppBuffer);
755 
756 
757 HRESULT WINAPI
759  LPCSTR pFilename,
760  DWORD Options,
761  LPDIRECT3DDEVICE9 pD3DDevice,
762  LPD3DXBUFFER *ppAdjacency,
763  LPD3DXBUFFER *ppMaterials,
764  LPD3DXBUFFER *ppEffectInstances,
765  DWORD *pNumMaterials,
766  LPD3DXMESH *ppMesh);
767 
768 HRESULT WINAPI
770  LPCWSTR pFilename,
771  DWORD Options,
772  LPDIRECT3DDEVICE9 pD3DDevice,
773  LPD3DXBUFFER *ppAdjacency,
774  LPD3DXBUFFER *ppMaterials,
775  LPD3DXBUFFER *ppEffectInstances,
776  DWORD *pNumMaterials,
777  LPD3DXMESH *ppMesh);
778 
779 #ifdef UNICODE
780 #define D3DXLoadMeshFromX D3DXLoadMeshFromXW
781 #else
782 #define D3DXLoadMeshFromX D3DXLoadMeshFromXA
783 #endif
784 
785 HRESULT WINAPI
787  LPCVOID Memory,
788  DWORD SizeOfMemory,
789  DWORD Options,
790  LPDIRECT3DDEVICE9 pD3DDevice,
791  LPD3DXBUFFER *ppAdjacency,
792  LPD3DXBUFFER *ppMaterials,
793  LPD3DXBUFFER *ppEffectInstances,
794  DWORD *pNumMaterials,
795  LPD3DXMESH *ppMesh);
796 
797 HRESULT WINAPI
799  HMODULE Module,
800  LPCSTR Name,
801  LPCSTR Type,
802  DWORD Options,
803  LPDIRECT3DDEVICE9 pD3DDevice,
804  LPD3DXBUFFER *ppAdjacency,
805  LPD3DXBUFFER *ppMaterials,
806  LPD3DXBUFFER *ppEffectInstances,
807  DWORD *pNumMaterials,
808  LPD3DXMESH *ppMesh);
809 
810 HRESULT WINAPI
812  LPCSTR pFilename,
813  LPD3DXMESH pMesh,
814  CONST DWORD* pAdjacency,
815  CONST D3DXMATERIAL* pMaterials,
816  CONST D3DXEFFECTINSTANCE* pEffectInstances,
817  DWORD NumMaterials,
818  DWORD Format
819  );
820 
821 HRESULT WINAPI
823  LPCWSTR pFilename,
824  LPD3DXMESH pMesh,
825  CONST DWORD* pAdjacency,
826  CONST D3DXMATERIAL* pMaterials,
827  CONST D3DXEFFECTINSTANCE* pEffectInstances,
828  DWORD NumMaterials,
829  DWORD Format
830  );
831 
832 #ifdef UNICODE
833 #define D3DXSaveMeshToX D3DXSaveMeshToXW
834 #else
835 #define D3DXSaveMeshToX D3DXSaveMeshToXA
836 #endif
837 
838 
839 HRESULT WINAPI
841  IStream *pStream,
842  DWORD Options,
843  LPDIRECT3DDEVICE9 pD3DDevice,
844  LPD3DXBUFFER *ppMaterials,
845  LPD3DXBUFFER *ppEffectInstances,
846  DWORD* pNumMaterials,
847  LPD3DXPMESH *ppPMesh);
848 
849 /* 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
850  * The bone names and initial bone transforms are not filled in the skin info object by this method. */
851 HRESULT WINAPI
853  DWORD NumVertices,
854  CONST D3DVERTEXELEMENT9 *pDeclaration,
855  DWORD NumBones,
856  LPD3DXSKININFO* ppSkinInfo);
857 
858 /* 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
859  * The bone names and initial bone transforms are not filled in the skin info object by this method. */
860 HRESULT WINAPI
862  DWORD NumVertices,
863  DWORD FVF,
864  DWORD NumBones,
865  LPD3DXSKININFO* ppSkinInfo);
866 
867 #ifdef __cplusplus
868 }
869 
870 extern "C" {
871 #endif /* __cplusplus */
872 
873 HRESULT WINAPI
875  LPD3DXFILEDATA pxofMesh,
876  DWORD Options,
877  LPDIRECT3DDEVICE9 pD3DDevice,
878  LPD3DXBUFFER *ppAdjacency,
879  LPD3DXBUFFER *ppMaterials,
880  LPD3DXBUFFER *ppEffectInstances,
881  DWORD *pNumMaterials,
882  LPD3DXMESH *ppMesh);
883 
884 /* This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file
885  * If skinning info is not present, ppSkinInfo will be NULL */
886 HRESULT WINAPI
888  LPD3DXFILEDATA pxofMesh,
889  DWORD Options,
890  LPDIRECT3DDEVICE9 pD3DDevice,
891  LPD3DXBUFFER* ppAdjacency,
892  LPD3DXBUFFER* ppMaterials,
893  LPD3DXBUFFER *ppEffectInstances,
894  DWORD *pMatOut,
895  LPD3DXSKININFO* ppSkinInfo,
896  LPD3DXMESH* ppMesh);
897 
898 
899 /* The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from
900  * the mesh and the bone combination table and populates a skin info object with that data. The bone
901  * names and initial bone transforms are not filled in the skin info object by this method. This works
902  * with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to
903  * determine what type it is.
904  */
905 HRESULT WINAPI
907  LPD3DXBASEMESH pMesh,
908  DWORD NumBones,
909  CONST D3DXBONECOMBINATION *pBoneCombinationTable,
910  LPD3DXSKININFO* ppSkinInfo);
911 
912 HRESULT WINAPI
914  LPD3DXMESH pMeshIn,
915  CONST DWORD* pAdjacencyIn,
916  FLOAT NumSegs,
917  BOOL QuadraticInterpNormals, /* if false use linear intrep for normals, if true use quadratic */
918  LPD3DXMESH *ppMeshOut,
919  LPD3DXBUFFER *ppAdjacencyOut);
920 
921 
922 /* generates implied outputdecl from input decl
923  * the decl generated from this should be used to generate the output decl for
924  * the tessellator subroutines.
925  */
926 
927 HRESULT WINAPI
929  D3DVERTEXELEMENT9 *pOutput,
930  CONST D3DVERTEXELEMENT9 *pInput);
931 
932 /* loads patches from an XFileData
933  * since an X file can have up to 6 different patch meshes in it,
934  * returns them in an array - pNumPatches will contain the number of
935  * meshes in the actual file.
936  */
937 HRESULT WINAPI
939  LPD3DXFILEDATA pXofObjMesh,
940  DWORD Options,
941  LPDIRECT3DDEVICE9 pD3DDevice,
942  LPD3DXBUFFER *ppMaterials,
943  LPD3DXBUFFER *ppEffectInstances,
944  PDWORD pNumMaterials,
945  LPD3DXPATCHMESH *ppMesh);
946 
947 /* computes the size a single rect patch. */
948 HRESULT WINAPI
950  CONST FLOAT *pfNumSegs, /* segments for each edge (4) */
951  DWORD *pdwTriangles, /* output number of triangles */
952  DWORD *pdwVertices); /* output number of vertices */
953 
954 /* computes the size of a single triangle patch */
955 HRESULT WINAPI
957  CONST FLOAT *pfNumSegs, /* segments for each edge (3) */
958  DWORD *pdwTriangles, /* output number of triangles */
959  DWORD *pdwVertices); /* output number of vertices */
960 
961 
962 /*tessellates a patch into a created mesh
963  *similar to D3D RT patch */
964 HRESULT WINAPI
967  CONST FLOAT *pNumSegs,
968  CONST D3DVERTEXELEMENT9 *pdwInDecl,
969  CONST D3DRECTPATCH_INFO *pRectPatchInfo,
970  LPD3DXMESH pMesh);
971 
972 
973 HRESULT WINAPI
976  CONST FLOAT *pNumSegs,
977  CONST D3DVERTEXELEMENT9 *pInDecl,
978  CONST D3DTRIPATCH_INFO *pTriPatchInfo,
979  LPD3DXMESH pMesh);
980 
981 /*creates an NPatch PatchMesh from a D3DXMESH */
982 HRESULT WINAPI
984  LPD3DXMESH pMeshSysMem,
985  LPD3DXPATCHMESH *pPatchMesh);
986 
987 /*creates a patch mesh */
988 HRESULT WINAPI
990  CONST D3DXPATCHINFO *pInfo, /* patch type */
991  DWORD dwNumPatches, /* number of patches */
992  DWORD dwNumVertices, /* number of control vertices */
993  DWORD dwOptions, /* options */
994  CONST D3DVERTEXELEMENT9 *pDecl, /* format of control vertices */
995  LPDIRECT3DDEVICE9 pD3DDevice,
996  LPD3DXPATCHMESH *pPatchMesh);
997 
998 
999 /*returns the number of degenerates in a patch mesh -
1000  *text output put in string. */
1001 HRESULT WINAPI
1003  DWORD *dwcDegenerateVertices,
1004  DWORD *dwcDegeneratePatches,
1005  LPD3DXBUFFER *ppErrorsAndWarnings);
1006 
1007 UINT WINAPI
1008  D3DXGetFVFVertexSize(DWORD FVF);
1009 
1010 UINT WINAPI
1011  D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream);
1012 
1013 UINT WINAPI
1015 
1016 HRESULT WINAPI
1018  DWORD FVF,
1019  D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]);
1020 
1021 HRESULT WINAPI
1023  CONST D3DVERTEXELEMENT9 *pDeclarator,
1024  DWORD *pFVF);
1025 
1026 HRESULT WINAPI
1028  LPD3DXMESH pMesh,
1029  DWORD Flags,
1030  CONST D3DXWELDEPSILONS *pEpsilons,
1031  CONST DWORD *pAdjacencyIn,
1032  DWORD *pAdjacencyOut,
1033  DWORD *pFaceRemap,
1034  LPD3DXBUFFER *ppVertexRemap);
1035 
1036 typedef struct _D3DXINTERSECTINFO
1037 {
1038  DWORD FaceIndex; /* index of face intersected */
1039  FLOAT U; /* Barycentric Hit Coordinates */
1040  FLOAT V; /* Barycentric Hit Coordinates */
1041  FLOAT Dist; /* Ray-Intersection Parameter Distance */
1043 
1044 
1045 HRESULT WINAPI
1046  D3DXIntersect(
1047  LPD3DXBASEMESH pMesh,
1048  CONST D3DXVECTOR3 *pRayPos,
1049  CONST D3DXVECTOR3 *pRayDir,
1050  BOOL *pHit, /* True if any faces were intersected */
1051  DWORD *pFaceIndex, /* index of closest face intersected */
1052  FLOAT *pU, /* Barycentric Hit Coordinates */
1053  FLOAT *pV, /* Barycentric Hit Coordinates */
1054  FLOAT *pDist, /* Ray-Intersection Parameter Distance */
1055  LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */
1056  DWORD *pCountOfHits); /* Number of entries in AllHits array */
1057 
1058 HRESULT WINAPI
1060  LPD3DXBASEMESH pMesh,
1061  DWORD AttribId,
1062  CONST D3DXVECTOR3 *pRayPos,
1063  CONST D3DXVECTOR3 *pRayDir,
1064  BOOL *pHit, /* True if any faces were intersected */
1065  DWORD *pFaceIndex, /* index of closest face intersected */
1066  FLOAT *pU, /* Barycentric Hit Coordinates */
1067  FLOAT *pV, /* Barycentric Hit Coordinates */
1068  FLOAT *pDist, /* Ray-Intersection Parameter Distance */
1069  LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */
1070  DWORD *pCountOfHits); /* Number of entries in AllHits array */
1071 
1072 
1073 HRESULT WINAPI D3DXSplitMesh
1074  (
1075  LPD3DXMESH pMeshIn,
1076  CONST DWORD *pAdjacencyIn,
1077  CONST DWORD MaxSize,
1078  CONST DWORD Options,
1079  DWORD *pMeshesOut,
1080  LPD3DXBUFFER *ppMeshArrayOut,
1081  LPD3DXBUFFER *ppAdjacencyArrayOut,
1082  LPD3DXBUFFER *ppFaceRemapArrayOut,
1083  LPD3DXBUFFER *ppVertRemapArrayOut
1084  );
1085 
1086 BOOL WINAPI D3DXIntersectTri
1087 (
1088  CONST D3DXVECTOR3 *p0, /* Triangle vertex 0 position */
1089  CONST D3DXVECTOR3 *p1, /* Triangle vertex 1 position */
1090  CONST D3DXVECTOR3 *p2, /* Triangle vertex 2 position */
1091  CONST D3DXVECTOR3 *pRayPos, /* Ray origin */
1092  CONST D3DXVECTOR3 *pRayDir, /* Ray direction */
1093  FLOAT *pU, /* Barycentric Hit Coordinates */
1094  FLOAT *pV, /* Barycentric Hit Coordinates */
1095  FLOAT *pDist); /* Ray-Intersection Parameter Distance */
1096 
1097 BOOL WINAPI
1099  CONST D3DXVECTOR3 *pCenter,
1100  FLOAT Radius,
1101  CONST D3DXVECTOR3 *pRayPosition,
1102  CONST D3DXVECTOR3 *pRayDirection);
1103 
1104 BOOL WINAPI
1106  CONST D3DXVECTOR3 *pMin,
1107  CONST D3DXVECTOR3 *pMax,
1108  CONST D3DXVECTOR3 *pRayPosition,
1109  CONST D3DXVECTOR3 *pRayDirection);
1110 
1111 
1112 HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh,
1113  DWORD dwOptions);
1114 
1115 HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh,
1116  DWORD dwTextureInSemantic,
1117  DWORD dwTextureInIndex,
1118  DWORD dwUPartialOutSemantic,
1119  DWORD dwUPartialOutIndex,
1120  DWORD dwVPartialOutSemantic,
1121  DWORD dwVPartialOutIndex,
1122  DWORD dwNormalOutSemantic,
1123  DWORD dwNormalOutIndex,
1124  DWORD dwOptions,
1125  CONST DWORD *pdwAdjacency,
1126  FLOAT fPartialEdgeThreshold,
1127  FLOAT fSingularPointThreshold,
1128  FLOAT fNormalEdgeThreshold,
1129  ID3DXMesh **ppMeshOut,
1130  ID3DXBuffer **ppVertexMapping);
1131 
1132 
1133 /*D3DXComputeTangent
1134  *
1135  *Computes the Tangent vectors for the TexStage texture coordinates
1136  *and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL
1137  *puts the binorm in BINORM[BinormIndex] also specified in the decl.
1138  *
1139  *If neither the binorm or the tangnet are in the meshes declaration,
1140  *the function will fail.
1141  *
1142  *If a tangent or Binorm field is in the Decl, but the user does not
1143  *wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified
1144  *in the TangentIndex or BinormIndex will cause it to ignore the specified
1145  *semantic.
1146  *
1147  *Wrap should be specified if the texture coordinates wrap.
1148  */
1149 
1151  DWORD TexStage,
1152  DWORD TangentIndex,
1153  DWORD BinormIndex,
1154  DWORD Wrap,
1155  CONST DWORD *pAdjacency);
1156 
1157 /*
1158  *
1159  * UVAtlas apis
1160  *
1161  */
1162 typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext);
1163 
1164 /* This function creates atlases for meshes. There are two modes of operation,
1165  * either based on the number of charts, or the maximum allowed stretch. If the
1166  * maximum allowed stretch is 0, then each triangle will likely be in its own
1167  * chart.
1168  */
1169 
1170 /*
1171  * The parameters are as follows:
1172  * pMesh - Input mesh to calculate an atlas for. This must have a position
1173  * channel and at least a 2-d texture channel.
1174  * uMaxChartNumber - The maximum number of charts required for the atlas.
1175  * If this is 0, it will be parameterized based solely on
1176  * stretch.
1177  * fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed,
1178  * if 1, then any amount of stretching is allowed.
1179  * uWidth - The width of the texture the atlas will be used on.
1180  * uHeight - The height of the texture the atlas will be used on.
1181  * fGutter - The minimum distance, in texels between two charts on the atlas.
1182  * this gets scaled by the width, so if fGutter is 2.5, and it is
1183  * used on a 512x512 texture, then the minimum distance will be
1184  * 2.5 / 512 in u-v space.
1185  * dwTextureIndex - Specifies which texture coordinate to write to in the
1186  * output mesh (which is cloned from the input mesh). Useful
1187  * if your vertex has multiple texture coordinates.
1188  * pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating
1189  * which triangles are adjacent to each other.
1190  * pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating
1191  * at each face, whether an edge is a false edge or not (using
1192  * the same ordering as the adjacency data structure). If this
1193  * is NULL, then it is assumed that there are no false edges. If
1194  * not NULL, then a non-false edge is indicated by -1 and a false
1195  * edge is indicated by any other value (it is not required, but
1196  * it may be useful for the caller to use the original adjacency
1197  * value). This allows you to parameterize a mesh of quads, and
1198  * the edges down the middle of each quad will not be cut when
1199  * parameterizing the mesh.
1200  * pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the
1201  * integrated metric tensor for that face. This lets you control
1202  * the way this triangle may be stretched in the atlas. The IMT
1203  * passed in will be 3 floats (a,b,c) and specify a symmetric
1204  * matrix (a b) that, given a vector (s,t), specifies the
1205  * (b c)
1206  * distance between a vector v1 and a vector v2 = v1 + (s,t) as
1207  * sqrt((s, t) * M * (s, t)^T).
1208  * In other words, this lets one specify the magnitude of the
1209  * stretch in an arbitrary direction in u-v space. For example
1210  * if a = b = c = 1, then this scales the vector (1,1) by 2, and
1211  * the vector (1,-1) by 0. Note that this is multiplying the edge
1212  * length by the square of the matrix, so if you want the face to
1213  * stretch to twice its
1214  * size with no shearing, the IMT value should be (2, 0, 2), which
1215  * is just the identity matrix times 2.
1216  * Note that this assumes you have an orientation for the triangle
1217  * in some 2-D space. For D3DXUVAtlas, this space is created by
1218  * letting S be the direction from the first to the second
1219  * vertex, and T be the cross product between the normal and S.
1220  *
1221  * pStatusCallback - Since the atlas creation process can be very CPU intensive,
1222  * this allows the programmer to specify a function to be called
1223  * periodically, similarly to how it is done in the PRT simulation
1224  * engine.
1225  * fCallbackFrequency - This lets you specify how often the callback will be
1226  * called. A decent default should be 0.0001f.
1227  * pUserContext - a void pointer to be passed back to the callback function
1228  * dwOptions - A combination of flags in the D3DXUVATLAS enum
1229  * ppMeshOut - A pointer to a location to store a pointer for the newly created
1230  * mesh.
1231  * ppFacePartitioning - A pointer to a location to store a pointer for an array,
1232  * one DWORD per face, giving the final partitioning
1233  * created by the atlasing algorithm.
1234  * ppVertexRemapArray - A pointer to a location to store a pointer for an array,
1235  * one DWORD per vertex, giving the vertex it was copied
1236  * from, if any vertices needed to be split.
1237  * pfMaxStretchOut - A location to store the maximum stretch resulting from the
1238  * atlasing algorithm.
1239  * puNumChartsOut - A location to store the number of charts created, or if the
1240  * maximum number of charts was too low, this gives the minimum
1241  * number of charts needed to create an atlas.
1242  */
1243 
1244 HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh,
1245  UINT uMaxChartNumber,
1246  FLOAT fMaxStretch,
1247  UINT uWidth,
1248  UINT uHeight,
1249  FLOAT fGutter,
1250  DWORD dwTextureIndex,
1251  CONST DWORD *pdwAdjacency,
1252  CONST DWORD *pdwFalseEdgeAdjacency,
1253  CONST FLOAT *pfIMTArray,
1254  LPD3DXUVATLASCB pStatusCallback,
1255  FLOAT fCallbackFrequency,
1256  LPVOID pUserContext,
1257  DWORD dwOptions,
1258  LPD3DXMESH *ppMeshOut,
1259  LPD3DXBUFFER *ppFacePartitioning,
1260  LPD3DXBUFFER *ppVertexRemapArray,
1261  FLOAT *pfMaxStretchOut,
1262  UINT *puNumChartsOut);
1263 
1264 /* This has the same exact arguments as Create, except that it does not perform the
1265  * final packing step. This method allows one to get a partitioning out, and possibly
1266  * modify it before sending it to be repacked. Note that if you change the
1267  * partitioning, you'll also need to calculate new texture coordinates for any faces
1268  * that have switched charts.
1269  *
1270  * The partition result adjacency output parameter is meant to be passed to the
1271  * UVAtlasPack function, this adjacency cuts edges that are between adjacent
1272  * charts, and also can include cuts inside of a chart in order to make it
1273  * equivalent to a disc. For example:
1274  *
1275  * _______
1276  * | ___ |
1277  * | |_| |
1278  * |_____|
1279  *
1280  * In order to make this equivalent to a disc, we would need to add a cut, and it
1281  * Would end up looking like:
1282  * _______
1283  * | ___ |
1284  * | |_|_|
1285  * |_____|
1286  *
1287  * The resulting partition adjacency parameter cannot be NULL, because it is
1288  * required for the packing step.
1289  */
1290 
1292  UINT uMaxChartNumber,
1293  FLOAT fMaxStretch,
1294  DWORD dwTextureIndex,
1295  CONST DWORD *pdwAdjacency,
1296  CONST DWORD *pdwFalseEdgeAdjacency,
1297  CONST FLOAT *pfIMTArray,
1298  LPD3DXUVATLASCB pStatusCallback,
1299  FLOAT fCallbackFrequency,
1300  LPVOID pUserContext,
1301  DWORD dwOptions,
1302  LPD3DXMESH *ppMeshOut,
1303  LPD3DXBUFFER *ppFacePartitioning,
1304  LPD3DXBUFFER *ppVertexRemapArray,
1305  LPD3DXBUFFER *ppPartitionResultAdjacency,
1306  FLOAT *pfMaxStretchOut,
1307  UINT *puNumChartsOut);
1308 
1309 /* This takes the face partitioning result from Partition and packs it into an
1310  * atlas of the given size. pdwPartitionResultAdjacency should be derived from
1311  * the adjacency returned from the partition step. This value cannot be NULL
1312  * because Pack needs to know where charts were cut in the partition step in
1313  * order to find the edges of each chart.
1314  * The options parameter is currently reserved.
1315  */
1316 HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh,
1317  UINT uWidth,
1318  UINT uHeight,
1319  FLOAT fGutter,
1320  DWORD dwTextureIndex,
1321  CONST DWORD *pdwPartitionResultAdjacency,
1322  LPD3DXUVATLASCB pStatusCallback,
1323  FLOAT fCallbackFrequency,
1324  LPVOID pUserContext,
1325  DWORD dwOptions,
1326  LPD3DXBUFFER pFacePartitioning);
1327 
1328 
1329 /*
1330  *
1331  * IMT Calculation apis
1332  *
1333  * These functions all compute the Integrated Metric Tensor for use in the
1334  * UVAtlas API. They all calculate the IMT with respect to the canonical
1335  * triangle, where the coordinate system is set up so that the u axis goes
1336  * from vertex 0 to 1 and the v axis is N x u. So, for example, the second
1337  * vertex's canonical uv coordinates are (d,0) where d is the distance between
1338  * vertices 0 and 1. This way the IMT does not depend on the parameterization
1339  * of the mesh, and if the signal over the surface doesn't change, then
1340  * the IMT doesn't need to be recalculated.
1341  *============================================================================
1342 
1343  * This callback is used by D3DXComputeIMTFromSignal.
1344  *
1345  * uv - The texture coordinate for the vertex.
1346  * uPrimitiveID - Face ID of the triangle on which to compute the signal.
1347  * uSignalDimension - The number of floats to store in pfSignalOut.
1348  * pUserData - The pUserData pointer passed in to ComputeIMTFromSignal.
1349  * pfSignalOut - A pointer to where to store the signal data.
1350  */
1351 typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK)
1353  UINT uPrimitiveID,
1354  UINT uSignalDimension,
1355  VOID *pUserData,
1356  FLOAT *pfSignalOut);
1357 
1358 /* This function is used to calculate the IMT from per vertex data. It sets
1359  * up a linear system over the triangle, solves for the jacobian J, then
1360  * constructs the IMT from that (J^TJ).
1361  * This function allows you to calculate the IMT based off of any value in a
1362  * mesh (color, normal, etc) by specifying the correct stride of the array.
1363  * The IMT computed will cause areas of the mesh that have similar values to
1364  * take up less space in the texture.
1365  *
1366  * pMesh - The mesh to calculate the IMT for.
1367  * pVertexSignal - A float array of size uSignalStride * v, where v is the
1368  * number of vertices in the mesh.
1369  * uSignalDimension - How many floats per vertex to use in calculating the IMT.
1370  * uSignalStride - The number of bytes per vertex in the array. This must be
1371  * a multiple of sizeof(float)
1372  * ppIMTData - Where to store the buffer holding the IMT data
1373  */
1374 
1376  LPD3DXMESH pMesh,
1377  CONST FLOAT *pfVertexSignal, /* uSignalDimension floats per vertex */
1378  UINT uSignalDimension,
1379  UINT uSignalStride, /* stride of signal in bytes */
1380  DWORD dwOptions, /* reserved for future use */
1381  LPD3DXUVATLASCB pStatusCallback,
1382  LPVOID pUserContext,
1383  LPD3DXBUFFER *ppIMTData);
1384 
1385 /* This function is used to calculate the IMT from data that varies over the
1386  * surface of the mesh (generally at a higher frequency than vertex data).
1387  * This function requires the mesh to already be parameterized (so it already
1388  * has texture coordinates). It allows the user to define a signal arbitrarily
1389  * over the surface of the mesh.
1390  *
1391  * pMesh - The mesh to calculate the IMT for.
1392  * dwTextureIndex - This describes which set of texture coordinates in the
1393  * mesh to use.
1394  * uSignalDimension - How many components there are in the signal.
1395  * fMaxUVDistance - The subdivision will continue until the distance between
1396  * all vertices is at most fMaxUVDistance.
1397  * dwOptions - reserved for future use
1398  * pSignalCallback - The callback to use to get the signal.
1399  * pUserData - A pointer that will be passed in to the callback.
1400  * ppIMTData - Where to store the buffer holding the IMT data
1401  */
1403  LPD3DXMESH pMesh,
1404  DWORD dwTextureIndex,
1405  UINT uSignalDimension,
1406  FLOAT fMaxUVDistance,
1407  DWORD dwOptions, /* reserved for future use */
1408  LPD3DXIMTSIGNALCALLBACK pSignalCallback,
1409  VOID *pUserData,
1410  LPD3DXUVATLASCB pStatusCallback,
1411  LPVOID pUserContext,
1412  LPD3DXBUFFER *ppIMTData);
1413 
1414 /* This function is used to calculate the IMT from texture data. Given a texture
1415  * that maps over the surface of the mesh, the algorithm computes the IMT for
1416  * each face. This will cause large areas that are very similar to take up less
1417  * room when parameterized with UVAtlas. The texture is assumed to be
1418  * interpolated over the mesh bilinearly.
1419  *
1420  * pMesh - The mesh to calculate the IMT for.
1421  * pTexture - The texture to load data from.
1422  * dwTextureIndex - This describes which set of texture coordinates in the
1423  * mesh to use.
1424  * dwOptions - Combination of one or more D3DXIMT flags.
1425  * ppIMTData - Where to store the buffer holding the IMT data
1426  */
1428  LPD3DXMESH pMesh,
1429  LPDIRECT3DTEXTURE9 pTexture,
1430  DWORD dwTextureIndex,
1431  DWORD dwOptions,
1432  LPD3DXUVATLASCB pStatusCallback,
1433  LPVOID pUserContext,
1434  LPD3DXBUFFER *ppIMTData);
1435 
1436 /* This function is very similar to ComputeIMTFromTexture, but it uses a
1437  * float array to pass in the data, and it can calculate higher dimensional
1438  * values than 4.
1439  *
1440  * pMesh - The mesh to calculate the IMT for.
1441  * dwTextureIndex - This describes which set of texture coordinates in the
1442  * mesh to use.
1443  * pfFloatArray - a pointer to a float array of size
1444  * uWidth*uHeight*uComponents
1445  * uWidth - The width of the texture
1446  * uHeight - The height of the texture
1447  * uSignalDimension - The number of floats per texel in the signal
1448  * uComponents - The number of floats in each texel
1449  * dwOptions - Combination of one or more D3DXIMT flags
1450  * ppIMTData - Where to store the buffer holding the IMT data
1451  */
1453  LPD3DXMESH pMesh,
1454  DWORD dwTextureIndex,
1455  FLOAT *pfTexelSignal,
1456  UINT uWidth,
1457  UINT uHeight,
1458  UINT uSignalDimension,
1459  UINT uComponents,
1460  DWORD dwOptions,
1461  LPD3DXUVATLASCB pStatusCallback,
1462  LPVOID pUserContext,
1463  LPD3DXBUFFER *ppIMTData);
1464 
1465 HRESULT WINAPI
1467  LPD3DXBASEMESH MeshIn,
1468  DWORD AttribId,
1469  DWORD IBOptions,
1470  LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer,
1471  DWORD *pNumIndices);
1472 
1473 HRESULT WINAPI
1475  LPD3DXBASEMESH MeshIn,
1476  DWORD AttribId,
1477  DWORD IBOptions,
1478  LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer,
1479  DWORD *pNumIndices,
1480  LPD3DXBUFFER *ppStripLengths,
1481  DWORD *pNumStrips);
1482 
1483 
1484 /*
1485  *
1486  * D3DXOptimizeFaces:
1487  * --------------------
1488  * Generate a face remapping for a triangle list that more effectively utilizes
1489  * vertex caches. This optimization is identical to the one provided
1490  * by ID3DXMesh::Optimize with the hardware independent option enabled.
1491  *
1492  * Parameters:
1493  * pbIndices
1494  * Triangle list indices to use for generating a vertex ordering
1495  * NumFaces
1496  * Number of faces in the triangle list
1497  * NumVertices
1498  * Number of vertices referenced by the triangle list
1499  * b32BitIndices
1500  * TRUE if indices are 32 bit, FALSE if indices are 16 bit
1501  * pFaceRemap
1502  * Destination buffer to store face ordering
1503  * The number stored for a given element is where in the new ordering
1504  * the face will have come from. See ID3DXMesh::Optimize for more info.
1505  *
1506  */
1507 HRESULT WINAPI
1509  LPCVOID pbIndices,
1510  UINT cFaces,
1511  UINT cVertices,
1512  BOOL b32BitIndices,
1513  DWORD* pFaceRemap);
1514 
1515 /*
1516  *
1517  * D3DXOptimizeVertices:
1518  * --------------------
1519  * Generate a vertex remapping to optimize for in order use of vertices for
1520  * a given set of indices. This is commonly used after applying the face
1521  * remap generated by D3DXOptimizeFaces
1522  *
1523  * Parameters:
1524  * pbIndices
1525  * Triangle list indices to use for generating a vertex ordering
1526  * NumFaces
1527  * Number of faces in the triangle list
1528  * NumVertices
1529  * Number of vertices referenced by the triangle list
1530  * b32BitIndices
1531  * TRUE if indices are 32 bit, FALSE if indices are 16 bit
1532  * pVertexRemap
1533  * Destination buffer to store vertex ordering
1534  * The number stored for a given element is where in the new ordering
1535  * the vertex will have come from. See ID3DXMesh::Optimize for more info.
1536  *
1537  */
1538 HRESULT WINAPI
1540  LPCVOID pbIndices,
1541  UINT cFaces,
1542  UINT cVertices,
1543  BOOL b32BitIndices,
1544  DWORD* pVertexRemap);
1545 
1546 #ifdef __cplusplus
1547 }
1548 #endif /* __cplusplus */
1549 
1550 
1551 /*
1552  *
1553  * Data structures for Spherical Harmonic Precomputation
1554  *
1555  *
1556  */
1557 
1563 
1564 typedef enum _D3DXSHGPUSIMOPT {
1569 
1571 
1573 } D3DXSHGPUSIMOPT;
1574 
1575 /* for all properties that are colors the luminance is computed
1576  * if the simulator is run with a single channel using the following
1577  * formula: R * 0.2125 + G * 0.7154 + B * 0.0721
1578  */
1579 
1580 typedef struct _D3DXSHMATERIAL {
1581  D3DCOLORVALUE Diffuse; /* Diffuse albedo of the surface. (Ignored if object is a Mirror) */
1582  BOOL bMirror; /* Must be set to FALSE. bMirror == TRUE not currently supported */
1583  BOOL bSubSurf; /* true if the object does subsurface scattering - can't do this and be a mirror */
1584 
1585  /* subsurface scattering parameters */
1589 
1590 } D3DXSHMATERIAL;
1591 
1592 /* allocated in D3DXSHPRTCompSplitMeshSC
1593  * vertices are duplicated into multiple super clusters but
1594  * only have a valid status in one super cluster (fill in the rest)
1595  */
1596 
1598  UINT uVertRemap; /* vertex in original mesh this corresponds to */
1599  UINT uSubCluster; /* cluster index relative to super cluster */
1600  UCHAR ucVertStatus; /* 1 if vertex has valid data, 0 if it is "fill" */
1602 
1603 /* used in D3DXSHPRTCompSplitMeshSC
1604  * information for each super cluster that maps into face/vert arrays
1605  */
1606 
1608  UINT uVertStart; /* initial index into remapped vertex array */
1609  UINT uVertLength; /* number of vertices in this super cluster */
1610 
1611  UINT uFaceStart; /* initial index into face array */
1612  UINT uFaceLength; /* number of faces in this super cluster */
1613 
1614  UINT uClusterStart; /* initial index into cluster array */
1615  UINT uClusterLength; /* number of clusters in this super cluster */
1617 
1618 /* call back function for simulator
1619  * return S_OK to keep running the simulator - anything else represents
1620  * failure and the simulator will abort.
1621  */
1622 
1623 typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext);
1624 
1625 /* interfaces for PRT buffers/simulator */
1626 
1627 /* GUIDs
1628  * {F1827E47-00A8-49cd-908C-9D11955F8728} */
1629 DEFINE_GUID(IID_ID3DXPRTBuffer,
1630 0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28);
1631 
1632 /* {A758D465-FE8D-45ad-9CF0-D01E56266A07} */
1633 DEFINE_GUID(IID_ID3DXPRTCompBuffer,
1634 0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7);
1635 
1636 /* {838F01EC-9729-4527-AADB-DF70ADE7FEA9} */
1637 DEFINE_GUID(IID_ID3DXTextureGutterHelper,
1638 0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9);
1639 
1640 /* {683A4278-CD5F-4d24-90AD-C4E1B6855D53} */
1641 DEFINE_GUID(IID_ID3DXPRTEngine,
1642 0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53);
1643 
1644 /* interface defenitions */
1645 
1647 typedef interface ID3DXPRTBuffer ID3DXPRTBuffer;
1648 
1649 #undef INTERFACE
1650 #define INTERFACE ID3DXPRTBuffer
1651 
1652 /* Buffer interface - contains "NumSamples" samples
1653  * each sample in memory is stored as NumCoeffs scalars per channel (1 or 3)
1654  * Same interface is used for both Vertex and Pixel PRT buffers
1655  */
1656 
1658 {
1659  /* IUnknown */
1660  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
1661  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
1662  STDMETHOD_(ULONG, Release)(THIS) PURE;
1663 
1664  /* ID3DXPRTBuffer */
1665  STDMETHOD_(UINT, GetNumSamples)(THIS) PURE;
1666  STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE;
1667  STDMETHOD_(UINT, GetNumChannels)(THIS) PURE;
1668 
1669  STDMETHOD_(BOOL, IsTexture)(THIS) PURE;
1670  STDMETHOD_(UINT, GetWidth)(THIS) PURE;
1671  STDMETHOD_(UINT, GetHeight)(THIS) PURE;
1672 
1673  /* changes the number of samples allocated in the buffer */
1674  STDMETHOD(Resize)(THIS_ UINT NewSize) PURE;
1675 
1676  /* ppData will point to the memory location where sample Start begins
1677  * pointer is valid for at least NumSamples samples
1678  */
1679  STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE;
1680  STDMETHOD(UnlockBuffer)(THIS) PURE;
1681 
1682  /* every scalar in buffer is multiplied by Scale */
1683  STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE;
1684 
1685  /* every scalar contains the sum of this and pBuffers values
1686  * pBuffer must have the same storage class/dimensions
1687  */
1688  STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE;
1689 
1690  /* GutterHelper (described below) will fill in the gutter
1691  * regions of a texture by interpolating "internal" values
1692  */
1693  STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE;
1694  STDMETHOD(ReleaseGH)(THIS) PURE;
1695 
1696  /* Evaluates attached gutter helper on the contents of this buffer */
1697  STDMETHOD(EvalGH)(THIS) PURE;
1698 
1699  /* extracts a given channel into texture pTexture
1700  * NumCoefficients starting from StartCoefficient are copied
1701  */
1702  STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient,
1703  UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE;
1704 
1705  /* extracts NumCoefficients coefficients into mesh - only applicable on single channel
1706  * buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients
1707  * should be Order^2
1708  */
1709  STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart,
1710  LPD3DXMESH pScene) PURE;
1711 
1712 };
1713 
1714 typedef interface ID3DXPRTCompBuffer ID3DXPRTCompBuffer;
1716 
1717 #undef INTERFACE
1718 #define INTERFACE ID3DXPRTCompBuffer
1719 
1720 /* compressed buffers stored a compressed version of a PRTBuffer */
1721 
1723 {
1724  /* IUnknown */
1725  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
1726  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
1727  STDMETHOD_(ULONG, Release)(THIS) PURE;
1728 
1729  /* ID3DPRTCompBuffer */
1730 
1731  /* NumCoeffs and NumChannels are properties of input buffer */
1732  STDMETHOD_(UINT, GetNumSamples)(THIS) PURE;
1733  STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE;
1734  STDMETHOD_(UINT, GetNumChannels)(THIS) PURE;
1735 
1736  STDMETHOD_(BOOL, IsTexture)(THIS) PURE;
1737  STDMETHOD_(UINT, GetWidth)(THIS) PURE;
1738  STDMETHOD_(UINT, GetHeight)(THIS) PURE;
1739 
1740  /* number of clusters, and PCA vectors per-cluster */
1741  STDMETHOD_(UINT, GetNumClusters)(THIS) PURE;
1742  STDMETHOD_(UINT, GetNumPCA)(THIS) PURE;
1743 
1744  /* normalizes PCA weights so that they are between [-1,1]
1745  * basis vectors are modified to reflect this
1746  */
1747  STDMETHOD(NormalizeData)(THIS) PURE;
1748 
1749  /* copies basis vectors for cluster "Cluster" into pClusterBasis
1750  * (NumPCA+1)*NumCoeffs*NumChannels floats
1751  */
1752  STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE;
1753 
1754  /* UINT per sample - which cluster it belongs to */
1755  STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE;
1756 
1757  /* copies NumExtract PCA projection coefficients starting at StartPCA
1758  * into pPCACoefficients - NumSamples*NumExtract floats copied
1759  */
1760  STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE;
1761 
1762  /* copies NumPCA projection coefficients starting at StartPCA
1763  * into pTexture - should be able to cope with signed formats
1764  */
1765  STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA,
1766  LPDIRECT3DTEXTURE9 pTexture) PURE;
1767 
1768  /* copies NumPCA projection coefficients into mesh pScene
1769  * Usage is D3DDECLUSAGE where coefficients are to be stored
1770  * UsageIndexStart is starting index
1771  */
1772  STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart,
1773  LPD3DXMESH pScene) PURE;
1774 };
1775 
1776 
1777 #undef INTERFACE
1778 #define INTERFACE ID3DXTextureGutterHelper
1779 
1780 /* ID3DXTextureGutterHelper will build and manage
1781  * "gutter" regions in a texture - this will allow for
1782  * bi-linear interpolation to not have artifacts when rendering
1783  * It generates a map (in texture space) where each texel
1784  * is in one of 3 states:
1785  * 0 Invalid - not used at all
1786  * 1 Inside triangle
1787  * 2 Gutter texel
1788  * 4 represents a gutter texel that will be computed during PRT
1789  * For each Inside/Gutter texel it stores the face it
1790  * belongs to and barycentric coordinates for the 1st two
1791  * vertices of that face. Gutter vertices are assigned to
1792  * the closest edge in texture space.
1793  *
1794  * When used with PRT this requires a unique parameterization
1795  * of the model - every texel must correspond to a single point
1796  * on the surface of the model and vice versa
1797  */
1798 
1800 {
1801  /* IUnknown */
1802  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
1803  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
1804  STDMETHOD_(ULONG, Release)(THIS) PURE;
1805 
1806  /* ID3DXTextureGutterHelper */
1807 
1808  /* dimensions of texture this is bound too */
1809  STDMETHOD_(UINT, GetWidth)(THIS) PURE;
1810  STDMETHOD_(UINT, GetHeight)(THIS) PURE;
1811 
1812 
1813  /* Applying gutters recomputes all of the gutter texels of class "2"
1814  * based on texels of class "1" or "4"
1815  */
1816 
1817  /* Applies gutters to a raw float buffer - each texel is NumCoeffs floats
1818  * Width and Height must match GutterHelper
1819  */
1820  STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height);
1821 
1822  /* Applies gutters to pTexture
1823  * Dimensions must match GutterHelper
1824  */
1825  STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture);
1826 
1827  /* Applies gutters to a D3DXPRTBuffer
1828  * Dimensions must match GutterHelper
1829  */
1830  STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer);
1831 
1832  /* Resamples a texture from a mesh onto this gutterhelpers
1833  * parameterization. It is assumed that the UV coordinates
1834  * for this gutter helper are in TEXTURE 0 (usage/usage index)
1835  * and the texture coordinates should all be within [0,1] for
1836  * both sets.
1837  *
1838  * pTextureIn - texture represented using parameterization in pMeshIn
1839  * pMeshIn - Mesh with texture coordinates that represent pTextureIn
1840  * pTextureOut texture coordinates are assumed to be in
1841  * TEXTURE 0
1842  * Usage - field in DECL for pMeshIn that stores texture coordinates
1843  * for pTextureIn
1844  * UsageIndex - which index for Usage above for pTextureIn
1845  * pTextureOut- Resampled texture
1846  *
1847  * Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero
1848  */
1849  STDMETHOD(ResampleTex)(THIS_ LPDIRECT3DTEXTURE9 pTextureIn,
1850  LPD3DXMESH pMeshIn,
1851  D3DDECLUSAGE Usage, UINT UsageIndex,
1852  LPDIRECT3DTEXTURE9 pTextureOut);
1853 
1854  /* the routines below provide access to the data structures
1855  * used by the Apply functions
1856 
1857  * face map is a UINT per texel that represents the
1858  * face of the mesh that texel belongs too -
1859  * only valid if same texel is valid in pGutterData
1860  * pFaceData must be allocated by the user
1861  */
1862  STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE;
1863 
1864  /* BaryMap is a D3DXVECTOR2 per texel
1865  * the 1st two barycentric coordinates for the corresponding
1866  * face (3rd weight is always 1-sum of first two)
1867  * only valid if same texel is valid in pGutterData
1868  * pBaryData must be allocated by the user
1869  */
1870  STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE;
1871 
1872  /* TexelMap is a D3DXVECTOR2 per texel that
1873  * stores the location in pixel coordinates where the
1874  * corresponding texel is mapped
1875  * pTexelData must be allocated by the user
1876  */
1877  STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE;
1878 
1879  /* GutterMap is a BYTE per texel
1880  * 0/1/2 for Invalid/Internal/Gutter texels
1881  * 4 represents a gutter texel that will be computed
1882  * during PRT
1883  * pGutterData must be allocated by the user
1884  */
1885  STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE;
1886 
1887  /* face map is a UINT per texel that represents the
1888  * face of the mesh that texel belongs too -
1889  * only valid if same texel is valid in pGutterData
1890  */
1891  STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE;
1892 
1893  /* BaryMap is a D3DXVECTOR2 per texel
1894  * the 1st two barycentric coordinates for the corresponding
1895  * face (3rd weight is always 1-sum of first two)
1896  * only valid if same texel is valid in pGutterData
1897  */
1898  STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE;
1899 
1900  /* TexelMap is a D3DXVECTOR2 per texel that
1901  * stores the location in pixel coordinates where the
1902  * corresponding texel is mapped
1903  */
1904  STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE;
1905 
1906  /* GutterMap is a BYTE per texel
1907  * 0/1/2 for Invalid/Internal/Gutter texels
1908  * 4 represents a gutter texel that will be computed
1909  * during PRT
1910  */
1911  STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE;
1912 };
1913 
1914 
1915 typedef interface ID3DXPRTEngine ID3DXPRTEngine;
1916 typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE;
1917 
1918 #undef INTERFACE
1919 #define INTERFACE ID3DXPRTEngine
1920 
1921 /* ID3DXPRTEngine is used to compute a PRT simulation
1922  * Use the following steps to compute PRT for SH
1923  * (1) create an interface (which includes a scene)
1924  * (2) call SetSamplingInfo
1925  * (3) [optional] Set MeshMaterials/albedo's (required if doing bounces)
1926  * (4) call ComputeDirectLightingSH
1927  * (5) [optional] call ComputeBounce
1928  * repeat step 5 for as many bounces as wanted.
1929  * if you want to model subsurface scattering you
1930  * need to call ComputeSS after direct lighting and
1931  * each bounce.
1932  * If you want to bake the albedo into the PRT signal, you
1933  * must call MutliplyAlbedo, otherwise the user has to multiply
1934  * the albedo themselves. Not multiplying the albedo allows you
1935  * to model albedo variation at a finer scale then illumination, and
1936  * can result in better compression results.
1937  * Luminance values are computed from RGB values using the following
1938  * formula: R * 0.2125 + G * 0.7154 + B * 0.0721
1939  */
1940 
1942 {
1943  /* IUnknown */
1944  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
1945  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
1946  STDMETHOD_(ULONG, Release)(THIS) PURE;
1947 
1948  /* ID3DXPRTEngine
1949 
1950  * This sets a material per attribute in the scene mesh and it is
1951  * the only way to specify subsurface scattering parameters. if
1952  * bSetAlbedo is FALSE, NumChannels must match the current
1953  * configuration of the PRTEngine. If you intend to change
1954  * NumChannels (through some other SetAlbedo function) it must
1955  * happen before SetMeshMaterials is called.
1956  *
1957  * NumChannels 1 implies "grayscale" materials, set this to 3 to enable
1958  * color bleeding effects
1959  * bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex
1960  * albedo that might have been set before. FALSE won't clobber.
1961  * fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube
1962  * and scaled by this amount
1963  */
1964  STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes,
1965  UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE;
1966 
1967  /* setting albedo per-vertex or per-texel over rides the albedos stored per mesh
1968  * but it does not over ride any other settings
1969 
1970  * sets an albedo to be used per vertex - the albedo is represented as a float
1971  * pDataIn input pointer (pointint to albedo of 1st sample)
1972  * NumChannels 1 implies "grayscale" materials, set this to 3 to enable
1973  * color bleeding effects
1974  * Stride - stride in bytes to get to next samples albedo
1975  */
1976  STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE;
1977 
1978  /* represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used)
1979  * pAlbedoTexture - texture that stores the albedo (dimension arbitrary)
1980  * NumChannels 1 implies "grayscale" materials, set this to 3 to enable
1981  * color bleeding effects
1982  * pGH - optional gutter helper, otherwise one is constructed in computation routines and
1983  * destroyed (if not attached to buffers)
1984  */
1985  STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture,
1986  UINT NumChannels,
1987  LPD3DXTEXTUREGUTTERHELPER pGH) PURE;
1988 
1989  /* gets the per-vertex albedo */
1990  STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE;
1991 
1992  /* If pixel PRT is being computed normals default to ones that are interpolated
1993  * from the vertex normals. This specifies a texture that stores an object
1994  * space normal map instead (must use a texture format that can represent signed values)
1995  * pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed
1996  */
1997  STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE;
1998 
1999  /* Copies per-vertex albedo from mesh
2000  * pMesh - mesh that represents the scene. It must have the same
2001  * properties as the mesh used to create the PRTEngine
2002  * Usage - D3DDECLUSAGE to extract albedos from
2003  * NumChannels 1 implies "grayscale" materials, set this to 3 to enable
2004  * color bleeding effects
2005  */
2006  STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh,
2007  D3DDECLUSAGE Usage,
2008  UINT NumChannels) PURE;
2009 
2010  /* Resamples the input buffer into the output buffer
2011  * can be used to move between per-vertex and per-texel buffers. This can also be used
2012  * to convert single channel buffers to 3-channel buffers and vice-versa.
2013  */
2014  STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE;
2015 
2016  /* Returns the scene mesh - including modifications from adaptive spatial sampling
2017  * The returned mesh only has positions, normals and texture coordinates (if defined)
2018  * pD3DDevice - d3d device that will be used to allocate the mesh
2019  * pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from
2020  * if the face hasn't been subdivided this will be an identity mapping
2021  * pVertRemap - each vertex contains 3 vertices that this is a linear combination of
2022  * pVertWeights - weights for each of above indices (sum to 1.0f)
2023  * ppMesh - mesh that will be allocated and filled
2024  */
2025  STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE;
2026 
2027  /* Number of vertices currently allocated (includes new vertices from adaptive sampling) */
2028  STDMETHOD_(UINT, GetNumVerts)(THIS) PURE;
2029  /* Number of faces currently allocated (includes new faces) */
2030  STDMETHOD_(UINT, GetNumFaces)(THIS) PURE;
2031 
2032  /* Sets the Minimum/Maximum intersection distances, this can be used to control
2033  * maximum distance that objects can shadow/reflect light, and help with "bad"
2034  * art that might have near features that you don't want to shadow. This does not
2035  * apply for GPU simulations.
2036  * fMin - minimum intersection distance, must be positive and less than fMax
2037  * fMax - maximum intersection distance, if 0.0f use the previous value, otherwise
2038  * must be strictly greater than fMin
2039  */
2040  STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE;
2041 
2042  /* This will subdivide faces on a mesh so that adaptively simulations can
2043  * use a more conservative threshold (it won't miss features.)
2044  * MinEdgeLength - minimum edge length that will be generated, if 0.0f a
2045  * reasonable default will be used
2046  * MaxSubdiv - maximum level of subdivision, if 0 is specified a default
2047  * value will be used (5)
2048  */
2049  STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE;
2050 
2051  /* This sets to sampling information used by the simulator. Adaptive sampling
2052  * parameters are currently ignored.
2053  * NumRays - number of rays to shoot per sample
2054  * UseSphere - if TRUE uses spherical samples, otherwise samples over
2055  * the hemisphere. Should only be used with GPU and Vol computations
2056  * UseCosine - if TRUE uses a cosine weighting - not used for Vol computations
2057  * or if only the visiblity function is desired
2058  * Adaptive - if TRUE adaptive sampling (angular) is used
2059  * AdaptiveThresh - threshold used to terminate adaptive angular sampling
2060  * ignored if adaptive sampling is not set
2061  */
2062  STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays,
2063  BOOL UseSphere,
2064  BOOL UseCosine,
2065  BOOL Adaptive,
2066  FLOAT AdaptiveThresh) PURE;
2067 
2068  /* Methods that compute the direct lighting contribution for objects
2069  * always represente light using spherical harmonics (SH)
2070  * the albedo is not multiplied by the signal - it just integrates
2071  * incoming light. If NumChannels is not 1 the vector is replicated
2072  *
2073  * SHOrder - order of SH to use
2074  * pDataOut - PRT buffer that is generated. Can be single channel
2075  */
2076  STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder,
2077  LPD3DXPRTBUFFER pDataOut) PURE;
2078 
2079  /* Adaptive variant of above function. This will refine the mesh
2080  * generating new vertices/faces to approximate the PRT signal
2081  * more faithfully.
2082  * SHOrder - order of SH to use
2083  * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error)
2084  * if value is less then 1e-6f, 1e-6f is specified
2085  * MinEdgeLength - minimum edge length that will be generated
2086  * if value is too small a fairly conservative model dependent value
2087  * is used
2088  * MaxSubdiv - maximum subdivision level, if 0 is specified it
2089  * will default to 4
2090  * pDataOut - PRT buffer that is generated. Can be single channel.
2091  */
2092  STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder,
2093  FLOAT AdaptiveThresh,
2094  FLOAT MinEdgeLength,
2095  UINT MaxSubdiv,
2096  LPD3DXPRTBUFFER pDataOut) PURE;
2097 
2098  /* Function that computes the direct lighting contribution for objects
2099  * light is always represented using spherical harmonics (SH)
2100  * This is done on the GPU and is much faster then using the CPU.
2101  * The albedo is not multiplied by the signal - it just integrates
2102  * incoming light. If NumChannels is not 1 the vector is replicated.
2103  * ZBias/ZAngleBias are akin to parameters used with shadow zbuffers.
2104  * A reasonable default for both values is 0.005, but the user should
2105  * experiment (ZAngleBias can be zero, ZBias should not be.)
2106  * Callbacks should not use the Direct3D9Device the simulator is using.
2107  * SetSamplingInfo must be called with TRUE for UseSphere and
2108  * FALSE for UseCosine before this method is called.
2109  *
2110  * pD3DDevice - device used to run GPU simulator - must support PS2.0
2111  * and FP render targets
2112  * Flags - parameters for the GPU simulator, combination of one or more
2113  * D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and
2114  * the defaults is 512
2115  * SHOrder - order of SH to use
2116  * ZBias - bias in normal direction (for depth test)
2117  * ZAngleBias - scaled by one minus cosine of angle with light (offset in depth)
2118  * pDataOut - PRT buffer that is filled in. Can be single channel
2119  */
2120  STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,
2121  UINT Flags,
2122  UINT SHOrder,
2123  FLOAT ZBias,
2124  FLOAT ZAngleBias,
2125  LPD3DXPRTBUFFER pDataOut) PURE;
2126 
2127 
2128  /* Functions that computes subsurface scattering (using material properties)
2129  * Albedo is not multiplied by result. This only works for per-vertex data
2130  * use ResampleBuffer to move per-vertex data into a texture and back.
2131  *
2132  * pDataIn - input data (previous bounce)
2133  * pDataOut - result of subsurface scattering simulation
2134  * pDataTotal - [optional] results can be summed into this buffer
2135  */
2136  STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn,
2137  LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE;
2138 
2139  /* Adaptive version of ComputeSS.
2140  *
2141  * pDataIn - input data (previous bounce)
2142  * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error)
2143  * if value is less then 1e-6f, 1e-6f is specified
2144  * MinEdgeLength - minimum edge length that will be generated
2145  * if value is too small a fairly conservative model dependent value
2146  * is used
2147  * MaxSubdiv - maximum subdivision level, if 0 is specified it
2148  * will default to 4
2149  * pDataOut - result of subsurface scattering simulation
2150  * pDataTotal - [optional] results can be summed into this buffer
2151  */
2152  STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn,
2153  FLOAT AdaptiveThresh,
2154  FLOAT MinEdgeLength,
2155  UINT MaxSubdiv,
2156  LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE;
2157 
2158  /* computes a single bounce of inter-reflected light
2159  * works for SH based PRT or generic lighting
2160  * Albedo is not multiplied by result
2161  *
2162  * pDataIn - previous bounces data
2163  * pDataOut - PRT buffer that is generated
2164  * pDataTotal - [optional] can be used to keep a running sum
2165  */
2166  STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn,
2167  LPD3DXPRTBUFFER pDataOut,
2168  LPD3DXPRTBUFFER pDataTotal) PURE;
2169 
2170  /* Adaptive version of above function.
2171  *
2172  * pDataIn - previous bounces data, can be single channel
2173  * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error)
2174  * if value is less then 1e-6f, 1e-6f is specified
2175  * MinEdgeLength - minimum edge length that will be generated
2176  * if value is too small a fairly conservative model dependent value
2177  * is used
2178  * MaxSubdiv - maximum subdivision level, if 0 is specified it
2179  * will default to 4
2180  * pDataOut - PRT buffer that is generated
2181  * pDataTotal - [optional] can be used to keep a running sum
2182  */
2183  STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn,
2184  FLOAT AdaptiveThresh,
2185  FLOAT MinEdgeLength,
2186  UINT MaxSubdiv,
2187  LPD3DXPRTBUFFER pDataOut,
2188  LPD3DXPRTBUFFER pDataTotal) PURE;
2189 
2190  /* Computes projection of distant SH radiance into a local SH radiance
2191  * function. This models how direct lighting is attenuated by the
2192  * scene and is a form of "neighborhood transfer." The result is
2193  * a linear operator (matrix) at every sample point, if you multiply
2194  * this matrix by the distant SH lighting coefficients you get an
2195  * approximation of the local incident radiance function from
2196  * direct lighting. These resulting lighting coefficients can
2197  * than be projected into another basis or used with any rendering
2198  * technique that uses spherical harmonics as input.
2199  * SetSamplingInfo must be called with TRUE for UseSphere and
2200  * FALSE for UseCosine before this method is called.
2201  * Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars
2202  * per channel at each sample location.
2203  *
2204  * SHOrderIn - Order of the SH representation of distant lighting
2205  * SHOrderOut - Order of the SH representation of local lighting
2206  * NumVolSamples - Number of sample locations
2207  * pSampleLocs - position of sample locations
2208  * pDataOut - PRT Buffer that will store output results
2209  */
2210  STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn,
2211  UINT SHOrderOut,
2212  UINT NumVolSamples,
2213  CONST D3DXVECTOR3 *pSampleLocs,
2214  LPD3DXPRTBUFFER pDataOut) PURE;
2215 
2216  /* At each sample location computes a linear operator (matrix) that maps
2217  * the representation of source radiance (NumCoeffs in pSurfDataIn)
2218  * into a local incident radiance function approximated with spherical
2219  * harmonics. For example if a light map data is specified in pSurfDataIn
2220  * the result is an SH representation of the flow of light at each sample
2221  * point. If PRT data for an outdoor scene is used, each sample point
2222  * contains a matrix that models how distant lighting bounces of the objects
2223  * in the scene and arrives at the given sample point. Combined with
2224  * ComputeVolumeSamplesDirectSH this gives the complete representation for
2225  * how light arrives at each sample point parameterized by distant lighting.
2226  * SetSamplingInfo must be called with TRUE for UseSphere and
2227  * FALSE for UseCosine before this method is called.
2228  * Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars
2229  * per channel at each sample location.
2230  *
2231  * pSurfDataIn - previous bounce data
2232  * SHOrder - order of SH to generate projection with
2233  * NumVolSamples - Number of sample locations
2234  * pSampleLocs - position of sample locations
2235  * pDataOut - PRT Buffer that will store output results
2236  */
2237  STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn,
2238  UINT SHOrder,
2239  UINT NumVolSamples,
2240  CONST D3DXVECTOR3 *pSampleLocs,
2241  LPD3DXPRTBUFFER pDataOut) PURE;
2242 
2243  /* Computes direct lighting (SH) for a point not on the mesh
2244  * with a given normal - cannot use texture buffers.
2245  *
2246  * SHOrder - order of SH to use
2247  * NumSamples - number of sample locations
2248  * pSampleLocs - position for each sample
2249  * pSampleNorms - normal for each sample
2250  * pDataOut - PRT Buffer that will store output results
2251  */
2252  STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder,
2253  UINT NumSamples,
2254  CONST D3DXVECTOR3 *pSampleLocs,
2255  CONST D3DXVECTOR3 *pSampleNorms,
2256  LPD3DXPRTBUFFER pDataOut) PURE;
2257 
2258 
2259  /* given the solution for PRT or light maps, computes transfer vector at arbitrary
2260  * position/normal pairs in space
2261  *
2262  * pSurfDataIn - input data
2263  * NumSamples - number of sample locations
2264  * pSampleLocs - position for each sample
2265  * pSampleNorms - normal for each sample
2266  * pDataOut - PRT Buffer that will store output results
2267  * pDataTotal - optional buffer to sum results into - can be NULL
2268  */
2269  STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn,
2270  UINT NumSamples,
2271  CONST D3DXVECTOR3 *pSampleLocs,
2272  CONST D3DXVECTOR3 *pSampleNorms,
2273  LPD3DXPRTBUFFER pDataOut,
2274  LPD3DXPRTBUFFER pDataTotal) PURE;
2275 
2276  /* Frees temporary data structures that can be created for subsurface scattering
2277  * this data is freed when the PRTComputeEngine is freed and is lazily created
2278  */
2279  STDMETHOD(FreeSSData)(THIS) PURE;
2280 
2281  /* Frees temporary data structures that can be created for bounce simulations
2282  * this data is freed when the PRTComputeEngine is freed and is lazily created
2283  */
2284  STDMETHOD(FreeBounceData)(THIS) PURE;
2285 
2286  /* This computes the Local Deformable PRT (LDPRT) coefficients relative to the
2287  * per sample normals that minimize error in a least squares sense with respect
2288  * to the input PRT data set. These coefficients can be used with skinned/transformed
2289  * normals to model global effects with dynamic objects. Shading normals can
2290  * optionally be solved for - these normals (along with the LDPRT coefficients) can
2291  * more accurately represent the PRT signal. The coefficients are for zonal
2292  * harmonics oriented in the normal/shading normal direction.
2293  *
2294  * pDataIn - SH PRT dataset that is input
2295  * SHOrder - Order of SH to compute conv coefficients for
2296  * pNormOut - Optional array of vectors (passed in) that will be filled with
2297  * "shading normals", LDPRT coefficients are optimized for
2298  * these normals. This array must be the same size as the number of
2299  * samples in pDataIn
2300  * pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample)
2301  */
2302  STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn,
2303  UINT SHOrder,
2304  D3DXVECTOR3 *pNormOut,
2305  LPD3DXPRTBUFFER pDataOut) PURE;
2306 
2307  /* scales all the samples associated with a given sub mesh
2308  * can be useful when using subsurface scattering
2309  * fScale - value to scale each vector in submesh by
2310  */
2311  STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE;
2312 
2313  /* mutliplies each PRT vector by the albedo - can be used if you want to have the albedo
2314  * burned into the dataset, often better not to do this. If this is not done the user
2315  * must mutliply the albedo themselves when rendering - just multiply the albedo times
2316  * the result of the PRT dot product.
2317  * If pDataOut is a texture simulation result and there is an albedo texture it
2318  * must be represented at the same resolution as the simulation buffer. You can use
2319  * LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must
2320  * be careful about how the gutters are handled.
2321  *
2322  * pDataOut - dataset that will get albedo pushed into it
2323  */
2324  STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE;
2325 
2326  /* Sets a pointer to an optional call back function that reports back to the
2327  * user percentage done and gives them the option of quitting
2328  * pCB - pointer to call back function, return S_OK for the simulation
2329  * to continue
2330  * Frequency - 1/Frequency is roughly the number of times the call back
2331  * will be invoked
2332  * lpUserContext - will be passed back to the users call back
2333  */
2334  STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE;
2335 
2336  /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function
2337  * takes into account settings from SetMinMaxIntersection. If the closest intersection
2338  * is not needed this function is more efficient compared to the ClosestRayIntersection
2339  * method.
2340  * pRayPos - origin of ray
2341  * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful)
2342  */
2343 
2344  STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE;
2345 
2346  /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an
2347  * intersection the closest face that was intersected and its first two barycentric coordinates
2348  * are returned. This function takes into account settings from SetMinMaxIntersection.
2349  * This is a slower function compared to ShadowRayIntersects and should only be used where
2350  * needed. The third vertices barycentric coordinates will be 1 - pU - pV.
2351  * pRayPos - origin of ray
2352  * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful)
2353  * pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh
2354  * faces before the faces from pMesh
2355  * pU - Barycentric coordinate for vertex 0
2356  * pV - Barycentric coordinate for vertex 1
2357  * pDist - Distance along ray where the intersection occured
2358  */
2359 
2360  STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir,
2361  DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE;
2362 };
2363 
2364 
2365 /* API functions for creating interfaces */
2366 
2367 #ifdef __cplusplus
2368 extern "C" {
2369 #endif /* __cplusplus */
2370 
2371 /*
2372  *
2373  * D3DXCreatePRTBuffer:
2374  * --------------------
2375  * Generates a PRT Buffer that can be compressed or filled by a simulator
2376  * This function should be used to create per-vertex or volume buffers.
2377  * When buffers are created all values are initialized to zero.
2378  *
2379  * Parameters:
2380  * NumSamples
2381  * Number of sample locations represented
2382  * NumCoeffs
2383  * Number of coefficients per sample location (order^2 for SH)
2384  * NumChannels
2385  * Number of color channels to represent (1 or 3)
2386  * ppBuffer
2387  * Buffer that will be allocated
2388  *
2389  */
2390 
2391 HRESULT WINAPI
2393  UINT NumSamples,
2394  UINT NumCoeffs,
2395  UINT NumChannels,
2396  LPD3DXPRTBUFFER* ppBuffer);
2397 
2398 /*
2399  *
2400  * D3DXCreatePRTBufferTex:
2401  * --------------------
2402  * Generates a PRT Buffer that can be compressed or filled by a simulator
2403  * This function should be used to create per-pixel buffers.
2404  * When buffers are created all values are initialized to zero.
2405  *
2406  * Parameters:
2407  * Width
2408  * Width of texture
2409  * Height
2410  * Height of texture
2411  * NumCoeffs
2412  * Number of coefficients per sample location (order^2 for SH)
2413  * NumChannels
2414  * Number of color channels to represent (1 or 3)
2415  * ppBuffer
2416  * Buffer that will be allocated
2417  *
2418  */
2419 
2420 HRESULT WINAPI
2422  UINT Width,
2423  UINT Height,
2424  UINT NumCoeffs,
2425  UINT NumChannels,
2426  LPD3DXPRTBUFFER* ppBuffer);
2427 
2428 /*
2429  *
2430  * D3DXLoadPRTBufferFromFile:
2431  * --------------------
2432  * Loads a PRT buffer that has been saved to disk.
2433  *
2434  * Parameters:
2435  * pFilename
2436  * Name of the file to load
2437  * ppBuffer
2438  * Buffer that will be allocated
2439  *
2440  */
2441 
2442 HRESULT WINAPI
2444  LPCSTR pFilename,
2445  LPD3DXPRTBUFFER* ppBuffer);
2446 
2447 HRESULT WINAPI
2449  LPCWSTR pFilename,
2450  LPD3DXPRTBUFFER* ppBuffer);
2451 
2452 #ifdef UNICODE
2453 #define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileW
2454 #else
2455 #define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileA
2456 #endif
2457 
2458 
2459 /*
2460  *
2461  * D3DXSavePRTBufferToFile:
2462  * --------------------
2463  * Saves a PRTBuffer to disk.
2464  *
2465  * Parameters:
2466  * pFilename
2467  * Name of the file to save
2468  * pBuffer
2469  * Buffer that will be saved
2470  *
2471  */
2472 
2473 HRESULT WINAPI
2475  LPCSTR pFileName,
2476  LPD3DXPRTBUFFER pBuffer);
2477 
2478 HRESULT WINAPI
2480  LPCWSTR pFileName,
2481  LPD3DXPRTBUFFER pBuffer);
2482 
2483 #ifdef UNICODE
2484 #define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileW
2485 #else
2486 #define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileA
2487 #endif
2488 
2489 
2490 /*
2491  *
2492  * D3DXLoadPRTCompBufferFromFile:
2493  * --------------------
2494  * Loads a PRTComp buffer that has been saved to disk.
2495  *
2496  * Parameters:
2497  * pFilename
2498  * Name of the file to load
2499  * ppBuffer
2500  * Buffer that will be allocated
2501  *
2502  */
2503 
2504 HRESULT WINAPI
2506  LPCSTR pFilename,
2507  LPD3DXPRTCOMPBUFFER* ppBuffer);
2508 
2509 HRESULT WINAPI
2511  LPCWSTR pFilename,
2512  LPD3DXPRTCOMPBUFFER* ppBuffer);
2513 
2514 #ifdef UNICODE
2515 #define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileW
2516 #else
2517 #define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA
2518 #endif
2519 
2520 /*
2521  *
2522  * D3DXSavePRTCompBufferToFile:
2523  * --------------------
2524  * Saves a PRTCompBuffer to disk.
2525  *
2526  * Parameters:
2527  * pFilename
2528  * Name of the file to save
2529  * pBuffer
2530  * Buffer that will be saved
2531  *
2532  */
2533 
2534 HRESULT WINAPI
2536  LPCSTR pFileName,
2537  LPD3DXPRTCOMPBUFFER pBuffer);
2538 
2539 HRESULT WINAPI
2541  LPCWSTR pFileName,
2542  LPD3DXPRTCOMPBUFFER pBuffer);
2543 
2544 #ifdef UNICODE
2545 #define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileW
2546 #else
2547 #define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA
2548 #endif
2549 
2550 /*
2551  *
2552  * D3DXCreatePRTCompBuffer:
2553  * --------------------
2554  * Compresses a PRT buffer (vertex or texel)
2555  *
2556  * Parameters:
2557  * D3DXSHCOMPRESSQUALITYTYPE
2558  * Quality of compression - low is faster (computes PCA per voronoi cluster)
2559  * high is slower but better quality (clusters based on distance to affine subspace)
2560  * NumClusters
2561  * Number of clusters to compute
2562  * NumPCA
2563  * Number of basis vectors to compute
2564  * pCB
2565  * Optional Callback function
2566  * lpUserContext
2567  * Optional user context
2568  * pBufferIn
2569  * Buffer that will be compressed
2570  * ppBufferOut
2571  * Compressed buffer that will be created
2572  *
2573  */
2574 
2575 
2576 HRESULT WINAPI
2578  D3DXSHCOMPRESSQUALITYTYPE Quality,
2579  UINT NumClusters,
2580  UINT NumPCA,
2581  LPD3DXSHPRTSIMCB pCB,
2582  LPVOID lpUserContext,
2583  LPD3DXPRTBUFFER pBufferIn,
2584  LPD3DXPRTCOMPBUFFER *ppBufferOut
2585  );
2586 
2587 /*
2588  *
2589  * D3DXCreateTextureGutterHelper:
2590  * --------------------
2591  * Generates a "GutterHelper" for a given set of meshes and texture
2592  * resolution
2593  *
2594  * Parameters:
2595  * Width
2596  * Width of texture
2597  * Height
2598  * Height of texture
2599  * pMesh
2600  * Mesh that represents the scene
2601  * GutterSize
2602  * Number of texels to over rasterize in texture space
2603  * this should be at least 1.0
2604  * ppBuffer
2605  * GutterHelper that will be created
2606  *
2607  *
2608  */
2609 
2610 
2611 HRESULT WINAPI
2613  UINT Width,
2614  UINT Height,
2615  LPD3DXMESH pMesh,
2616  FLOAT GutterSize,
2617  LPD3DXTEXTUREGUTTERHELPER* ppBuffer);
2618 
2619 
2620 /*
2621  *
2622  * D3DXCreatePRTEngine:
2623  * --------------------
2624  * Computes a PRTEngine which can efficiently generate PRT simulations
2625  * of a scene
2626  *
2627  * Parameters:
2628  * pMesh
2629  * Mesh that represents the scene - must have an AttributeTable
2630  * where vertices are in a unique attribute.
2631  * pAdjacency
2632  * Optional adjacency information
2633  * ExtractUVs
2634  * Set this to true if textures are going to be used for albedos
2635  * or to store PRT vectors
2636  * pBlockerMesh
2637  * Optional mesh that just blocks the scene
2638  * ppEngine
2639  * PRTEngine that will be created
2640  *
2641  */
2642 
2643 
2644 HRESULT WINAPI
2646  LPD3DXMESH pMesh,
2647  DWORD *pAdjacency,
2648  BOOL ExtractUVs,
2649  LPD3DXMESH pBlockerMesh,
2650  LPD3DXPRTENGINE* ppEngine);
2651 
2652 /*
2653  *
2654  * D3DXConcatenateMeshes:
2655  * --------------------
2656  * Concatenates a group of meshes into one common mesh. This can optionaly transform
2657  * each sub mesh or its texture coordinates. If no DECL is given it will
2658  * generate a union of all of the DECL's of the sub meshes, promoting channels
2659  * and types if neccesary. It will create an AttributeTable if possible, one can
2660  * call OptimizeMesh with attribute sort and compacting enabled to ensure this.
2661  *
2662  * Parameters:
2663  * ppMeshes
2664  * Array of pointers to meshes that can store PRT vectors
2665  * NumMeshes
2666  * Number of meshes
2667  * Options
2668  * Passed through to D3DXCreateMesh
2669  * pGeomXForms
2670  * [optional] Each sub mesh is transformed by the corresponding
2671  * matrix if this array is supplied
2672  * pTextureXForms
2673  * [optional] UV coordinates for each sub mesh are transformed
2674  * by corresponding matrix if supplied
2675  * pDecl
2676  * [optional] Only information in this DECL is used when merging
2677  * data
2678  * pD3DDevice
2679  * D3D device that is used to create the new mesh
2680  * ppMeshOut
2681  * Mesh that will be created
2682  *
2683  */
2684 
2685 
2686 HRESULT WINAPI
2688  LPD3DXMESH *ppMeshes,
2689  UINT NumMeshes,
2690  DWORD Options,
2691  CONST D3DXMATRIX *pGeomXForms,
2692  CONST D3DXMATRIX *pTextureXForms,
2693  CONST D3DVERTEXELEMENT9 *pDecl,
2694  LPDIRECT3DDEVICE9 pD3DDevice,
2695  LPD3DXMESH *ppMeshOut);
2696 
2697 /*
2698  *
2699  * D3DXSHPRTCompSuperCluster:
2700  * --------------------------
2701  * Used with compressed results of D3DXSHPRTSimulation.
2702  * Generates "super clusters" - groups of clusters that can be drawn in
2703  * the same draw call. A greedy algorithm that minimizes overdraw is used
2704  * to group the clusters.
2705  *
2706  * Parameters:
2707  * pClusterIDs
2708  * NumVerts cluster ID's (extracted from a compressed buffer)
2709  * pScene
2710  * Mesh that represents composite scene passed to the simulator
2711  * MaxNumClusters
2712  * Maximum number of clusters allocated per super cluster
2713  * NumClusters
2714  * Number of clusters computed in the simulator
2715  * pSuperClusterIDs
2716  * Array of length NumClusters, contains index of super cluster
2717  * that corresponding cluster was assigned to
2718  * pNumSuperClusters
2719  * Returns the number of super clusters allocated
2720  *
2721  */
2722 
2723 HRESULT WINAPI
2725  UINT *pClusterIDs,
2726  LPD3DXMESH pScene,
2727  UINT MaxNumClusters,
2728  UINT NumClusters,
2729  UINT *pSuperClusterIDs,
2730  UINT *pNumSuperClusters);
2731 
2732 /*
2733  *
2734  * D3DXSHPRTCompSplitMeshSC:
2735  * -------------------------
2736  * Used with compressed results of the vertex version of the PRT simulator.
2737  * After D3DXSHRTCompSuperCluster has been called this function can be used
2738  * to split the mesh into a group of faces/vertices per super cluster.
2739  * Each super cluster contains all of the faces that contain any vertex
2740  * classified in one of its clusters. All of the vertices connected to this
2741  * set of faces are also included with the returned array ppVertStatus
2742  * indicating whether or not the vertex belongs to the supercluster.
2743  *
2744  * Parameters:
2745  * pClusterIDs
2746  * NumVerts cluster ID's (extracted from a compressed buffer)
2747  * NumVertices
2748  * Number of vertices in original mesh
2749  * NumClusters
2750  * Number of clusters (input parameter to compression)
2751  * pSuperClusterIDs
2752  * Array of size NumClusters that will contain super cluster ID's (from
2753  * D3DXSHCompSuerCluster)
2754  * NumSuperClusters
2755  * Number of superclusters allocated in D3DXSHCompSuerCluster
2756  * pInputIB
2757  * Raw index buffer for mesh - format depends on bInputIBIs32Bit
2758  * InputIBIs32Bit
2759  * Indicates whether the input index buffer is 32-bit (otherwise 16-bit
2760  * is assumed)
2761  * NumFaces
2762  * Number of faces in the original mesh (pInputIB is 3 times this length)
2763  * ppIBData
2764  * LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces.
2765  * Format determined by bIBIs32Bit. Allocated by function
2766  * pIBDataLength
2767  * Length of ppIBData, assigned in function
2768  * OutputIBIs32Bit
2769  * Indicates whether the output index buffer is to be 32-bit (otherwise
2770  * 16-bit is assumed)
2771  * ppFaceRemap
2772  * LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is
2773  * *pIBDataLength/3. Optional paramter, allocated in function
2774  * ppVertData
2775  * LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength
2776  * pVertDataLength
2777  * Number of new vertices in split mesh. Assigned in function
2778  * pSCClusterList
2779  * Array of length NumClusters which pSCData indexes into (Cluster* fields)
2780  * for each SC, contains clusters sorted by super cluster
2781  * pSCData
2782  * Structure per super cluster - contains indices into ppIBData,
2783  * pSCClusterList and ppVertData
2784  *
2785  */
2786 
2787 HRESULT WINAPI
2789  UINT *pClusterIDs,
2790  UINT NumVertices,
2791  UINT NumClusters,
2792  UINT *pSuperClusterIDs,
2793  UINT NumSuperClusters,
2794  LPVOID pInputIB,
2795  BOOL InputIBIs32Bit,
2796  UINT NumFaces,
2797  LPD3DXBUFFER *ppIBData,
2798  UINT *pIBDataLength,
2799  BOOL OutputIBIs32Bit,
2800  LPD3DXBUFFER *ppFaceRemap,
2801  LPD3DXBUFFER *ppVertData,
2802  UINT *pVertDataLength,
2803  UINT *pSCClusterList,
2805 
2806 
2807 #ifdef __cplusplus
2808 }
2809 #endif /* __cplusplus */
2810 
2811 /*
2812  *
2813  * Definitions of .X file templates used by mesh load/save functions
2814  * that are not RM standard
2815  */
2816 
2817 /* {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} */
2818 DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader,
2819 0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2);
2820 
2821 /* {B8D65549-D7C9-4995-89CF-53A9A8B031E3} */
2822 DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices,
2823 0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3);
2824 
2825 /* {A64C844A-E282-4756-8B80-250CDE04398C} */
2826 DEFINE_GUID(DXFILEOBJ_FaceAdjacency,
2827 0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c);
2828 
2829 /* {6F0D123B-BAD2-4167-A0D0-80224F25FABB} */
2830 DEFINE_GUID(DXFILEOBJ_SkinWeights,
2831 0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb);
2832 
2833 /* {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} */
2834 DEFINE_GUID(DXFILEOBJ_Patch,
2835 0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6);
2836 
2837 /* {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} */
2838 DEFINE_GUID(DXFILEOBJ_PatchMesh,
2839 0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf);
2840 
2841 /* {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} */
2842 DEFINE_GUID(DXFILEOBJ_PatchMesh9,
2843 0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea);
2844 
2845 /* {B6C3E656-EC8B-4b92-9B62-681659522947} */
2846 DEFINE_GUID(DXFILEOBJ_PMInfo,
2847 0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47);
2848 
2849 /* {917E0427-C61E-4a14-9C64-AFE65F9E9844} */
2850 DEFINE_GUID(DXFILEOBJ_PMAttributeRange,
2851 0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44);
2852 
2853 /* {574CCC14-F0B3-4333-822D-93E8A8A08E4C} */
2854 DEFINE_GUID(DXFILEOBJ_PMVSplitRecord,
2855 0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c);
2856 
2857 /* {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} */
2858 DEFINE_GUID(DXFILEOBJ_FVFData,
2859 0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97);
2860 
2861 /* {F752461C-1E23-48f6-B9F8-8350850F336F} */
2862 DEFINE_GUID(DXFILEOBJ_VertexElement,
2863 0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f);
2864 
2865 /* {BF22E553-292C-4781-9FEA-62BD554BDD93} */
2866 DEFINE_GUID(DXFILEOBJ_DeclData,
2867 0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93);
2868 
2869 /* {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} */
2870 DEFINE_GUID(DXFILEOBJ_EffectFloats,
2871 0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d);
2872 
2873 /* {D55B097E-BDB6-4c52-B03D-6051C89D0E42} */
2874 DEFINE_GUID(DXFILEOBJ_EffectString,
2875 0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42);
2876 
2877 /* {622C0ED0-956E-4da9-908A-2AF94F3CE716} */
2878 DEFINE_GUID(DXFILEOBJ_EffectDWord,
2879 0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16);
2880 
2881 /* {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} */
2882 DEFINE_GUID(DXFILEOBJ_EffectParamFloats,
2883 0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b);
2884 
2885 /* {1DBC4C88-94C1-46ee-9076-2C28818C9481} */
2886 DEFINE_GUID(DXFILEOBJ_EffectParamString,
2887 0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81);
2888 
2889 /* {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} */
2890 DEFINE_GUID(DXFILEOBJ_EffectParamDWord,
2891 0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5);
2892 
2893 /* {E331F7E4-0559-4cc2-8E99-1CEC1657928F} */
2894 DEFINE_GUID(DXFILEOBJ_EffectInstance,
2895 0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f);
2896 
2897 /* {9E415A43-7BA6-4a73-8743-B73D47E88476} */
2898 DEFINE_GUID(DXFILEOBJ_AnimTicksPerSecond,
2899 0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76);
2900 
2901 /* {7F9B00B3-F125-4890-876E-1CFFBF697C4D} */
2902 DEFINE_GUID(DXFILEOBJ_CompressedAnimationSet,
2903 0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d);
2904 
2905 #pragma pack(push, 1)
2907 {
2913 #pragma pack(pop)
2914 
2915 #define XSKINEXP_TEMPLATES \
2916  "xof 0303txt 0032\
2917  template XSkinMeshHeader \
2918  { \
2919  <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \
2920  WORD nMaxSkinWeightsPerVertex; \
2921  WORD nMaxSkinWeightsPerFace; \
2922  WORD nBones; \
2923  } \
2924  template VertexDuplicationIndices \
2925  { \
2926  <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \
2927  DWORD nIndices; \
2928  DWORD nOriginalVertices; \
2929  array DWORD indices[nIndices]; \
2930  } \
2931  template FaceAdjacency \
2932  { \
2933  <A64C844A-E282-4756-8B80-250CDE04398C> \
2934  DWORD nIndices; \
2935  array DWORD indices[nIndices]; \
2936  } \
2937  template SkinWeights \
2938  { \
2939  <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \
2940  STRING transformNodeName; \
2941  DWORD nWeights; \
2942  array DWORD vertexIndices[nWeights]; \
2943  array float weights[nWeights]; \
2944  Matrix4x4 matrixOffset; \
2945  } \
2946  template Patch \
2947  { \
2948  <A3EB5D44-FC22-429D-9AFB-3221CB9719A6> \
2949  DWORD nControlIndices; \
2950  array DWORD controlIndices[nControlIndices]; \
2951  } \
2952  template PatchMesh \
2953  { \
2954  <D02C95CC-EDBA-4305-9B5D-1820D7704BBF> \
2955  DWORD nVertices; \
2956  array Vector vertices[nVertices]; \
2957  DWORD nPatches; \
2958  array Patch patches[nPatches]; \
2959  [ ... ] \
2960  } \
2961  template PatchMesh9 \
2962  { \
2963  <B9EC94E1-B9A6-4251-BA18-94893F02C0EA> \
2964  DWORD Type; \
2965  DWORD Degree; \
2966  DWORD Basis; \
2967  DWORD nVertices; \
2968  array Vector vertices[nVertices]; \
2969  DWORD nPatches; \
2970  array Patch patches[nPatches]; \
2971  [ ... ] \
2972  } " \
2973  "template EffectFloats \
2974  { \
2975  <F1CFE2B3-0DE3-4e28-AFA1-155A750A282D> \
2976  DWORD nFloats; \
2977  array float Floats[nFloats]; \
2978  } \
2979  template EffectString \
2980  { \
2981  <D55B097E-BDB6-4c52-B03D-6051C89D0E42> \
2982  STRING Value; \
2983  } \
2984  template EffectDWord \
2985  { \
2986  <622C0ED0-956E-4da9-908A-2AF94F3CE716> \
2987  DWORD Value; \
2988  } " \
2989  "template EffectParamFloats \
2990  { \
2991  <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \
2992  STRING ParamName; \
2993  DWORD nFloats; \
2994  array float Floats[nFloats]; \
2995  } " \
2996  "template EffectParamString \
2997  { \
2998  <1DBC4C88-94C1-46ee-9076-2C28818C9481> \
2999  STRING ParamName; \
3000  STRING Value; \
3001  } \
3002  template EffectParamDWord \
3003  { \
3004  <E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5> \
3005  STRING ParamName; \
3006  DWORD Value; \
3007  } \
3008  template EffectInstance \
3009  { \
3010  <E331F7E4-0559-4cc2-8E99-1CEC1657928F> \
3011  STRING EffectFilename; \
3012  [ ... ] \
3013  } " \
3014  "template AnimTicksPerSecond \
3015  { \
3016  <9E415A43-7BA6-4a73-8743-B73D47E88476> \
3017  DWORD AnimTicksPerSecond; \
3018  } \
3019  template CompressedAnimationSet \
3020  { \
3021  <7F9B00B3-F125-4890-876E-1C42BF697C4D> \
3022  DWORD CompressedBlockSize; \
3023  FLOAT TicksPerSec; \
3024  DWORD PlaybackType; \
3025  DWORD BufferLength; \
3026  array DWORD CompressedData[BufferLength]; \
3027  } "
3028 
3029 #define XEXTENSIONS_TEMPLATES \
3030  "xof 0303txt 0032\
3031  template FVFData \
3032  { \
3033  <B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897> \
3034  DWORD dwFVF; \
3035  DWORD nDWords; \
3036  array DWORD data[nDWords]; \
3037  } \
3038  template VertexElement \
3039  { \
3040  <F752461C-1E23-48f6-B9F8-8350850F336F> \
3041  DWORD Type; \
3042  DWORD Method; \
3043  DWORD Usage; \
3044  DWORD UsageIndex; \
3045  } \
3046  template DeclData \
3047  { \
3048  <BF22E553-292C-4781-9FEA-62BD554BDD93> \
3049  DWORD nElements; \
3050  array VertexElement Elements[nElements]; \
3051  DWORD nDWords; \
3052  array DWORD data[nDWords]; \
3053  } \
3054  template PMAttributeRange \
3055  { \
3056  <917E0427-C61E-4a14-9C64-AFE65F9E9844> \
3057  DWORD iFaceOffset; \
3058  DWORD nFacesMin; \
3059  DWORD nFacesMax; \
3060  DWORD iVertexOffset; \
3061  DWORD nVerticesMin; \
3062  DWORD nVerticesMax; \
3063  } \
3064  template PMVSplitRecord \
3065  { \
3066  <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \
3067  DWORD iFaceCLW; \
3068  DWORD iVlrOffset; \
3069  DWORD iCode; \
3070  } \
3071  template PMInfo \
3072  { \
3073  <B6C3E656-EC8B-4b92-9B62-681659522947> \
3074  DWORD nAttributes; \
3075  array PMAttributeRange attributeRanges[nAttributes]; \
3076  DWORD nMaxValence; \
3077  DWORD nMinLogicalVertices; \
3078  DWORD nMaxLogicalVertices; \
3079  DWORD nVSplits; \
3080  array PMVSplitRecord splitRecords[nVSplits]; \
3081  DWORD nAttributeMispredicts; \
3082  array DWORD attributeMispredicts[nAttributeMispredicts]; \
3083  } "
3084 
3085 #endif /*__D3DX9MESH_H__ */
DWORD AttribId
Definition: d3dx8mesh.h:87
HRESULT WINAPI D3DXCleanMesh(D3DXCLEANTYPE CleanType, LPD3DXMESH pMeshIn, CONST DWORD *pAdjacencyIn, LPD3DXMESH *ppMeshOut, DWORD *pAdjacencyOut, LPD3DXBUFFER *ppErrorsAndWarnings)
DWORD NumDefaults
Definition: d3dx9mesh.h:193
FLOAT Binormal
Definition: d3dx9mesh.h:241
Definition: d3dx8mesh.h:336
Definition: d3dx9mesh.h:1597
struct _D3DXBONECOMBINATION * LPD3DXBONECOMBINATION
HRESULT WINAPI D3DXCreateTextureGutterHelper(UINT Width, UINT Height, LPD3DXMESH pMesh, FLOAT GutterSize, LPD3DXTEXTUREGUTTERHELPER *ppBuffer)
HRESULT WINAPI D3DXCreateSkinInfoFromBlendedMesh(LPD3DXBASEMESH pMesh, DWORD NumBones, CONST D3DXBONECOMBINATION *pBoneCombinationTable, LPD3DXSKININFO *ppSkinInfo)
Definition: d3dx9mesh.h:130
Definition: d3dx9mesh.h:44
HRESULT WINAPI D3DXCreateSkinInfoFVF(DWORD NumVertices, DWORD FVF, DWORD NumBones, LPD3DXSKININFO *ppSkinInfo)
Definition: d3dx9mesh.h:62
Definition: d3dx9mesh.h:103
enum _D3DXEFFECTDEFAULTTYPE D3DXEFFECTDEFAULTTYPE
HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, UINT uMaxChartNumber, FLOAT fMaxStretch, DWORD dwTextureIndex, CONST DWORD *pdwAdjacency, CONST DWORD *pdwFalseEdgeAdjacency, CONST FLOAT *pfIMTArray, LPD3DXUVATLASCB pStatusCallback, FLOAT fCallbackFrequency, LPVOID pUserContext, DWORD dwOptions, LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppFacePartitioning, LPD3DXBUFFER *ppVertexRemapArray, LPD3DXBUFFER *ppPartitionResultAdjacency, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut)
Definition: d3dx9mesh.h:118
HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal(LPD3DXMESH pMesh, CONST FLOAT *pfVertexSignal, UINT uSignalDimension, UINT uSignalStride, DWORD dwOptions, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData)
UINT WINAPI D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl)
Definition: d3dx9mesh.h:81
HRESULT WINAPI D3DXCreateSkinInfo(DWORD NumVertices, CONST D3DVERTEXELEMENT9 *pDeclaration, DWORD NumBones, LPD3DXSKININFO *ppSkinInfo)
Definition: d3dx9mesh.h:61
_D3DXCLEANTYPE
Definition: d3dx9mesh.h:91
LPSTR pTextureFilename
Definition: d3dx9mesh.h:169
HRESULT WINAPI D3DXComputeIMTFromTexture(LPD3DXMESH pMesh, LPDIRECT3DTEXTURE9 pTexture, DWORD dwTextureIndex, DWORD dwOptions, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData)
enum _D3DTEXTUREFILTERTYPE D3DTEXTUREFILTERTYPE
struct _D3DXATTRIBUTERANGE D3DXATTRIBUTERANGE
DWORD BufferLength
Definition: d3dx9mesh.h:2911
Definition: d3d8types.h:77
enum _D3DTEXTUREADDRESS D3DTEXTUREADDRESS
D3DXPATCHMESHTYPE PatchType
Definition: d3dx9mesh.h:479
Definition: d3d8types.h:48
UINT uVertStart
Definition: d3dx9mesh.h:1608
Definition: d3dx9mesh.h:43
BOOL bSubSurf
Definition: d3dx9mesh.h:1583
struct _XFILECOMPRESSEDANIMATIONSET XFILECOMPRESSEDANIMATIONSET
struct IDirect3DBaseTexture9 * LPDIRECT3DBASETEXTURE9
Definition: d3d9.h:949
UINT uSubCluster
Definition: d3dx9mesh.h:1599
HRESULT WINAPI D3DXTessellateNPatches(LPD3DXMESH pMeshIn, CONST DWORD *pAdjacencyIn, FLOAT NumSegs, BOOL QuadraticInterpNormals, LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppAdjacencyOut)
Definition: glslang_tab.cpp:129
D3DXEFFECTDEFAULTTYPE Type
Definition: d3dx9mesh.h:185
BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *p0, CONST D3DXVECTOR3 *p1, CONST D3DXVECTOR3 *p2, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, FLOAT *pU, FLOAT *pV, FLOAT *pDist)
D3DCOLORVALUE Diffuse
Definition: d3dx9mesh.h:1581
HRESULT WINAPI D3DXCreatePRTEngine(LPD3DXMESH pMesh, DWORD *pAdjacency, BOOL ExtractUVs, LPD3DXMESH pBlockerMesh, LPD3DXPRTENGINE *ppEngine)
Definition: d3dx9mesh.h:1560
UCHAR ucVertStatus
Definition: d3dx9mesh.h:1600
struct _D3DXSHMATERIAL D3DXSHMATERIAL
Definition: d3dx9mesh.h:1565
Definition: d3dx9mesh.h:65
HRESULT WINAPI D3DXOptimizeFaces(LPCVOID pbIndices, UINT cFaces, UINT cVertices, BOOL b32BitIndices, DWORD *pFaceRemap)
Definition: d3dx9mesh.h:109
FLOAT Specular
Definition: d3dx9mesh.h:237
FLOAT Texcoord[8]
Definition: d3dx9mesh.h:239
HRESULT WINAPI D3DXSavePRTCompBufferToFileW(LPCWSTR pFileName, LPD3DXPRTCOMPBUFFER pBuffer)
HRESULT WINAPI D3DXTriPatchSize(CONST FLOAT *pfNumSegs, DWORD *pdwTriangles, DWORD *pdwVertices)
Definition: d3dx9mesh.h:55
GLfixed GLfixed x2
Definition: glsym_gl.h:1051
HRESULT WINAPI D3DXLoadPRTCompBufferFromFileA(LPCSTR pFilename, LPD3DXPRTCOMPBUFFER *ppBuffer)
LPSTR pParamName
Definition: d3dx9mesh.h:184
Definition: d3dx9mesh.h:129
_D3DXEFFECTDEFAULTTYPE
Definition: d3dx9mesh.h:173
enum _D3DXPATCHMESHTYPE D3DXPATCHMESHTYPE
enum _D3DXUVATLAS D3DXUVATLAS
Definition: d3dx9mesh.h:74
HRESULT WINAPI D3DXIntersect(LPD3DXBASEMESH pMesh, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, BOOL *pHit, DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist, LPD3DXBUFFER *ppAllHits, DWORD *pCountOfHits)
const GLbyte * weights
Definition: glext.h:7190
Definition: d3dx9mesh.h:96
Definition: d3dx9mesh.h:114
Definition: d3dx9mesh.h:67
enum _D3DXIMT D3DXIMT
HRESULT WINAPI D3DXLoadSkinMeshFromXof(LPD3DXFILEDATA pxofMesh, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pMatOut, LPD3DXSKININFO *ppSkinInfo, LPD3DXMESH *ppMesh)
HRESULT(WINAPI * LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext)
Definition: d3dx9mesh.h:1623
HRESULT WINAPI D3DXTessellateRectPatch(LPDIRECT3DVERTEXBUFFER9 pVB, CONST FLOAT *pNumSegs, CONST D3DVERTEXELEMENT9 *pdwInDecl, CONST D3DRECTPATCH_INFO *pRectPatchInfo, LPD3DXMESH pMesh)
UINT uVertLength
Definition: d3dx9mesh.h:1609
HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pFirstPosition, DWORD NumVertices, DWORD dwStride, D3DXVECTOR3 *pMin, D3DXVECTOR3 *pMax)
HRESULT WINAPI D3DXConcatenateMeshes(LPD3DXMESH *ppMeshes, UINT NumMeshes, DWORD Options, CONST D3DXMATRIX *pGeomXForms, CONST D3DXMATRIX *pTextureXForms, CONST D3DVERTEXELEMENT9 *pDecl, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH *ppMeshOut)
interface ID3DXPRTBuffer ID3DXPRTBuffer
Definition: d3dx9mesh.h:1647
struct ID3DXPMesh * LPD3DXPMESH
Definition: d3dx8mesh.h:81
_D3DXMESH
Definition: d3dx8mesh.h:37
_D3DXPATCHMESHTYPE
Definition: d3dx9mesh.h:40
Definition: d3dx9mesh.h:116
Definition: d3dx9mesh.h:42
Definition: d3dx9mesh.h:177
HRESULT WINAPI D3DXLoadPRTBufferFromFileW(LPCWSTR pFilename, LPD3DXPRTBUFFER *ppBuffer)
HRESULT WINAPI D3DXRectPatchSize(CONST FLOAT *pfNumSegs, DWORD *pdwTriangles, DWORD *pdwVertices)
HRESULT WINAPI D3DXSavePRTBufferToFileA(LPCSTR pFileName, LPD3DXPRTBUFFER pBuffer)
typedef HRESULT(WINAPI *PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(_In_ const D3D12_ROOT_SIGNATURE_DESC *pRootSignature
Definition: d3dx9mesh.h:211
DWORD PlaybackType
Definition: d3dx9mesh.h:2910
DWORD FaceStart
Definition: d3dx8mesh.h:88
UINT uFaceStart
Definition: d3dx9mesh.h:1611
FLOAT Specular
Definition: d3dx8mesh.h:115
_D3DXIMT
Definition: d3dx9mesh.h:126
D3DDEGREETYPE Degree
Definition: d3dx9mesh.h:480
Definition: d3dx9mesh.h:445
interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper
Definition: d3dx9mesh.h:1646
_MAX_FVF_DECL_SIZE
Definition: d3dx8mesh.h:74
HRESULT WINAPI D3DXCreateNPatchMesh(LPD3DXMESH pMeshSysMem, LPD3DXPATCHMESH *pPatchMesh)
_D3DXSHGPUSIMOPT
Definition: d3dx9mesh.h:1564
GLuint GLuint GLfloat weight
Definition: glext.h:12626
HRESULT WINAPI D3DXGenerateOutputDecl(D3DVERTEXELEMENT9 *pOutput, CONST D3DVERTEXELEMENT9 *pInput)
DWORD NumBytes
Definition: d3dx9mesh.h:186
struct ID3DXSkinInfo * LPD3DXSKININFO
Definition: d3dx9mesh.h:149
HRESULT WINAPI D3DXCreateMeshFVF(DWORD NumFaces, DWORD NumVertices, DWORD Options, DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH *ppMesh)
FLOAT RelativeIndexOfRefraction
Definition: d3dx9mesh.h:1586
enum _D3DDEGREETYPE D3DDEGREETYPE
struct ID3DXSPMesh * LPD3DXSPMESH
Definition: d3dx9mesh.h:148
HRESULT WINAPI D3DXSHPRTCompSuperCluster(UINT *pClusterIDs, LPD3DXMESH pScene, UINT MaxNumClusters, UINT NumClusters, UINT *pSuperClusterIDs, UINT *pNumSuperClusters)
interface ID3DXPRTCompBuffer ID3DXPRTCompBuffer
Definition: d3dx9mesh.h:1712
Definition: d3dx9mesh.h:444
struct _D3DXPATCHINFO D3DXPATCHINFO
Definition: d3dx9mesh.h:1561
HRESULT WINAPI D3DXComputeIMTFromSignal(LPD3DXMESH pMesh, DWORD dwTextureIndex, UINT uSignalDimension, FLOAT fMaxUVDistance, DWORD dwOptions, LPD3DXIMTSIGNALCALLBACK pSignalCallback, VOID *pUserData, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData)
Definition: d3dx9mesh.h:447
BOOL bMirror
Definition: d3dx9mesh.h:1582
enum _D3DXCLEANTYPE D3DXCLEANTYPE
HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3 *pFirstPosition, DWORD NumVertices, DWORD dwStride, D3DXVECTOR3 *pCenter, FLOAT *pRadius)
struct _D3DXINTERSECTINFO D3DXINTERSECTINFO
Definition: d3dx9mesh.h:53
Definition: d3dx9mesh.h:1559
HRESULT WINAPI D3DXWeldVertices(LPD3DXMESH pMesh, DWORD Flags, CONST D3DXWELDEPSILONS *pEpsilons, CONST DWORD *pAdjacencyIn, DWORD *pAdjacencyOut, DWORD *pFaceRemap, LPD3DXBUFFER *ppVertexRemap)
UINT uFaceLength
Definition: d3dx9mesh.h:1612
HRESULT WINAPI D3DXSaveMeshToXW(LPCWSTR pFilename, LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST D3DXMATERIAL *pMaterials, CONST D3DXEFFECTINSTANCE *pEffectInstances, DWORD NumMaterials, DWORD Format)
Definition: d3dx8math.h:127
struct _D3DXEFFECTDEFAULT D3DXEFFECTDEFAULT
struct ID3DXSPMesh * LPD3DXSPMESH
Definition: d3dx8mesh.h:82
struct _D3DXATTRIBUTEWEIGHTS D3DXATTRIBUTEWEIGHTS
Definition: d3dx9mesh.h:75
_D3DXPATCHMESH
Definition: d3dx9mesh.h:80
D3DCOLORVALUE Absorption
Definition: d3dx9mesh.h:1587
DWORD FaceIndex
Definition: d3dx8mesh.h:635
struct IDirect3DIndexBuffer9 * LPDIRECT3DINDEXBUFFER9
Definition: d3d9.h:1335
UINT uClusterStart
Definition: d3dx9mesh.h:1614
Definition: d3dx9mesh.h:56
Definition: d3dx9mesh.h:140
struct IDirect3DVertexBuffer9 * LPDIRECT3DVERTEXBUFFER9
Definition: d3d9.h:1274
DWORD VertexStart
Definition: d3dx8mesh.h:341
Definition: d3dx9mesh.h:448
Definition: d3dx9mesh.h:113
Definition: d3dx9mesh.h:97
Definition: d3dx9mesh.h:112
HRESULT WINAPI D3DXLoadPRTBufferFromFileA(LPCSTR pFilename, LPD3DXPRTBUFFER *ppBuffer)
struct _D3DXMATERIAL D3DXMATERIAL
HRESULT(WINAPI * LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext)
Definition: d3dx9mesh.h:1162
FLOAT Position
Definition: d3dx9mesh.h:231
Definition: d3dx9mesh.h:222
_D3DXWELDEPSILONSFLAGS
Definition: d3dx8mesh.h:121
FLOAT PSize
Definition: d3dx9mesh.h:236
Definition: d3dx9mesh.h:1570
struct _D3DXSHPRTSPLITMESHCLUSTERDATA D3DXSHPRTSPLITMESHCLUSTERDATA
struct _D3DXBONECOMBINATION D3DXBONECOMBINATION
HRESULT WINAPI D3DXConvertMeshSubsetToSingleStrip(LPD3DXBASEMESH MeshIn, DWORD AttribId, DWORD IBOptions, LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, DWORD *pNumIndices)
LPVOID pValue
Definition: d3dx9mesh.h:187
_D3DXSHCOMPRESSQUALITYTYPE
Definition: d3dx9mesh.h:1558
FLOAT Position
Definition: d3dx8mesh.h:111
Definition: d3dx9mesh.h:60
Definition: d3dx9mesh.h:1568
Definition: d3dx9mesh.h:128
DWORD FaceCount
Definition: d3dx8mesh.h:340
DWORD FaceStart
Definition: d3dx8mesh.h:339
FLOAT Diffuse
Definition: d3dx8mesh.h:114
HRESULT WINAPI D3DXLoadPatchMeshFromXof(LPD3DXFILEDATA pXofObjMesh, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, PDWORD pNumMaterials, LPD3DXPATCHMESH *ppMesh)
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
_D3DXUVATLAS
Definition: d3dx9mesh.h:138
Definition: d3dx8mesh.h:99
Definition: d3dx9mesh.h:190
DWORD FaceCount
Definition: d3dx8mesh.h:89
LPSTR pEffectFilename
Definition: d3dx9mesh.h:192
HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, UINT uMaxChartNumber, FLOAT fMaxStretch, UINT uWidth, UINT uHeight, FLOAT fGutter, DWORD dwTextureIndex, CONST DWORD *pdwAdjacency, CONST DWORD *pdwFalseEdgeAdjacency, CONST FLOAT *pfIMTArray, LPD3DXUVATLASCB pStatusCallback, FLOAT fCallbackFrequency, LPVOID pUserContext, DWORD dwOptions, LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppFacePartitioning, LPD3DXBUFFER *ppVertexRemapArray, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut)
Definition: d3d9types.h:159
Definition: d3dx9mesh.h:115
HRESULT WINAPI D3DXSplitMesh(LPD3DXMESH pMeshIn, CONST DWORD *pAdjacencyIn, CONST DWORD MaxSize, CONST DWORD Options, DWORD *pMeshesOut, LPD3DXBUFFER *ppMeshArrayOut, LPD3DXBUFFER *ppAdjacencyArrayOut, LPD3DXBUFFER *ppFaceRemapArrayOut, LPD3DXBUFFER *ppVertRemapArrayOut)
D3DXWELDEPSILONS * LPD3DXWELDEPSILONS
Definition: d3dx9mesh.h:245
Definition: d3dx9mesh.h:54
DWORD VertexCount
Definition: d3dx8mesh.h:342
Definition: d3dx9mesh.h:111
HRESULT WINAPI D3DXSavePRTBufferToFileW(LPCWSTR pFileName, LPD3DXPRTBUFFER pBuffer)
_D3DXMESHOPT
Definition: d3dx8mesh.h:325
float4 p1
Definition: notHere.h:1
DWORD * BoneId
Definition: d3dx8mesh.h:343
HRESULT WINAPI D3DXLoadPRTCompBufferFromFileW(LPCWSTR pFilename, LPD3DXPRTCOMPBUFFER *ppBuffer)
DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown)
Definition: d3dx9mesh.h:251
DWORD CompressedBlockSize
Definition: d3dx9mesh.h:2908
enum _D3DXSHCOMPRESSQUALITYTYPE D3DXSHCOMPRESSQUALITYTYPE
Definition: d3dx9mesh.h:72
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD FVF, D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE])
Definition: d3dx9mesh.h:2906
HRESULT WINAPI D3DXCreatePRTCompBuffer(D3DXSHCOMPRESSQUALITYTYPE Quality, UINT NumClusters, UINT NumPCA, LPD3DXSHPRTSIMCB pCB, LPVOID lpUserContext, LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTCOMPBUFFER *ppBufferOut)
DWORD VertexCount
Definition: d3dx8mesh.h:91
HRESULT WINAPI D3DXSHPRTCompSplitMeshSC(UINT *pClusterIDs, UINT NumVertices, UINT NumClusters, UINT *pSuperClusterIDs, UINT NumSuperClusters, LPVOID pInputIB, BOOL InputIBIs32Bit, UINT NumFaces, LPD3DXBUFFER *ppIBData, UINT *pIBDataLength, BOOL OutputIBIs32Bit, LPD3DXBUFFER *ppFaceRemap, LPD3DXBUFFER *ppVertData, UINT *pVertDataLength, UINT *pSCClusterList, D3DXSHPRTSPLITMESHCLUSTERDATA *pSCData)
D3DCOLORVALUE ReducedScattering
Definition: d3dx9mesh.h:1588
Definition: d3dx9mesh.h:46
struct ID3DXMesh * LPD3DXMESH
Definition: d3dx9mesh.h:146
DEFINE_GUID(IID_ID3DXBaseMesh, 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30)
FLOAT Binormal
Definition: d3dx9mesh.h:206
FLOAT Texcoord[8]
Definition: d3dx9mesh.h:204
FLOAT Boundary
Definition: d3dx8mesh.h:112
Definition: d3dx9mesh.h:57
Definition: d3dx9mesh.h:1567
enum _D3DXSHGPUSIMOPT D3DXSHGPUSIMOPT
struct IDirect3DTexture9 * LPDIRECT3DTEXTURE9
Definition: d3d9.h:1025
HRESULT WINAPI D3DXGeneratePMesh(LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, CONST FLOAT *pVertexWeights, DWORD MinValue, DWORD Options, LPD3DXPMESH *ppPMesh)
Definition: d3dx9mesh.h:176
HRESULT WINAPI D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, DWORD *dwcDegenerateVertices, DWORD *dwcDegeneratePatches, LPD3DXBUFFER *ppErrorsAndWarnings)
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *pMin, CONST D3DXVECTOR3 *pMax, CONST D3DXVECTOR3 *pRayPosition, CONST D3DXVECTOR3 *pRayDirection)
Definition: d3dx9mesh.h:73
struct _D3DXSHPRTSPLITMESHVERTDATA D3DXSHPRTSPLITMESHVERTDATA
struct _D3DXEFFECTINSTANCE * LPD3DXEFFECTINSTANCE
HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh, DWORD dwOptions)
FLOAT BlendWeights
Definition: d3dx9mesh.h:234
enum _D3DDECLUSAGE D3DDECLUSAGE
HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, UINT uWidth, UINT uHeight, FLOAT fGutter, DWORD dwTextureIndex, CONST DWORD *pdwPartitionResultAdjacency, LPD3DXUVATLASCB pStatusCallback, FLOAT fCallbackFrequency, LPVOID pUserContext, DWORD dwOptions, LPD3DXBUFFER pFacePartitioning)
HRESULT WINAPI D3DXCreateMesh(DWORD NumFaces, DWORD NumVertices, DWORD Options, CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH *ppMesh)
HRESULT WINAPI D3DXSavePRTCompBufferToFileA(LPCSTR pFileName, LPD3DXPRTCOMPBUFFER pBuffer)
Definition: d3dx9mesh.h:179
DWORD VertexStart
Definition: d3dx8mesh.h:90
enum _D3DBASISTYPE D3DBASISTYPE
HRESULT WINAPI D3DXLoadMeshFromXA(LPCSTR pFilename, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXMESH *ppMesh)
struct ID3DXBaseMesh * LPD3DXBASEMESH
Definition: d3dx9mesh.h:145
struct ID3DXPMesh * LPD3DXPMESH
Definition: d3dx9mesh.h:147
HRESULT WINAPI D3DXTessellateTriPatch(LPDIRECT3DVERTEXBUFFER9 pVB, CONST FLOAT *pNumSegs, CONST D3DVERTEXELEMENT9 *pInDecl, CONST D3DTRIPATCH_INFO *pTriPatchInfo, LPD3DXMESH pMesh)
HRESULT WINAPI D3DXCreatePRTBuffer(UINT NumSamples, UINT NumCoeffs, UINT NumChannels, LPD3DXPRTBUFFER *ppBuffer)
UINT uClusterLength
Definition: d3dx9mesh.h:1615
interface ID3DXBuffer ID3DXBuffer
Definition: d3dx8core.h:28
static INLINE ULONG Release(void *object)
Definition: dxgi_common.h:253
Definition: d3dx8math.h:40
interface ID3DXTextureGutterHelper * LPD3DXTEXTUREGUTTERHELPER
Definition: d3dx9mesh.h:151
unsigned int BOOL
Definition: gctypes.h:51
Definition: d3dx9mesh.h:64
struct IDirect3DDevice9 * LPDIRECT3DDEVICE9
Definition: d3d9.h:442
Definition: d3dx9mesh.h:450
HRESULT WINAPI D3DXCreateSPMesh(LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, CONST FLOAT *pVertexWeights, LPD3DXSPMESH *ppSMesh)
HRESULT WINAPI D3DXLoadMeshFromXInMemory(LPCVOID Memory, DWORD SizeOfMemory, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXMESH *ppMesh)
D3DXMATERIAL * LPD3DXMATERIAL
Definition: d3dx9mesh.h:171
Definition: d3dx9mesh.h:59
HRESULT WINAPI D3DXIntersectSubset(LPD3DXBASEMESH pMesh, DWORD AttribId, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, BOOL *pHit, DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist, LPD3DXBUFFER *ppAllHits, DWORD *pCountOfHits)
interface ID3DXBuffer * LPD3DXBUFFER
Definition: d3dx8core.h:29
struct _D3DXEFFECTDEFAULT * LPD3DXEFFECTDEFAULT
Definition: d3dx9mesh.h:1572
interface ID3DXPRTCompBuffer * LPD3DXPRTCOMPBUFFER
Definition: d3dx9mesh.h:1715
Definition: main.cpp:442
struct _D3DXWELDEPSILONS D3DXWELDEPSILONS
Definition: d3dx9mesh.h:119
Definition: d3dx9mesh.h:51
float4 p2
Definition: local.h:1
D3DBASISTYPE Basis
Definition: d3dx9mesh.h:481
Definition: d3dx9mesh.h:69
HRESULT WINAPI D3DXComputeNormals(LPD3DXBASEMESH pMesh, CONST DWORD *pAdjacency)
BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *pCenter, FLOAT Radius, CONST D3DXVECTOR3 *pRayPosition, CONST D3DXVECTOR3 *pRayDirection)
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)
FLOAT Dist
Definition: d3dx8mesh.h:638
Definition: d3dx9mesh.h:93
Definition: d3dx9mesh.h:108
Definition: d3dx8mesh.h:133
Definition: d3dx9mesh.h:1580
enum _D3DXTANGENT D3DXTANGENT
Definition: d3d9types.h:761
FLOAT Normal
Definition: d3dx8mesh.h:113
HRESULT WINAPI D3DXSimplifyMesh(LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, CONST FLOAT *pVertexWeights, DWORD MinValue, DWORD Options, LPD3DXMESH *ppMesh)
Definition: d3dx9mesh.h:142
Definition: d3dx8mesh.h:85
Format
Definition: vulkan.hpp:7957
Definition: d3dx9mesh.h:182
Definition: d3dx9mesh.h:92
FLOAT Tangent
Definition: d3dx9mesh.h:205
Definition: glslang_tab.cpp:136
HRESULT WINAPI D3DXOptimizeVertices(LPCVOID pbIndices, UINT cFaces, UINT cVertices, BOOL b32BitIndices, DWORD *pVertexRemap)
Definition: d3dx9mesh.h:175
HRESULT WINAPI D3DXFVFFromDeclarator(CONST D3DVERTEXELEMENT9 *pDeclarator, DWORD *pFVF)
FLOAT TicksPerSec
Definition: d3dx9mesh.h:2909
Definition: d3dx9mesh.h:52
HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, DWORD TexStage, DWORD TangentIndex, DWORD BinormIndex, DWORD Wrap, CONST DWORD *pAdjacency)
Definition: glslang_tab.cpp:133
HRESULT WINAPI D3DXLoadMeshFromXResource(HMODULE Module, LPCSTR Name, LPCSTR Type, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXMESH *ppMesh)
Definition: Context.h:13
interface ID3DXPRTEngine * LPD3DXPRTENGINE
Definition: d3dx9mesh.h:1916
HRESULT WINAPI D3DXCreatePMeshFromStream(IStream *pStream, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXPMESH *ppPMesh)
UINT uVertRemap
Definition: d3dx9mesh.h:1598
struct _D3DXATTRIBUTEWEIGHTS * LPD3DXATTRIBUTEWEIGHTS
#define MAXD3DDECLLENGTH
Definition: d3d9types.h:717
Definition: d3d8types.h:1549
interface ID3DXPRTEngine ID3DXPRTEngine
Definition: d3dx9mesh.h:1912
UINT WINAPI D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl, DWORD Stream)
Type
Type of JSON value.
Definition: rapidjson.h:603
struct ID3DXBaseMesh * LPD3DXBASEMESH
Definition: d3dx8mesh.h:79
FLOAT Normal
Definition: d3dx8mesh.h:136
struct _D3DXINTERSECTINFO * LPD3DXINTERSECTINFO
Definition: d3dx9mesh.h:217
Definition: d3dx9mesh.h:58
struct _D3DXPATCHINFO * LPD3DXPATCHINFO
LPD3DXEFFECTDEFAULT pDefaults
Definition: d3dx9mesh.h:194
Definition: d3dx9mesh.h:98
Definition: d3dx8mesh.h:633
DWORD AttribId
Definition: d3dx8mesh.h:338
Definition: d3dx9mesh.h:1607
Definition: d3dx9mesh.h:88
HRESULT WINAPI D3DXSaveMeshToXA(LPCSTR pFilename, LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST D3DXMATERIAL *pMaterials, CONST D3DXEFFECTINSTANCE *pEffectInstances, DWORD NumMaterials, DWORD Format)
HRESULT WINAPI D3DXCreatePatchMesh(CONST D3DXPATCHINFO *pInfo, DWORD dwNumPatches, DWORD dwNumVertices, DWORD dwOptions, CONST D3DVERTEXELEMENT9 *pDecl, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPATCHMESH *pPatchMesh)
Definition: d3dx9mesh.h:446
FLOAT TessFactor
Definition: d3dx9mesh.h:242
HRESULT WINAPI D3DXLoadMeshFromXW(LPCWSTR pFilename, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXMESH *ppMesh)
HRESULT(WINAPI * LPD3DXIMTSIGNALCALLBACK)(CONST D3DXVECTOR2 *uv, UINT uPrimitiveID, UINT uSignalDimension, VOID *pUserData, FLOAT *pfSignalOut)
Definition: d3dx9mesh.h:1352
HRESULT WINAPI D3DXLoadMeshFromXof(LPD3DXFILEDATA pxofMesh, DWORD Options, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXBUFFER *ppAdjacency, LPD3DXBUFFER *ppMaterials, LPD3DXBUFFER *ppEffectInstances, DWORD *pNumMaterials, LPD3DXMESH *ppMesh)
_D3DXMESHSIMP
Definition: d3dx8mesh.h:68
FLOAT Tangent
Definition: d3dx9mesh.h:240
FLOAT Diffuse
Definition: d3dx9mesh.h:238
HRESULT WINAPI D3DXCreatePRTBufferTex(UINT Width, UINT Height, UINT NumCoeffs, UINT NumChannels, LPD3DXPRTBUFFER *ppBuffer)
#define VOID(p)
Definition: luac.c:224
Definition: d3dx8mesh.h:109
Definition: d3dx9mesh.h:477
GLbitfield flags
Definition: glext.h:7828
_D3DXTANGENT
Definition: d3dx9mesh.h:106
D3DXATTRIBUTERANGE * LPD3DXATTRIBUTERANGE
Definition: d3dx9mesh.h:164
FLOAT V
Definition: d3dx8mesh.h:637
Definition: d3dx8math.h:402
Definition: d3dx9mesh.h:166
struct _D3DXEFFECTINSTANCE D3DXEFFECTINSTANCE
HRESULT WINAPI D3DXCreateBuffer(DWORD NumBytes, LPD3DXBUFFER *ppBuffer)
int Options
Definition: StandAlone.cpp:153
Definition: d3dx9mesh.h:117
Definition: d3dx9mesh.h:1566
struct ID3DXMesh * LPD3DXMESH
Definition: d3dx8mesh.h:80
Definition: d3dx9mesh.h:110
Definition: d3dx9mesh.h:141
Definition: d3dx9mesh.h:63
The text renderer interface represents a set of application-defined callbacks that perform rendering ...
Definition: d3d8types.h:57
struct ID3DXPatchMesh * LPD3DXPATCHMESH
Definition: d3dx9mesh.h:150
Definition: d3dx9mesh.h:87
HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal(LPD3DXMESH pMesh, DWORD dwTextureIndex, FLOAT *pfTexelSignal, UINT uWidth, UINT uHeight, UINT uSignalDimension, UINT uComponents, DWORD dwOptions, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData)
interface ID3DXPRTBuffer * LPD3DXPRTBUFFER
Definition: d3dx9mesh.h:152
HRESULT WINAPI D3DXValidMesh(LPD3DXMESH pMeshIn, CONST DWORD *pAdjacency, LPD3DXBUFFER *ppErrorsAndWarnings)
Definition: d3d8types.h:1538
Definition: d3dx9mesh.h:213
HRESULT WINAPI D3DXConvertMeshSubsetToStrips(LPD3DXBASEMESH MeshIn, DWORD AttribId, DWORD IBOptions, LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, DWORD *pNumIndices, LPD3DXBUFFER *ppStripLengths, DWORD *pNumStrips)
Definition: d3dx9mesh.h:449
Definition: d3dx9mesh.h:76
FLOAT U
Definition: d3dx8mesh.h:636
D3DMATERIAL9 MatD3D
Definition: d3dx9mesh.h:168