1 // D3DX Types and Constants ---------------------------------------------------------------------------------------
2 
3 module win32.directx.d3dx9;
4 version(Windows):
5 
6 public import win32.directx.d3d9;
7 public import win32.windows;
8 
9 alias D3DMATRIX D3DXMATRIX;
10 
11 const uint MAXD3DDECLLENGTH = 64;
12 const uint MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1;
13 
14 align(4) struct D3DXATTRIBUTERANGE
15 {
16     DWORD AttribId;
17     DWORD FaceStart;
18     DWORD FaceCount;
19     DWORD VertexStart;
20     DWORD VertexCount;
21 }
22 
23 align(4) struct D3DXVECTOR2
24 {
25 	float x = 0, y = 0;
26 
27 	static D3DXVECTOR2 opCall(float x, float y)
28 	{
29 		D3DXVECTOR2 v;
30 		v.x = x;
31 		v.y = y;
32 		return v;
33 	}
34 }
35 
36 alias D3DVECTOR D3DXVECTOR3;
37 
38 align(4) struct D3DXVECTOR4
39 {
40 	float x = 0, y = 0, z = 0, w = 0;
41 
42 	static D3DXVECTOR4 opCall(float x, float y, float z, float w)
43 	{
44 		D3DXVECTOR4 v;
45 		v.x = x;
46 		v.y = y;
47 		v.z = z;
48 		v.w = w;
49 		return v;
50 	}
51 }
52 
53 align(4) struct D3DXQUATERNION
54 {
55 	float x = 0, y = 0, z = 0, w = 0;
56 }
57 
58 align(4) struct D3DXFRAME
59 {
60     LPSTR                   Name;
61     D3DXMATRIX              TransformationMatrix;
62 
63     D3DXMESHCONTAINER*     pMeshContainer;
64 
65     D3DXFRAME       *pFrameSibling;
66     D3DXFRAME       *pFrameFirstChild;
67 }
68 
69 align(4) struct D3DXMESHCONTAINER
70 {
71     LPSTR                   Name;
72 
73     D3DXMESHDATA            MeshData;
74 
75     D3DXMATERIAL*          pMaterials;
76     D3DXEFFECTINSTANCE*    pEffects;
77     DWORD                   NumMaterials;
78     DWORD                  *pAdjacency;
79 
80     ID3DXSkinInfo          pSkinInfo;
81 
82     D3DXMESHCONTAINER* pNextMeshContainer;
83 }
84 
85 align(4) struct D3DXMESHDATA
86 {
87     D3DXMESHDATATYPE Type;
88 
89     // current mesh data interface
90     union
91     {
92         ID3DXMesh              pMesh;
93         ID3DXPMesh             pPMesh;
94         ID3DXPatchMesh         pPatchMesh;
95     }
96 }
97 
98 alias uint D3DXMESHDATATYPE;
99 enum : uint
100 {
101     D3DXMESHTYPE_MESH      = 0x001,             // Normal ID3DXMesh data
102     D3DXMESHTYPE_PMESH     = 0x002,             // Progressive Mesh - ID3DXPMesh
103     D3DXMESHTYPE_PATCHMESH = 0x003             // Patch Mesh - ID3DXPatchMesh
104 }
105 
106 align(4) struct D3DXMATERIAL
107 {
108     D3DMATERIAL9  MatD3D;
109     LPSTR         pTextureFilename;
110 }
111 
112 alias uint D3DXEFFECTDEFAULTTYPE;
113 enum : uint
114 {
115     D3DXEDT_STRING = 0x1,       // pValue points to a null terminated ASCII string
116     D3DXEDT_FLOATS = 0x2,       // pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
117     D3DXEDT_DWORD  = 0x3       // pValue points to a DWORD
118 }
119 
120 align(4) struct D3DXEFFECTDEFAULT
121 {
122     LPSTR                 pParamName;
123     D3DXEFFECTDEFAULTTYPE Type;           // type of the data pointed to by pValue
124     DWORD                 NumBytes;       // size in bytes of the data pointed to by pValue
125     LPVOID                pValue;         // data for the default of the effect
126 }
127 
128 align(4) struct D3DXEFFECTINSTANCE
129 {
130     LPSTR               pEffectFilename;
131     DWORD               NumDefaults;
132     D3DXEFFECTDEFAULT* pDefaults;
133 }
134 
135 alias uint D3DXPATCHMESHTYPE;
136 enum : uint
137 {
138     D3DXPATCHMESH_RECT   = 0x001,
139     D3DXPATCHMESH_TRI    = 0x002,
140     D3DXPATCHMESH_NPATCH = 0x003
141 }
142 
143 align(4) struct D3DXPATCHINFO
144 {
145     D3DXPATCHMESHTYPE PatchType;
146     D3DDEGREETYPE Degree;
147     D3DBASISTYPE Basis;
148 }
149 
150 const uint LF_FACESIZE = 32;
151 
152 align(4) struct D3DXFONT_DESCA
153 {
154     INT Height;
155     UINT Width;
156     UINT Weight;
157     UINT MipLevels;
158     BOOL Italic;
159     BYTE CharSet;
160     BYTE OutputPrecision;
161     BYTE Quality;
162     BYTE PitchAndFamily;
163     CHAR[LF_FACESIZE] FaceName;
164 }
165 
166 align(4) struct D3DXFONT_DESCW
167 {
168     INT Height;
169     UINT Width;
170     UINT Weight;
171     UINT MipLevels;
172     BOOL Italic;
173     BYTE CharSet;
174     BYTE OutputPrecision;
175     BYTE Quality;
176     BYTE PitchAndFamily;
177     WCHAR[LF_FACESIZE] FaceName;
178 }
179 
180 align(4) struct TEXTMETRICA
181 {
182     LONG        tmHeight;
183     LONG        tmAscent;
184     LONG        tmDescent;
185     LONG        tmInternalLeading;
186     LONG        tmExternalLeading;
187     LONG        tmAveCharWidth;
188     LONG        tmMaxCharWidth;
189     LONG        tmWeight;
190     LONG        tmOverhang;
191     LONG        tmDigitizedAspectX;
192     LONG        tmDigitizedAspectY;
193     BYTE        tmFirstChar;
194     BYTE        tmLastChar;
195     BYTE        tmDefaultChar;
196     BYTE        tmBreakChar;
197     BYTE        tmItalic;
198     BYTE        tmUnderlined;
199     BYTE        tmStruckOut;
200     BYTE        tmPitchAndFamily;
201     BYTE        tmCharSet;
202 }
203 
204 align(4) struct TEXTMETRICW
205 {
206     LONG        tmHeight;
207     LONG        tmAscent;
208     LONG        tmDescent;
209     LONG        tmInternalLeading;
210     LONG        tmExternalLeading;
211     LONG        tmAveCharWidth;
212     LONG        tmMaxCharWidth;
213     LONG        tmWeight;
214     LONG        tmOverhang;
215     LONG        tmDigitizedAspectX;
216     LONG        tmDigitizedAspectY;
217     WCHAR       tmFirstChar;
218     WCHAR       tmLastChar;
219     WCHAR       tmDefaultChar;
220     WCHAR       tmBreakChar;
221     BYTE        tmItalic;
222     BYTE        tmUnderlined;
223     BYTE        tmStruckOut;
224     BYTE        tmPitchAndFamily;
225     BYTE        tmCharSet;
226 }
227 
228 align(4) struct D3DXEFFECT_DESC
229 {
230     LPCSTR Creator;                     // Creator string
231     UINT Parameters;                    // Number of parameters
232     UINT Techniques;                    // Number of techniques
233     UINT Functions;                     // Number of function entrypoints
234 }
235 
236 alias char* D3DXHANDLE;
237 
238 align(4) struct D3DXPARAMETER_DESC
239 {
240     LPCSTR Name;                        // Parameter name
241     LPCSTR Semantic;                    // Parameter semantic
242     D3DXPARAMETER_CLASS Class;          // Class
243     D3DXPARAMETER_TYPE Type;            // Component type
244     UINT Rows;                          // Number of rows
245     UINT Columns;                       // Number of columns
246     UINT Elements;                      // Number of array elements
247     UINT Annotations;                   // Number of annotations
248     UINT StructMembers;                 // Number of structure member sub-parameters
249     DWORD Flags;                        // D3DX_PARAMETER_* flags
250     UINT Bytes;                         // Parameter size, in bytes
251 }
252 
253 alias uint D3DXPARAMETER_CLASS;
254 enum : uint
255 {
256     D3DXPC_SCALAR,
257     D3DXPC_VECTOR,
258     D3DXPC_MATRIX_ROWS,
259     D3DXPC_MATRIX_COLUMNS,
260     D3DXPC_OBJECT,
261     D3DXPC_STRUCT
262 }
263 
264 alias uint D3DXPARAMETER_TYPE;
265 enum : uint
266 {
267     D3DXPT_VOID,
268     D3DXPT_BOOL,
269     D3DXPT_INT,
270     D3DXPT_FLOAT,
271     D3DXPT_STRING,
272     D3DXPT_TEXTURE,
273     D3DXPT_TEXTURE1D,
274     D3DXPT_TEXTURE2D,
275     D3DXPT_TEXTURE3D,
276     D3DXPT_TEXTURECUBE,
277     D3DXPT_SAMPLER,
278     D3DXPT_SAMPLER1D,
279     D3DXPT_SAMPLER2D,
280     D3DXPT_SAMPLER3D,
281     D3DXPT_SAMPLERCUBE,
282     D3DXPT_PIXELSHADER,
283     D3DXPT_VERTEXSHADER,
284     D3DXPT_PIXELFRAGMENT,
285     D3DXPT_VERTEXFRAGMENT
286 }
287 
288 align(4) struct D3DXTECHNIQUE_DESC
289 {
290     LPCSTR Name;                        // Technique name
291     UINT Passes;                        // Number of passes
292     UINT Annotations;                   // Number of annotations
293 }
294 
295 align(4) struct D3DXPASS_DESC
296 {
297     LPCSTR Name;                        // Pass name
298     UINT Annotations;                   // Number of annotations
299 
300     DWORD *pVertexShaderFunction; // Vertex shader function
301     DWORD *pPixelShaderFunction;  // Pixel shader function
302 }
303 
304 align(4) struct D3DXFUNCTION_DESC
305 {
306     LPCSTR Name;                        // Function name
307     UINT Annotations;                   // Number of annotations
308 }
309 
310 struct D3DXTRACK_DESC
311 {
312     DWORD Priority;
313     FLOAT Weight = 0;
314     FLOAT Speed = 0;
315     double Position = 0;
316     BOOL Enable;
317 }
318 
319 align(4) struct D3DXEVENT_DESC
320 {
321     DWORD      Type;
322     UINT                Track;
323     double              StartTime = 0;
324     double              Duration = 0;
325     DWORD Transition;
326     union
327     {
328         FLOAT           Weight = 0;
329         FLOAT           Speed;
330         double          Position;
331         BOOL            Enable;
332     };
333 }
334 
335 align(4) struct D3DXKEY_VECTOR3
336 {
337     FLOAT Time = 0;
338     D3DXVECTOR3 Value;
339 }
340 
341 align(4) struct D3DXKEY_QUATERNION
342 {
343     FLOAT Time = 0;
344     D3DXQUATERNION Value;
345 }
346 
347 align(4) struct D3DXKEY_CALLBACK
348 {
349     FLOAT Time = 0;
350     LPVOID pCallbackData;
351 }
352 
353 align(4) struct D3DXIMAGE_INFO
354 {
355     UINT                    Width;
356     UINT                    Height;
357     UINT                    Depth;
358     UINT                    MipLevels;
359     D3DFORMAT               Format;
360     D3DRESOURCETYPE         ResourceType;
361     D3DXIMAGE_FILEFORMAT    ImageFileFormat;
362 }
363 
364 alias uint D3DXIMAGE_FILEFORMAT;
365 enum : uint
366 {
367     D3DXIFF_BMP         = 0,
368     D3DXIFF_JPG         = 1,
369     D3DXIFF_TGA         = 2,
370     D3DXIFF_PNG         = 3,
371     D3DXIFF_DDS         = 4,
372     D3DXIFF_PPM         = 5,
373     D3DXIFF_DIB         = 6,
374 }
375 
376 align(4) struct D3DXATTRIBUTEWEIGHTS
377 {
378     FLOAT Position = 0;
379     FLOAT Boundary = 0;
380     FLOAT Normal = 0;
381     FLOAT Diffuse = 0;
382     FLOAT Specular = 0;
383     FLOAT Texcoord[8] = 0;
384     FLOAT Tangent = 0;
385     FLOAT Binormal = 0;
386 }
387 
388 align(4) struct D3DXPLANE
389 {
390 	FLOAT a = 0, b = 0, c = 0, d = 0;
391 }
392 
393 alias uint D3DXMESH;
394 enum : uint
395 {
396     D3DXMESH_32BIT                  = 0x001,
397     D3DXMESH_DONOTCLIP              = 0x002,
398     D3DXMESH_POINTS                 = 0x004,
399     D3DXMESH_RTPATCHES              = 0x008,
400     D3DXMESH_NPATCHES               = 0x4000,
401     D3DXMESH_VB_SYSTEMMEM           = 0x010,
402     D3DXMESH_VB_MANAGED             = 0x020,
403     D3DXMESH_VB_WRITEONLY           = 0x040,
404     D3DXMESH_VB_DYNAMIC             = 0x080,
405     D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000,
406     D3DXMESH_IB_SYSTEMMEM           = 0x100,
407     D3DXMESH_IB_MANAGED             = 0x200,
408     D3DXMESH_IB_WRITEONLY           = 0x400,
409     D3DXMESH_IB_DYNAMIC             = 0x800,
410     D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000,
411     D3DXMESH_VB_SHARE               = 0x1000,
412     D3DXMESH_USEHWONLY              = 0x2000,
413     D3DXMESH_SYSTEMMEM              = 0x110,
414     D3DXMESH_MANAGED                = 0x220,
415     D3DXMESH_WRITEONLY              = 0x440,
416     D3DXMESH_DYNAMIC                = 0x880,
417     D3DXMESH_SOFTWAREPROCESSING   = 0x18000,
418 }
419 
420 align(4) struct D3DXMACRO
421 {
422     LPCSTR Name;
423     LPCSTR Definition;
424 }
425 
426 align(4) struct D3DXSEMANTIC
427 {
428     UINT Usage;
429     UINT UsageIndex;
430 }
431 
432 alias uint D3DXINCLUDE_TYPE;
433 enum : uint
434 {
435     D3DXINC_LOCAL,
436     D3DXINC_SYSTEM,
437 }
438 
439 enum : uint
440 {
441 	D3DXFX_DONOTSAVESTATE         = (1 << 0),
442 	D3DXFX_DONOTSAVESHADERSTATE   = (1 << 1),
443 	D3DXFX_DONOTSAVESAMPLERSTATE  = (1 << 2),
444 	D3DXFX_NOT_CLONEABLE          = (1 << 11)
445 }
446 
447 alias uint D3DXMESHSIMP;
448 enum : uint
449 {
450     D3DXMESHSIMP_VERTEX   = 0x1,
451     D3DXMESHSIMP_FACE     = 0x2
452 }
453 
454 enum : uint
455 {
456 	DT_TOP                      = 0x00000000,
457 	DT_LEFT                     = 0x00000000,
458 	DT_CENTER                   = 0x00000001,
459 	DT_RIGHT                    = 0x00000002,
460 	DT_VCENTER                  = 0x00000004,
461 	DT_BOTTOM                   = 0x00000008,
462 	DT_WORDBREAK                = 0x00000010,
463 	DT_SINGLELINE               = 0x00000020,
464 	DT_EXPANDTABS               = 0x00000040,
465 	DT_TABSTOP                  = 0x00000080,
466 	DT_NOCLIP                   = 0x00000100,
467 	DT_EXTERNALLEADING          = 0x00000200,
468 	DT_CALCRECT                 = 0x00000400,
469 	DT_NOPREFIX                 = 0x00000800,
470 	DT_INTERNAL                 = 0x00001000
471 }
472 
473 enum : uint
474 {
475 	D3DXSPRITE_DONOTSAVESTATE               = (1 << 0),
476 	D3DXSPRITE_DONOTMODIFY_RENDERSTATE      = (1 << 1),
477 	D3DXSPRITE_OBJECTSPACE                  = (1 << 2),
478 	D3DXSPRITE_BILLBOARD                    = (1 << 3),
479 	D3DXSPRITE_ALPHABLEND                   = (1 << 4),
480 	D3DXSPRITE_SORT_TEXTURE                 = (1 << 5),
481 	D3DXSPRITE_SORT_DEPTH_FRONTTOBACK       = (1 << 6),
482 	D3DXSPRITE_SORT_DEPTH_BACKTOFRONT       = (1 << 7)
483 }
484 
485 enum : uint
486 {
487 	D3DX_FILTER_NONE             = (1 << 0),
488 	D3DX_FILTER_POINT            = (2 << 0),
489 	D3DX_FILTER_LINEAR           = (3 << 0),
490 	D3DX_FILTER_TRIANGLE         = (4 << 0),
491 	D3DX_FILTER_BOX              = (5 << 0),
492 	D3DX_FILTER_MIRROR_U         = (1 << 16),
493 	D3DX_FILTER_MIRROR_V         = (2 << 16),
494 	D3DX_FILTER_MIRROR_W         = (4 << 16),
495 	D3DX_FILTER_MIRROR           = (7 << 16),
496 	D3DX_FILTER_DITHER           = (1 << 19),
497 	D3DX_FILTER_DITHER_DIFFUSION = (2 << 19),
498 	D3DX_FILTER_SRGB_IN          = (1 << 21),
499 	D3DX_FILTER_SRGB_OUT         = (2 << 21),
500 	D3DX_FILTER_SRGB             = (3 << 21)
501 }
502 
503 const uint D3DX_DEFAULT            = cast(UINT) -1;
504 
505 alias uint D3DXMESHOPT;
506 enum : uint
507 {
508     D3DXMESHOPT_COMPACT       = 0x01000000,
509     D3DXMESHOPT_ATTRSORT      = 0x02000000,
510     D3DXMESHOPT_VERTEXCACHE   = 0x04000000,
511     D3DXMESHOPT_STRIPREORDER  = 0x08000000,
512     D3DXMESHOPT_IGNOREVERTS   = 0x10000000,  // optimize faces only, don't touch vertices
513     D3DXMESHOPT_DONOTSPLIT    = 0x20000000,  // do not split vertices shared between attribute groups when attribute sorting
514     D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000  // Only affects VCache.  uses a static known good cache size for all cards
515 }
516 
517 enum : uint
518 {
519     D3DXPLAY_LOOP = 0,
520     D3DXPLAY_ONCE = 1,
521     D3DXPLAY_PINGPONG = 2
522 }
523 alias uint D3DXPLAYBACK_TYPE;
524 
525 
526 // D3DX Interfaces ---------------------------------------------------------------------------------------
527 
528 interface ID3DXSkinInfo : IUnknown
529 {
530 	extern(Windows):
531 
532     // Specify the which vertices do each bones influence and by how much
533     HRESULT SetBoneInfluence(DWORD bone, DWORD numInfluences, DWORD* vertices, FLOAT* weights);
534 	HRESULT SetBoneVertexInfluence(DWORD boneNum, DWORD influenceNum, float weight);
535     DWORD GetNumBoneInfluences(DWORD bone);
536 	HRESULT GetBoneInfluence(DWORD bone, DWORD* vertices, FLOAT* weights);
537 	HRESULT GetBoneVertexInfluence(DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum);
538     HRESULT GetMaxVertexInfluences(DWORD* maxVertexInfluences);
539     DWORD GetNumBones();
540 	HRESULT FindBoneVertexInfluenceIndex(DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex);
541 
542     // This gets the max face influences based on a triangle mesh with the specified index buffer
543     HRESULT GetMaxFaceInfluences(IDirect3DIndexBuffer9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences);
544 
545     // Set min bone influence. Bone influences that are smaller than this are ignored
546     HRESULT SetMinBoneInfluence(FLOAT MinInfl);
547     // Get min bone influence.
548     FLOAT GetMinBoneInfluence();
549 
550     // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
551     HRESULT SetBoneName(DWORD Bone, LPCSTR pName); // pName is copied to an internal string buffer
552     LPCSTR GetBoneName(DWORD Bone); // A pointer to an internal string buffer is returned. Do not free this.
553 
554     // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
555     HRESULT SetBoneOffsetMatrix(DWORD Bone, D3DXMATRIX *pBoneTransform); // pBoneTransform is copied to an internal buffer
556     D3DXMATRIX* GetBoneOffsetMatrix(DWORD Bone); // A pointer to an internal matrix is returned. Do not free this.
557 
558     // Clone a skin info object
559     HRESULT Clone(ID3DXSkinInfo* ppSkinInfo);
560 
561     // Update bone influence information to match vertices after they are reordered. This should be called
562     // if the target vertex buffer has been reordered externally.
563     HRESULT Remap(DWORD NumVertices, DWORD* pVertexRemap);
564 
565     // These methods enable the modification of the vertex layout of the vertices that will be skinned
566     HRESULT SetFVF(DWORD FVF);
567     HRESULT SetDeclaration(D3DVERTEXELEMENT9 *pDeclaration);
568     DWORD GetFVF();
569     HRESULT GetDeclaration(D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]);
570 
571     // Apply SW skinning based on current pose matrices to the target vertices.
572     HRESULT UpdateSkinnedMesh(
573         D3DXMATRIX* pBoneTransforms,
574         D3DXMATRIX* pBoneInvTransposeTransforms,
575         LPCVOID pVerticesSrc,
576         PVOID pVerticesDst);
577 
578     // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
579     // table that describes which bones affect which subsets of the mesh
580     HRESULT ConvertToBlendedMesh(
581         ID3DXMesh pMesh,
582         DWORD Options,
583         DWORD *pAdjacencyIn,
584         LPDWORD pAdjacencyOut,
585         DWORD* pFaceRemap,
586         ID3DXBuffer* ppVertexRemap,
587         DWORD* pMaxFaceInfl,
588         DWORD* pNumBoneCombinations,
589         ID3DXBuffer* ppBoneCombinationTable,
590         ID3DXMesh* ppMesh);
591 
592     // Takes a mesh and returns a new mesh with per vertex blend weights and indices
593     // and a bone combination table that describes which bones palettes affect which subsets of the mesh
594     HRESULT ConvertToIndexedBlendedMesh(
595         ID3DXMesh pMesh,
596         DWORD Options,
597         DWORD paletteSize,
598         DWORD *pAdjacencyIn,
599         LPDWORD pAdjacencyOut,
600         DWORD* pFaceRemap,
601         ID3DXBuffer* ppVertexRemap,
602         DWORD* pMaxVertexInfl,
603 		DWORD *pNumBoneCombinations,
604         ID3DXBuffer* ppBoneCombinationTable,
605         ID3DXMesh* ppMesh);
606 }
607 
608 interface ID3DXBaseMesh : IUnknown
609 {
610     extern(Windows):
611 
612     // ID3DXBaseMesh
613     HRESULT DrawSubset( DWORD AttribId) ;
614     DWORD GetNumFaces() ;
615     DWORD GetNumVertices() ;
616     DWORD GetFVF() ;
617     HRESULT GetDeclaration( D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) ;
618     DWORD GetNumBytesPerVertex() ;
619     DWORD GetOptions() ;
620     HRESULT GetDevice( IDirect3DDevice9* ppDevice) ;
621     HRESULT CloneMeshFVF( DWORD Options,
622                 DWORD FVF, IDirect3DDevice9 pD3DDevice, ID3DXMesh* ppCloneMesh) ;
623     HRESULT CloneMesh( DWORD Options,
624                  D3DVERTEXELEMENT9 *pDeclaration, IDirect3DDevice9 pD3DDevice, ID3DXMesh* ppCloneMesh) ;
625     HRESULT GetVertexBuffer( IDirect3DVertexBuffer9* ppVB) ;
626     HRESULT GetIndexBuffer( IDirect3DIndexBuffer9* ppIB) ;
627     HRESULT LockVertexBuffer( DWORD Flags, LPVOID *ppData) ;
628     HRESULT UnlockVertexBuffer() ;
629     HRESULT LockIndexBuffer( DWORD Flags, LPVOID *ppData) ;
630     HRESULT UnlockIndexBuffer() ;
631     HRESULT GetAttributeTable(
632                  D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) ;
633 
634     HRESULT ConvertPointRepsToAdjacency(  DWORD* pPRep, DWORD* pAdjacency) ;
635     HRESULT ConvertAdjacencyToPointReps(  DWORD* pAdjacency, DWORD* pPRep) ;
636     HRESULT GenerateAdjacency( FLOAT Epsilon, DWORD* pAdjacency) ;
637 
638     HRESULT UpdateSemantics( D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) ;
639 }
640 
641 interface ID3DXMesh : ID3DXBaseMesh
642 {
643     extern(Windows):
644 
645     // ID3DXMesh
646     HRESULT LockAttributeBuffer( DWORD Flags, DWORD** ppData) ;
647     HRESULT UnlockAttributeBuffer() ;
648     HRESULT Optimize( DWORD Flags,  DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
649                      DWORD* pFaceRemap, ID3DXBuffer *ppVertexRemap,
650                      ID3DXMesh* ppOptMesh) ;
651     HRESULT OptimizeInplace( DWORD Flags,  DWORD* pAdjacencyIn, DWORD* pAdjacencyOut,
652                      DWORD* pFaceRemap, ID3DXBuffer *ppVertexRemap) ;
653     HRESULT SetAttributeTable(  D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) ;
654 }
655 
656 interface ID3DXBuffer : IUnknown
657 {
658     extern(Windows):
659 
660     // ID3DXBuffer
661     LPVOID GetBufferPointer();
662     DWORD GetBufferSize();
663 }
664 
665 interface ID3DXPMesh : ID3DXBaseMesh
666 {
667     extern(Windows):
668 
669     // ID3DXPMesh
670     HRESULT ClonePMeshFVF( DWORD Options,
671                 DWORD FVF, IDirect3DDevice9 pD3DDevice, ID3DXPMesh* ppCloneMesh) ;
672     HRESULT ClonePMesh( DWORD Options,
673                  D3DVERTEXELEMENT9 *pDeclaration, IDirect3DDevice9 pD3DDevice, ID3DXPMesh* ppCloneMesh) ;
674     HRESULT SetNumFaces( DWORD Faces) ;
675     HRESULT SetNumVertices( DWORD Vertices) ;
676     DWORD GetMaxFaces() ;
677     DWORD GetMinFaces() ;
678     DWORD GetMaxVertices() ;
679     DWORD GetMinVertices() ;
680     HRESULT Save( void *pStream,  D3DXMATERIAL* pMaterials,  D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) ;
681 
682     HRESULT Optimize( DWORD Flags, DWORD* pAdjacencyOut,
683                      DWORD* pFaceRemap, ID3DXBuffer *ppVertexRemap,
684                      ID3DXMesh* ppOptMesh) ;
685 
686     HRESULT OptimizeBaseLOD( DWORD Flags, DWORD* pFaceRemap) ;
687     HRESULT TrimByFaces( DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) ;
688     HRESULT TrimByVertices( DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) ;
689 
690     HRESULT GetAdjacency( DWORD* pAdjacency) ;
691 
692     //  Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit.  Allows generation of geomorphs
693     //     Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh
694     HRESULT GenerateVertexHistory( DWORD* pVertexHistory) ;
695 }
696 
697 interface ID3DXPatchMesh : IUnknown
698 {
699     extern(Windows):
700 
701     // ID3DXPatchMesh
702 
703     // Return creation parameters
704     DWORD GetNumPatches() ;
705     DWORD GetNumVertices() ;
706     HRESULT GetDeclaration( D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) ;
707     DWORD GetControlVerticesPerPatch() ;
708     DWORD GetOptions() ;
709     HRESULT GetDevice( IDirect3DDevice9 *ppDevice) ;
710     HRESULT GetPatchInfo( D3DXPATCHINFO* PatchInfo) ;
711 
712     // Control mesh access
713     HRESULT GetVertexBuffer( IDirect3DVertexBuffer9* ppVB) ;
714     HRESULT GetIndexBuffer( IDirect3DIndexBuffer9* ppIB) ;
715     HRESULT LockVertexBuffer( DWORD flags, LPVOID *ppData) ;
716     HRESULT UnlockVertexBuffer() ;
717     HRESULT LockIndexBuffer( DWORD flags, LPVOID *ppData) ;
718     HRESULT UnlockIndexBuffer() ;
719     HRESULT LockAttributeBuffer( DWORD flags, DWORD** ppData) ;
720     HRESULT UnlockAttributeBuffer() ;
721 
722     //  function returns the size of the tessellated mesh given a tessellation level.
723     //  assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must
724     // be set to TRUE and TessellationLevel should be the max tessellation.
725     //  will result in the max mesh size necessary for adaptive tessellation.
726     HRESULT GetTessSize( FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) ;
727 
728     //GenerateAdjacency determines which patches are adjacent with provided tolerance
729     // information is used internally to optimize tessellation
730     HRESULT GenerateAdjacency( FLOAT Tolerance) ;
731 
732     //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer
733     //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh
734     //has adjacency, the new mesh will also have adjacency
735     HRESULT CloneMesh( DWORD Options,  D3DVERTEXELEMENT9 *pDecl, ID3DXPatchMesh *pMesh) ;
736 
737     // Optimizes the patchmesh for efficient tessellation.  function is designed
738     // to perform one time optimization for patch meshes that need to be tessellated
739     // repeatedly by calling the Tessellate() method. The optimization performed is
740     // independent of the actual tessellation level used.
741     // Currently Flags is unused.
742     // If vertices are changed, Optimize must be called again
743     HRESULT Optimize( DWORD flags) ;
744 
745     //gets and sets displacement parameters
746     //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation
747     HRESULT SetDisplaceParam( IDirect3DBaseTexture9 Texture,
748                               D3DTEXTUREFILTERTYPE MinFilter,
749                               D3DTEXTUREFILTERTYPE MagFilter,
750                               D3DTEXTUREFILTERTYPE MipFilter,
751                               D3DTEXTUREADDRESS Wrap,
752                               DWORD dwLODBias) ;
753 
754     HRESULT GetDisplaceParam( IDirect3DBaseTexture9 *Texture,
755                                 D3DTEXTUREFILTERTYPE *MinFilter,
756                                 D3DTEXTUREFILTERTYPE *MagFilter,
757                                 D3DTEXTUREFILTERTYPE *MipFilter,
758                                 D3DTEXTUREADDRESS *Wrap,
759                                 DWORD *dwLODBias) ;
760 
761     // Performs the uniform tessellation based on the tessellation level.
762     //  function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
763     HRESULT Tessellate( FLOAT fTessLevel,ID3DXMesh pMesh) ;
764 
765     // Performs adaptive tessellation based on the Z based adaptive tessellation criterion.
766     // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex
767     // adaptive tessellation amount. Each edge is tessellated to the average of the criterion
768     // at the 2 vertices it connects.
769     // MaxTessLevel specifies the upper limit for adaptive tesselation.
770     //  function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
771     HRESULT TessellateAdaptive(
772          D3DXVECTOR4 *pTrans,
773         DWORD dwMaxTessLevel,
774         DWORD dwMinTessLevel,
775         ID3DXMesh pMesh) ;
776 
777 }
778 
779 interface ID3DXFont : IUnknown
780 {
781     extern(Windows):
782 
783     // ID3DXFont
784     HRESULT GetDevice( IDirect3DDevice9 *ppDevice) ;
785     HRESULT GetDescA( D3DXFONT_DESCA *pDesc) ;
786     HRESULT GetDescW( D3DXFONT_DESCW *pDesc) ;
787     BOOL GetTextMetricsA( TEXTMETRICA *pTextMetrics) ;
788     BOOL GetTextMetricsW( TEXTMETRICW *pTextMetrics) ;
789 
790     HDC GetDC() ;
791     HRESULT GetGlyphData( UINT Glyph, IDirect3DTexture9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) ;
792 
793     HRESULT PreloadCharacters( UINT First, UINT Last) ;
794     HRESULT PreloadGlyphs( UINT First, UINT Last) ;
795     HRESULT PreloadTextA( LPCSTR pString, INT Count) ;
796     HRESULT PreloadTextW( LPCWSTR pString, INT Count) ;
797 
798     INT DrawTextA( ID3DXSprite pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) ;
799     INT DrawTextW( ID3DXSprite pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) ;
800 
801     HRESULT OnLostDevice() ;
802     HRESULT OnResetDevice() ;
803 }
804 
805 interface ID3DXSprite : IUnknown
806 {
807     extern(Windows):
808 
809     // ID3DXSprite
810     HRESULT GetDevice( IDirect3DDevice9* ppDevice) ;
811 
812     HRESULT GetTransform( D3DXMATRIX *pTransform) ;
813     HRESULT SetTransform(  D3DXMATRIX *pTransform) ;
814 
815     HRESULT SetWorldViewRH(  D3DXMATRIX *pWorld,  D3DXMATRIX *pView) ;
816     HRESULT SetWorldViewLH(  D3DXMATRIX *pWorld,  D3DXMATRIX *pView) ;
817 
818     HRESULT Begin( DWORD Flags) ;
819     HRESULT Draw( IDirect3DTexture9 pTexture,  RECT *pSrcRect,  D3DXVECTOR3 *pCenter,  D3DXVECTOR3 *pPosition, D3DCOLOR Color) ;
820     HRESULT Flush() ;
821     HRESULT End() ;
822 
823     HRESULT OnLostDevice() ;
824     HRESULT OnResetDevice() ;
825 }
826 
827 interface ID3DXBaseEffect : IUnknown
828 {
829     extern(Windows):
830 
831     // Descs
832     HRESULT GetDesc( D3DXEFFECT_DESC* pDesc) ;
833     HRESULT GetParameterDesc( D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) ;
834     HRESULT GetTechniqueDesc( D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) ;
835     HRESULT GetPassDesc( D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) ;
836     HRESULT GetFunctionDesc( D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) ;
837 
838     // Handle operations
839     D3DXHANDLE GetParameter( D3DXHANDLE hParameter, UINT Index) ;
840     D3DXHANDLE GetParameterByName( D3DXHANDLE hParameter, LPCSTR pName) ;
841     D3DXHANDLE GetParameterBySemantic( D3DXHANDLE hParameter, LPCSTR pSemantic) ;
842     D3DXHANDLE GetParameterElement( D3DXHANDLE hParameter, UINT Index) ;
843     D3DXHANDLE GetTechnique( UINT Index) ;
844     D3DXHANDLE GetTechniqueByName( LPCSTR pName) ;
845     D3DXHANDLE GetPass( D3DXHANDLE hTechnique, UINT Index) ;
846     D3DXHANDLE GetPassByName( D3DXHANDLE hTechnique, LPCSTR pName) ;
847     D3DXHANDLE GetFunction( UINT Index) ;
848     D3DXHANDLE GetFunctionByName( LPCSTR pName) ;
849     D3DXHANDLE GetAnnotation( D3DXHANDLE hObject, UINT Index) ;
850     D3DXHANDLE GetAnnotationByName( D3DXHANDLE hObject, LPCSTR pName) ;
851 
852     // Get/Set Parameters
853     HRESULT SetValue( D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) ;
854     HRESULT GetValue( D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) ;
855     HRESULT SetBool( D3DXHANDLE hParameter, BOOL b) ;
856     HRESULT GetBool( D3DXHANDLE hParameter, BOOL* pb) ;
857     HRESULT SetBoolArray( D3DXHANDLE hParameter,  BOOL* pb, UINT Count) ;
858     HRESULT GetBoolArray( D3DXHANDLE hParameter, BOOL* pb, UINT Count) ;
859     HRESULT SetInt( D3DXHANDLE hParameter, INT n) ;
860     HRESULT GetInt( D3DXHANDLE hParameter, INT* pn) ;
861     HRESULT SetIntArray( D3DXHANDLE hParameter,  INT* pn, UINT Count) ;
862     HRESULT GetIntArray( D3DXHANDLE hParameter, INT* pn, UINT Count) ;
863     HRESULT SetFloat( D3DXHANDLE hParameter, FLOAT f) ;
864     HRESULT GetFloat( D3DXHANDLE hParameter, FLOAT* pf) ;
865     HRESULT SetFloatArray( D3DXHANDLE hParameter,  FLOAT* pf, UINT Count) ;
866     HRESULT GetFloatArray( D3DXHANDLE hParameter, FLOAT* pf, UINT Count) ;
867     HRESULT SetVector( D3DXHANDLE hParameter,  D3DXVECTOR4* pVector) ;
868     HRESULT GetVector( D3DXHANDLE hParameter, D3DXVECTOR4* pVector) ;
869     HRESULT SetVectorArray( D3DXHANDLE hParameter,  D3DXVECTOR4* pVector, UINT Count) ;
870     HRESULT GetVectorArray( D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) ;
871     HRESULT SetMatrix( D3DXHANDLE hParameter,  D3DXMATRIX* pMatrix) ;
872     HRESULT GetMatrix( D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) ;
873     HRESULT SetMatrixArray( D3DXHANDLE hParameter,  D3DXMATRIX* pMatrix, UINT Count) ;
874     HRESULT GetMatrixArray( D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) ;
875     HRESULT SetMatrixPointerArray( D3DXHANDLE hParameter,  D3DXMATRIX** ppMatrix, UINT Count) ;
876     HRESULT GetMatrixPointerArray( D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) ;
877     HRESULT SetMatrixTranspose( D3DXHANDLE hParameter,  D3DXMATRIX* pMatrix) ;
878     HRESULT GetMatrixTranspose( D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) ;
879     HRESULT SetMatrixTransposeArray( D3DXHANDLE hParameter,  D3DXMATRIX* pMatrix, UINT Count) ;
880     HRESULT GetMatrixTransposeArray( D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) ;
881     HRESULT SetMatrixTransposePointerArray( D3DXHANDLE hParameter,  D3DXMATRIX** ppMatrix, UINT Count) ;
882     HRESULT GetMatrixTransposePointerArray( D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) ;
883     HRESULT SetString( D3DXHANDLE hParameter, LPCSTR pString) ;
884     HRESULT GetString( D3DXHANDLE hParameter, LPCSTR* ppString) ;
885     HRESULT SetTexture( D3DXHANDLE hParameter, IDirect3DBaseTexture9 pTexture) ;
886     HRESULT GetTexture( D3DXHANDLE hParameter, IDirect3DBaseTexture9 *ppTexture) ;
887     HRESULT GetPixelShader( D3DXHANDLE hParameter, IDirect3DPixelShader9 *ppPShader) ;
888     HRESULT GetVertexShader( D3DXHANDLE hParameter, IDirect3DVertexShader9 *ppVShader) ;
889 
890     //Set Range of an Array to pass to device
891     //Useful for sending only a subrange of an array down to the device
892     HRESULT SetArrayRange( D3DXHANDLE hParameter, UINT uStart, UINT uEnd) ;
893 
894 }
895 
896 interface ID3DXEffect : ID3DXBaseEffect
897 {
898     extern(Windows):
899 
900     // Pool
901     HRESULT GetPool( ID3DXEffectPool* ppPool) ;
902 
903     // Selecting and setting a technique
904     HRESULT SetTechnique( D3DXHANDLE hTechnique) ;
905     D3DXHANDLE GetCurrentTechnique() ;
906     HRESULT ValidateTechnique( D3DXHANDLE hTechnique) ;
907     HRESULT FindNextValidTechnique( D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) ;
908     BOOL IsParameterUsed( D3DXHANDLE hParameter, D3DXHANDLE hTechnique) ;
909 
910     // Using current technique
911     // Begin           starts active technique
912     // BeginPass       begins a pass
913     // CommitChanges   updates changes to any set calls in the pass.  should be called before
914     //                 any DrawPrimitive call to d3d
915     // EndPass         ends a pass
916     // End             ends active technique
917     HRESULT Begin( UINT *pPasses, DWORD Flags) ;
918     HRESULT BeginPass( UINT Pass) ;
919     HRESULT CommitChanges() ;
920     HRESULT EndPass() ;
921     HRESULT End() ;
922 
923     // Managing D3D Device
924     HRESULT GetDevice( IDirect3DDevice9* ppDevice) ;
925     HRESULT OnLostDevice() ;
926     HRESULT OnResetDevice() ;
927 
928     // Logging device calls
929     HRESULT SetStateManager( ID3DXEffectStateManager pManager) ;
930     HRESULT GetStateManager( ID3DXEffectStateManager *ppManager) ;
931 
932     // Parameter blocks
933     HRESULT BeginParameterBlock() ;
934     D3DXHANDLE EndParameterBlock() ;
935     HRESULT ApplyParameterBlock( D3DXHANDLE hParameterBlock) ;
936     HRESULT DeleteParameterBlock( D3DXHANDLE hParameterBlock) ;
937 
938     // Cloning
939     HRESULT CloneEffect( IDirect3DDevice9 pDevice, ID3DXEffect* ppEffect) ;
940 }
941 
942 interface ID3DXEffectPool : IUnknown
943 {
944     extern(Windows):
945 
946     // No public methods
947 }
948 
949 interface ID3DXEffectStateManager : IUnknown
950 {
951     extern(Windows):
952 
953     // The following methods are called by the Effect when it wants to make
954     // the corresponding device call.  Note that:
955     // 1. Users manage the state and are therefore responsible for making the
956     //    the corresponding device calls themselves inside their callbacks.
957     // 2. Effects pay attention to the return values of the callbacks, and so
958     //    users must pay attention to what they return in their callbacks.
959 
960     HRESULT SetTransform( D3DTRANSFORMSTATETYPE State,  D3DMATRIX *pMatrix) ;
961     HRESULT SetMaterial(  D3DMATERIAL9 *pMaterial) ;
962     HRESULT SetLight( DWORD Index,  D3DLIGHT9 *pLight) ;
963     HRESULT LightEnable( DWORD Index, BOOL Enable) ;
964     HRESULT SetRenderState( D3DRENDERSTATETYPE State, DWORD Value) ;
965     HRESULT SetTexture( DWORD Stage, IDirect3DBaseTexture9 pTexture) ;
966     HRESULT SetTextureStageState( DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) ;
967     HRESULT SetSamplerState( DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) ;
968     HRESULT SetNPatchMode( FLOAT NumSegments) ;
969     HRESULT SetFVF( DWORD FVF) ;
970     HRESULT SetVertexShader( IDirect3DVertexShader9 pShader) ;
971     HRESULT SetVertexShaderConstantF( UINT RegisterIndex,  FLOAT *pConstantData, UINT RegisterCount) ;
972     HRESULT SetVertexShaderConstantI( UINT RegisterIndex,  INT *pConstantData, UINT RegisterCount) ;
973     HRESULT SetVertexShaderConstantB( UINT RegisterIndex,  BOOL *pConstantData, UINT RegisterCount) ;
974     HRESULT SetPixelShader( IDirect3DPixelShader9 pShader) ;
975     HRESULT SetPixelShaderConstantF( UINT RegisterIndex,  FLOAT *pConstantData, UINT RegisterCount) ;
976     HRESULT SetPixelShaderConstantI( UINT RegisterIndex,  INT *pConstantData, UINT RegisterCount) ;
977     HRESULT SetPixelShaderConstantB( UINT RegisterIndex,  BOOL *pConstantData, UINT RegisterCount) ;
978 }
979 
980 interface ID3DXInclude
981 {
982     HRESULT Open(D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes);
983     HRESULT Close(LPCVOID pData);
984 }
985 
986 // D3DX Functions ---------------------------------------------------------------------------------------
987 extern(Windows)
988 {
989 	uint D3DXGetShaderVersion(uint* pFunction);
990 
991 	HRESULT D3DXCheckTextureRequirements(
992 	        IDirect3DDevice9         pDevice,
993 	        UINT*                     pWidth,
994 	        UINT*                     pHeight,
995 	        UINT*                     pNumMipLevels,
996 	        DWORD                     Usage,
997 	        D3DFORMAT*                pFormat,
998 	        D3DPOOL                   Pool) ;
999 
1000 	HRESULT D3DXCreateTexture(
1001 	        IDirect3DDevice9         pDevice,
1002 	        UINT                      Width,
1003 	        UINT                      Height,
1004 	        UINT                      MipLevels,
1005 	        DWORD                     Usage,
1006 	        D3DFORMAT                 Format,
1007 	        D3DPOOL                   Pool,
1008 	        IDirect3DTexture9*       ppTexture);
1009 
1010 	HRESULT D3DXCreateCubeTexture(
1011 	        IDirect3DDevice9         pDevice,
1012 	        UINT                      Size,
1013 	        UINT                      MipLevels,
1014 	        DWORD                     Usage,
1015 	        D3DFORMAT                 Format,
1016 	        D3DPOOL                   Pool,
1017 	        IDirect3DCubeTexture9*   ppCubeTexture);
1018 
1019 	HRESULT D3DXCreateTextureFromFileA(
1020 			LPDIRECT3DDEVICE9 pDevice,
1021 			LPCTSTR pSrcFile,
1022 			LPDIRECT3DTEXTURE9 * ppTexture);
1023 
1024 	HRESULT D3DXCreateTextureFromFileExA(
1025 	        IDirect3DDevice9         pDevice,
1026 	        LPCSTR                    pSrcFile,
1027 	        UINT                      Width,
1028 	        UINT                      Height,
1029 	        UINT                      MipLevels,
1030 	        DWORD                     Usage,
1031 	        D3DFORMAT                 Format,
1032 	        D3DPOOL                   Pool,
1033 	        DWORD                     Filter,
1034 	        DWORD                     MipFilter,
1035 	        D3DCOLOR                  ColorKey,
1036 	        D3DXIMAGE_INFO*           pSrcInfo,
1037 	        PALETTEENTRY*             pPalette,
1038 	        IDirect3DTexture9*       ppTexture);
1039 
1040 	HRESULT D3DXCreateCubeTextureFromFileExA(
1041 	        IDirect3DDevice9         pDevice,
1042 	        LPCSTR                    pSrcFile,
1043 	        UINT                      Size,
1044 	        UINT                      MipLevels,
1045 	        DWORD                     Usage,
1046 	        D3DFORMAT                 Format,
1047 	        D3DPOOL                   Pool,
1048 	        DWORD                     Filter,
1049 	        DWORD                     MipFilter,
1050 	        D3DCOLOR                  ColorKey,
1051 	        D3DXIMAGE_INFO*           pSrcInfo,
1052 	        PALETTEENTRY*             pPalette,
1053 	        IDirect3DCubeTexture9*   ppCubeTexture);
1054 
1055 	HRESULT D3DXSimplifyMesh(
1056 	        ID3DXMesh pMesh,
1057 	         DWORD* pAdjacency,
1058 	         D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights,
1059 	         FLOAT *pVertexWeights,
1060 	        DWORD MinValue,
1061 	        DWORD Options,
1062 	        ID3DXMesh* ppMesh);
1063 
1064 	HRESULT D3DXCreateSkinInfoFVF(
1065 	        DWORD NumVertices,
1066 	        DWORD FVF,
1067 	        DWORD NumBones,
1068 	        ID3DXSkinInfo* ppSkinInfo);
1069 
1070 	D3DXVECTOR2* D3DXVec2TransformCoord( D3DXVECTOR2 *pOut, D3DXVECTOR2 *pV, D3DXMATRIX *pM );
1071 
1072 	D3DXVECTOR4* D3DXVec3Transform( D3DXVECTOR4 *pOut, D3DXVECTOR3 *pV, D3DXMATRIX *pM );
1073 
1074 	D3DXVECTOR3* D3DXVec3TransformCoord( D3DXVECTOR3 *pOut, D3DXVECTOR3 *pV, D3DXMATRIX *pM );
1075 
1076 	D3DXVECTOR4* D3DXVec4Transform( D3DXVECTOR4 *pOut, D3DXVECTOR4 *pV, D3DXMATRIX *pM );
1077 
1078 	D3DXMATRIX* D3DXMatrixTranspose( D3DXMATRIX *pOut, D3DXMATRIX *pM );
1079 
1080 	D3DXMATRIX* D3DXMatrixMultiply( D3DXMATRIX *pOut, D3DXMATRIX *pM1, D3DXMATRIX *pM2 );
1081 
1082 	D3DXMATRIX* D3DXMatrixInverse( D3DXMATRIX *pOut, FLOAT *pDeterminant, D3DXMATRIX *pM );
1083 
1084 	D3DXMATRIX* D3DXMatrixScaling( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz );
1085 
1086 	D3DXMATRIX* D3DXMatrixTranslation( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z );
1087 
1088 	D3DXMATRIX* D3DXMatrixRotationX( D3DXMATRIX *pOut, FLOAT Angle );
1089 
1090 	D3DXMATRIX* D3DXMatrixRotationY( D3DXMATRIX *pOut, FLOAT Angle );
1091 
1092 	D3DXMATRIX* D3DXMatrixRotationZ( D3DXMATRIX *pOut, FLOAT Angle );
1093 
1094 	D3DXMATRIX* D3DXMatrixRotationQuaternion( D3DXMATRIX *pOut, D3DXQUATERNION *pQ);
1095 
1096 	D3DXMATRIX* D3DXMatrixRotationYawPitchRoll( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll );
1097 
1098 	D3DXMATRIX* D3DXMatrixAffineTransformation2D( D3DXMATRIX *pOut, FLOAT Scaling, D3DXVECTOR2 *pRotationCenter,
1099 	      float Rotation, D3DXVECTOR2 *pTranslation);
1100 
1101 	D3DXMATRIX* D3DXMatrixPerspectiveFovLH( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf );
1102 
1103 	D3DXMATRIX* D3DXMatrixOrthoLH( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf );
1104 
1105 	D3DXMATRIX* D3DXMatrixOrthoOffCenterLH( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn,
1106 	      FLOAT zf );
1107 
1108 	void D3DXQuaternionToAxisAngle( D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle );
1109 
1110 	D3DXQUATERNION* D3DXQuaternionRotationMatrix( D3DXQUATERNION *pOut, D3DXMATRIX *pM);
1111 
1112 	D3DXQUATERNION* D3DXQuaternionNormalize( D3DXQUATERNION *pOut, D3DXQUATERNION *pQ );
1113 
1114 	D3DXPLANE* D3DXPlaneNormalize( D3DXPLANE *pOut, D3DXPLANE *pP);
1115 
1116 	char* DXGetErrorDescription9A(HRESULT hr);
1117 
1118 	HRESULT D3DXCreateEffectFromFileA(
1119 	        IDirect3DDevice9               pDevice,
1120 	        LPCSTR                          pSrcFile,
1121 	         D3DXMACRO*                pDefines,
1122 	        ID3DXInclude                   pInclude,
1123 	        DWORD                           Flags,
1124 	        ID3DXEffectPool                pPool,
1125 	        ID3DXEffect*                   ppEffect,
1126 	        ID3DXBuffer*                   ppCompilationErrors);
1127 
1128 	D3DXMATRIX* D3DXMatrixTransformation2D( D3DXMATRIX *pOut, D3DXVECTOR2 *pScalingCenter,
1129       float *pScalingRotation, D3DXVECTOR2 *pScaling,
1130       D3DXVECTOR2 *pRotationCenter, float Rotation,
1131       D3DXVECTOR2 *pTranslation);
1132 
1133     HRESULT D3DXLoadMeshFromXA(
1134         LPCSTR pFilename,
1135         DWORD Options,
1136         IDirect3DDevice9 pD3D,
1137         ID3DXBuffer *ppAdjacency,
1138         ID3DXBuffer *ppMaterials,
1139         ID3DXBuffer *ppEffectInstances,
1140         DWORD *pNumMaterials,
1141         ID3DXMesh *ppMesh);
1142 
1143     HRESULT D3DXCreatePolygon(
1144         IDirect3DDevice9   pDevice,
1145         FLOAT               Length,
1146         UINT                Sides,
1147         ID3DXMesh*         ppMesh,
1148         ID3DXBuffer*       ppAdjacency);
1149 
1150 	HRESULT D3DXCreateBox(
1151 	        IDirect3DDevice9   pDevice,
1152 	        FLOAT               Width,
1153 	        FLOAT               Height,
1154 	        FLOAT               Depth,
1155 	        ID3DXMesh*         ppMesh,
1156 	        ID3DXBuffer*       ppAdjacency);
1157 
1158 	HRESULT D3DXCreateCylinder(
1159 	        IDirect3DDevice9   pDevice,
1160 	        FLOAT               Radius1,
1161 	        FLOAT               Radius2,
1162 	        FLOAT               Length,
1163 	        UINT                Slices,
1164 	        UINT                Stacks,
1165 	        ID3DXMesh*         ppMesh,
1166 	        ID3DXBuffer*       ppAdjacency);
1167 
1168 	HRESULT D3DXCreateSphere(
1169 	        IDirect3DDevice9  pDevice,
1170 	        FLOAT              Radius,
1171 	        UINT               Slices,
1172 	        UINT               Stacks,
1173 	        ID3DXMesh*        ppMesh,
1174 	        ID3DXBuffer*      ppAdjacency);
1175 
1176 	HRESULT D3DXCreateTorus(
1177 	        IDirect3DDevice9   pDevice,
1178 	        FLOAT               InnerRadius,
1179 	        FLOAT               OuterRadius,
1180 	        UINT                Sides,
1181 	        UINT                Rings,
1182 	        ID3DXMesh*         ppMesh,
1183 	        ID3DXBuffer*       ppAdjacency);
1184 
1185 	HRESULT D3DXCreateTeapot(
1186 	        IDirect3DDevice9   pDevice,
1187 	        ID3DXMesh*         ppMesh,
1188 	        ID3DXBuffer*       ppAdjacency);
1189 
1190 	HRESULT D3DXCreateFontA(
1191         IDirect3DDevice9 pDevice,
1192 		UINT Height,
1193 		UINT Width,
1194 		UINT Weight,
1195 		UINT MipLevels,
1196 		BOOL Italic,
1197 		DWORD CharSet,
1198 		DWORD OutputPrecision,
1199 		DWORD Quality,
1200 		DWORD PitchAndFamily,
1201 		LPCTSTR pFacename,
1202 		ID3DXFont *ppFont);
1203 
1204 	HRESULT D3DXCreateSprite(
1205         IDirect3DDevice9   pDevice,
1206         ID3DXSprite*       ppSprite) ;
1207 
1208     HRESULT D3DXCreateEffect(
1209         IDirect3DDevice9                pDevice,
1210         LPCVOID                         pSrcData,
1211         UINT                            SrcDataLen,
1212         D3DXMACRO*                      pDefines,
1213         ID3DXInclude                    pInclude,
1214         DWORD                           Flags,
1215         ID3DXEffectPool                 pPool,
1216         ID3DXEffect*                    ppEffect,
1217         ID3DXBuffer*                    ppCompilationErrors);
1218 
1219     HRESULT D3DXCreateEffectPool(
1220         ID3DXEffectPool* pEffectPool);
1221 
1222     HRESULT D3DXGetShaderInputSemantics(
1223 		DWORD* pFunction,
1224 		D3DXSEMANTIC* pSemantics,
1225 		UINT* pCount);
1226 
1227 	HRESULT
1228     D3DXCreateMeshFVF(
1229         DWORD NumFaces,
1230         DWORD NumVertices,
1231         DWORD Options,
1232         DWORD FVF,
1233         IDirect3DDevice9 pD3DDevice,
1234         ID3DXMesh* ppMesh);
1235 
1236     UINT D3DXGetFVFVertexSize(DWORD FVF);
1237 
1238     HRESULT D3DXFileCreate(ID3DXFile* lplpDirectXFile);
1239 
1240     HRESULT D3DXLoadMeshFromXof(
1241         ID3DXFileData pxofMesh,
1242         DWORD Options,
1243         IDirect3DDevice9 pD3DDevice,
1244         ID3DXBuffer *ppAdjacency,
1245         ID3DXBuffer *ppMaterials,
1246         ID3DXBuffer *ppEffectInstances,
1247         DWORD *pNumMaterials,
1248         ID3DXMesh *ppMesh);
1249 
1250     HRESULT D3DXConcatenateMeshes(
1251 		ID3DXMesh * ppMeshes,
1252 	    UINT NumMeshes,
1253 	    DWORD Options,
1254 	    D3DXMATRIX * pGeomXForms,
1255 	    D3DXMATRIX * pTextureXForms,
1256 	    D3DVERTEXELEMENT9 * pDecl,
1257 	    IDirect3DDevice9 pD3DDevice,
1258 	    ID3DXMesh * ppMeshOut);
1259 
1260 	HRESULT D3DXDeclaratorFromFVF(DWORD FVF, D3DVERTEXELEMENT9* Declaration);
1261 
1262 	D3DXQUATERNION* D3DXQuaternionSlerp(D3DXQUATERNION* pOut, D3DXQUATERNION* pQ1, D3DXQUATERNION* pQ2, float t);
1263 
1264 	D3DXVECTOR3* D3DXVec3CatmullRom(D3DXVECTOR3 *pOut, D3DXVECTOR3 *pV0, D3DXVECTOR3 *pV1, D3DXVECTOR3 *pV2, D3DXVECTOR3 *pV3, float s);
1265 
1266 	void D3DXQuaternionSquadSetup(  D3DXQUATERNION *pAOut,
1267 								    D3DXQUATERNION *pBOut,
1268 								    D3DXQUATERNION *pCOut,
1269 								    D3DXQUATERNION *pQ0,
1270 								    D3DXQUATERNION *pQ1,
1271 								    D3DXQUATERNION *pQ2,
1272 								    D3DXQUATERNION *pQ3);
1273 
1274 	D3DXQUATERNION* D3DXQuaternionSquad(D3DXQUATERNION *pOut,
1275 									    D3DXQUATERNION *pQ1,
1276 									    D3DXQUATERNION *pA,
1277 									    D3DXQUATERNION *pB,
1278 									    D3DXQUATERNION *pC,
1279 									    float t);
1280 
1281 	HRESULT D3DXMatrixDecompose(D3DXVECTOR3 *pOutScale,
1282 							    D3DXQUATERNION *pOutRotation,
1283 							    D3DXVECTOR3 *pOutTranslation,
1284 							    D3DXMATRIX *pM
1285 								);
1286 
1287 	D3DXQUATERNION* D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pOut,
1288 														    FLOAT Yaw,
1289 														    FLOAT Pitch,
1290 														    FLOAT Roll
1291 														);
1292 
1293 	UINT D3DXGetDeclVertexSize(D3DVERTEXELEMENT9 *pDecl, DWORD Stream );
1294 } // extern(Windows)
1295 
1296 D3DXMATRIX* D3DXMatrixIdentity( D3DXMATRIX *pOut )
1297 {
1298     pOut.m[0][1] = pOut.m[0][2] = pOut.m[0][3] =
1299     pOut.m[1][0] = pOut.m[1][2] = pOut.m[1][3] =
1300     pOut.m[2][0] = pOut.m[2][1] = pOut.m[2][3] =
1301     pOut.m[3][0] = pOut.m[3][1] = pOut.m[3][2] = 0.0f;
1302 
1303     pOut.m[0][0] = pOut.m[1][1] = pOut.m[2][2] = pOut.m[3][3] = 1.0f;
1304     return pOut;
1305 }
1306 
1307 FLOAT D3DXVec3LengthSq(D3DXVECTOR3* v)
1308 {
1309 	return (v.x * v.x) + (v.y * v.y) + (v.z * v.z);
1310 }
1311 
1312 template DEFINE_GUID(uint d1, ushort d2, ushort d3, ubyte d4, ubyte d5, ubyte d6, ubyte d7, ubyte d8, ubyte d9, ubyte d10, ubyte d11)
1313 {
1314 	const GUID DEFINE_GUID = {d1, d2, d3, [d4, d5, d6, d7, d8, d9, d10, d11]};
1315 }
1316 
1317 const GUID TID_D3DRMInfo = DEFINE_GUID!(0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1318 const GUID TID_D3DRMMesh = DEFINE_GUID!(0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1319 const GUID TID_D3DRMVector = DEFINE_GUID!(0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1320 const GUID TID_D3DRMMeshFace = DEFINE_GUID!(0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1321 const GUID TID_D3DRMMaterial = DEFINE_GUID!(0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1322 const GUID TID_D3DRMMaterialArray = DEFINE_GUID!(0x35ff44e1, 0x6c7c, 0x11cf, 0x8F, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1323 const GUID TID_D3DRMFrame = DEFINE_GUID!(0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1324 const GUID TID_D3DRMFrameTransformMatrix = DEFINE_GUID!(0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1325 const GUID TID_D3DRMMeshMaterialList = DEFINE_GUID!(0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1326 const GUID TID_D3DRMMeshTextureCoords = DEFINE_GUID!(0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1327 const GUID TID_D3DRMMeshNormals = DEFINE_GUID!(0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1328 const GUID TID_D3DRMCoords2d = DEFINE_GUID!(0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1329 const GUID TID_D3DRMMatrix4x4 = DEFINE_GUID!(0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1330 const GUID TID_D3DRMAnimation = DEFINE_GUID!(0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1331 const GUID TID_D3DRMAnimationSet = DEFINE_GUID!(0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1332 const GUID TID_D3DRMAnimationKey = DEFINE_GUID!(0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1333 const GUID TID_D3DRMFloatKeys = DEFINE_GUID!(0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1334 const GUID TID_D3DRMMaterialAmbientColor = DEFINE_GUID!(0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1335 const GUID TID_D3DRMMaterialDiffuseColor = DEFINE_GUID!(0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1336 const GUID TID_D3DRMMaterialSpecularColor = DEFINE_GUID!(0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1337 const GUID TID_D3DRMMaterialEmissiveColor = DEFINE_GUID!(0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1338 const GUID TID_D3DRMMaterialPower = DEFINE_GUID!(0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1339 const GUID TID_D3DRMColorRGBA = DEFINE_GUID!(0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3);
1340 const GUID TID_D3DRMColorRGB = DEFINE_GUID!(0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1341 const GUID TID_D3DRMGuid = DEFINE_GUID!(0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1342 const GUID TID_D3DRMTextureFilename = DEFINE_GUID!(0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1343 const GUID TID_D3DRMTextureReference = DEFINE_GUID!(0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1344 const GUID TID_D3DRMIndexedColor = DEFINE_GUID!(0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1345 const GUID TID_D3DRMMeshVertexColors = DEFINE_GUID!(0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1346 const GUID TID_D3DRMMaterialWrap = DEFINE_GUID!(0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1347 const GUID TID_D3DRMBoolean = DEFINE_GUID!(0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b);
1348 const GUID TID_D3DRMMeshFaceWraps = DEFINE_GUID!(0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b);
1349 const GUID TID_D3DRMBoolean2d = DEFINE_GUID!(0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1350 const GUID TID_D3DRMTimedFloatKeys = DEFINE_GUID!(0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1351 const GUID TID_D3DRMAnimationOptions = DEFINE_GUID!(0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1352 const GUID TID_D3DRMFramePosition = DEFINE_GUID!(0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1353 const GUID TID_D3DRMFrameVelocity = DEFINE_GUID!(0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1354 const GUID TID_D3DRMFrameRotation = DEFINE_GUID!(0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3);
1355 const GUID TID_D3DRMLight = DEFINE_GUID!(0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1356 const GUID TID_D3DRMCamera = DEFINE_GUID!(0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1357 const GUID TID_D3DRMAppData = DEFINE_GUID!(0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f);
1358 const GUID TID_D3DRMLightUmbra = DEFINE_GUID!(0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f);
1359 const GUID TID_D3DRMLightRange = DEFINE_GUID!(0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f);
1360 const GUID TID_D3DRMLightPenumbra = DEFINE_GUID!(0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f);
1361 const GUID TID_D3DRMLightAttenuation = DEFINE_GUID!(0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b);
1362 const GUID TID_D3DRMInlineData = DEFINE_GUID!(0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1363 const GUID TID_D3DRMUrl = DEFINE_GUID!(0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
1364 const GUID TID_D3DRMProgressiveMesh = DEFINE_GUID!(0x8A63C360, 0x997D, 0x11d0, 0x94, 0x1C, 0x0, 0x80, 0xC8, 0x0C, 0xFA, 0x7B);
1365 const GUID TID_D3DRMExternalVisual = DEFINE_GUID!(0x98116AA0, 0xBDBA, 0x11d1, 0x82, 0xC0, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x71);
1366 const GUID TID_D3DRMStringProperty = DEFINE_GUID!(0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71);
1367 const GUID TID_D3DRMPropertyBag = DEFINE_GUID!(0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71);
1368 const GUID TID_D3DRMRightHanded = DEFINE_GUID!(0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71);
1369 
1370 ubyte D3DRM_XTEMPLATES[] =
1371 [
1372 	0x78, 0x6f, 0x66, 0x20, 0x30, 0x33, 0x30, 0x32, 0x62,
1373 	0x69, 0x6e, 0x20, 0x30, 0x30, 0x36, 0x34, 0x1f, 0, 0x1,
1374 	0, 0x6, 0, 0, 0, 0x48, 0x65, 0x61, 0x64, 0x65,
1375 	0x72, 0xa, 0, 0x5, 0, 0x43, 0xab, 0x82, 0x3d, 0xda,
1376 	0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4,
1377 	0x33, 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x6d,
1378 	0x61, 0x6a, 0x6f, 0x72, 0x14, 0, 0x28, 0, 0x1, 0,
1379 	0x5, 0, 0, 0, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x14,
1380 	0, 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x66,
1381 	0x6c, 0x61, 0x67, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0,
1382 	0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74,
1383 	0x6f, 0x72, 0xa, 0, 0x5, 0, 0x5e, 0xab, 0x82, 0x3d,
1384 	0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71,
1385 	0xe4, 0x33, 0x2a, 0, 0x1, 0, 0x1, 0, 0, 0,
1386 	0x78, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, 0,
1387 	0, 0x79, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0,
1388 	0, 0, 0x7a, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1,
1389 	0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64,
1390 	0x73, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x44, 0x3f, 0xf2,
1391 	0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33,
1392 	0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, 0x1, 0, 0,
1393 	0, 0x75, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0,
1394 	0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1,
1395 	0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69,
1396 	0x78, 0x34, 0x78, 0x34, 0xa, 0, 0x5, 0, 0x45, 0x3f,
1397 	0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40,
1398 	0x33, 0x35, 0x94, 0xa3, 0x34, 0, 0x2a, 0, 0x1, 0,
1399 	0x6, 0, 0, 0, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78,
1400 	0xe, 0, 0x3, 0, 0x10, 0, 0, 0, 0xf, 0,
1401 	0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0,
1402 	0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42,
1403 	0x41, 0xa, 0, 0x5, 0, 0xe0, 0x44, 0xff, 0x35, 0x7c,
1404 	0x6c, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94,
1405 	0xa3, 0x2a, 0, 0x1, 0, 0x3, 0, 0, 0, 0x72,
1406 	0x65, 0x64, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0,
1407 	0, 0, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x14, 0, 0x2a,
1408 	0, 0x1, 0, 0x4, 0, 0, 0, 0x62, 0x6c, 0x75,
1409 	0x65, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, 0,
1410 	0, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x14, 0, 0xb, 0,
1411 	0x1f, 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f,
1412 	0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0xa, 0, 0x5, 0,
1413 	0x81, 0x6e, 0xe1, 0xd3, 0x35, 0x78, 0xcf, 0x11, 0x8f, 0x52,
1414 	0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0,
1415 	0x3, 0, 0, 0, 0x72, 0x65, 0x64, 0x14, 0, 0x2a,
1416 	0, 0x1, 0, 0x5, 0, 0, 0, 0x67, 0x72, 0x65,
1417 	0x65, 0x6e, 0x14, 0, 0x2a, 0, 0x1, 0, 0x4, 0,
1418 	0, 0, 0x62, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, 0,
1419 	0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x49, 0x6e,
1420 	0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1421 	0xa, 0, 0x5, 0, 0x20, 0xb8, 0x30, 0x16, 0x42, 0x78,
1422 	0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3,
1423 	0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x69, 0x6e,
1424 	0x64, 0x65, 0x78, 0x14, 0, 0x1, 0, 0x9, 0, 0,
1425 	0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41,
1426 	0x1, 0, 0xa, 0, 0, 0, 0x69, 0x6e, 0x64, 0x65,
1427 	0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0xb, 0,
1428 	0x1f, 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f,
1429 	0x6f, 0x6c, 0x65, 0x61, 0x6e, 0xa, 0, 0x5, 0, 0xa0,
1430 	0xa6, 0x7d, 0x53, 0x37, 0xca, 0xd0, 0x11, 0x94, 0x1c, 0,
1431 	0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, 0, 0x9,
1432 	0, 0, 0, 0x74, 0x72, 0x75, 0x65, 0x66, 0x61, 0x6c,
1433 	0x73, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0,
1434 	0x9, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61,
1435 	0x6e, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x63, 0xae, 0x85,
1436 	0x48, 0xe8, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33,
1437 	0x35, 0x94, 0xa3, 0x1, 0, 0x7, 0, 0, 0, 0x42,
1438 	0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0,
1439 	0, 0, 0x75, 0x14, 0, 0x1, 0, 0x7, 0, 0,
1440 	0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0,
1441 	0x1, 0, 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f,
1442 	0, 0x1, 0, 0xc, 0, 0, 0, 0x4d, 0x61, 0x74,
1443 	0x65, 0x72, 0x69, 0x61, 0x6c, 0x57, 0x72, 0x61, 0x70, 0xa,
1444 	0, 0x5, 0, 0x60, 0xae, 0x85, 0x48, 0xe8, 0x78, 0xcf,
1445 	0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1,
1446 	0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65,
1447 	0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, 0x75, 0x14,
1448 	0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f,
1449 	0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0,
1450 	0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0xf,
1451 	0, 0, 0, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65,
1452 	0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0xa, 0,
1453 	0x5, 0, 0xe1, 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11,
1454 	0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x31, 0,
1455 	0x1, 0, 0x8, 0, 0, 0, 0x66, 0x69, 0x6c, 0x65,
1456 	0x6e, 0x61, 0x6d, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0,
1457 	0x1, 0, 0x8, 0, 0, 0, 0x4d, 0x61, 0x74, 0x65,
1458 	0x72, 0x69, 0x61, 0x6c, 0xa, 0, 0x5, 0, 0x4d, 0xab,
1459 	0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20,
1460 	0xaf, 0x71, 0xe4, 0x33, 0x1, 0, 0x9, 0, 0, 0,
1461 	0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, 0x1,
1462 	0, 0x9, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x43,
1463 	0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x2a, 0, 0x1, 0,
1464 	0x5, 0, 0, 0, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x14,
1465 	0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6c,
1466 	0x6f, 0x72, 0x52, 0x47, 0x42, 0x1, 0, 0xd, 0, 0,
1467 	0, 0x73, 0x70, 0x65, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x43,
1468 	0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x1, 0, 0x8, 0,
1469 	0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42,
1470 	0x1, 0, 0xd, 0, 0, 0, 0x65, 0x6d, 0x69, 0x73,
1471 	0x73, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14,
1472 	0, 0xe, 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf,
1473 	0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x8, 0, 0,
1474 	0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, 0xa,
1475 	0, 0x5, 0, 0x5f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf,
1476 	0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29,
1477 	0, 0x1, 0, 0x12, 0, 0, 0, 0x6e, 0x46, 0x61,
1478 	0x63, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e,
1479 	0x64, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29,
1480 	0, 0x1, 0, 0x11, 0, 0, 0, 0x66, 0x61, 0x63,
1481 	0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64,
1482 	0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, 0, 0x12, 0,
1483 	0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x56, 0x65, 0x72,
1484 	0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73,
1485 	0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0,
1486 	0xd, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61,
1487 	0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x73, 0xa, 0, 0x5,
1488 	0, 0xc0, 0xc5, 0x1e, 0xed, 0xa8, 0xc0, 0xd0, 0x11, 0x94,
1489 	0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1,
1490 	0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65,
1491 	0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73,
1492 	0x14, 0, 0x34, 0, 0x1, 0, 0x9, 0, 0, 0,
1493 	0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x32, 0x64, 0x1,
1494 	0, 0xe, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x57,
1495 	0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0xe,
1496 	0, 0x1, 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61,
1497 	0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75,
1498 	0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0,
1499 	0x1, 0, 0x11, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68,
1500 	0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f,
1501 	0x72, 0x64, 0x73, 0xa, 0, 0x5, 0, 0x40, 0x3f, 0xf2,
1502 	0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33,
1503 	0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xe, 0, 0,
1504 	0, 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43,
1505 	0x6f, 0x6f, 0x72, 0x64, 0x73, 0x14, 0, 0x34, 0, 0x1,
1506 	0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64,
1507 	0x73, 0x32, 0x64, 0x1, 0, 0xd, 0, 0, 0, 0x74,
1508 	0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, 0x72,
1509 	0x64, 0x73, 0xe, 0, 0x1, 0, 0xe, 0, 0, 0,
1510 	0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f,
1511 	0x6f, 0x72, 0x64, 0x73, 0xf, 0, 0x14, 0, 0xb, 0,
1512 	0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x4d, 0x65,
1513 	0x73, 0x68, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c,
1514 	0x4c, 0x69, 0x73, 0x74, 0xa, 0, 0x5, 0, 0x42, 0x3f,
1515 	0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40,
1516 	0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, 0,
1517 	0, 0, 0x6e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61,
1518 	0x6c, 0x73, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, 0,
1519 	0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x64,
1520 	0x65, 0x78, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, 0,
1521 	0x1, 0, 0xb, 0, 0, 0, 0x66, 0x61, 0x63, 0x65,
1522 	0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xe, 0, 0x1,
1523 	0, 0xc, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65,
1524 	0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xf, 0, 0x14,
1525 	0, 0xe, 0, 0x1, 0, 0x8, 0, 0, 0, 0x4d,
1526 	0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0xf, 0, 0xb,
1527 	0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x4d,
1528 	0x65, 0x73, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73,
1529 	0xa, 0, 0x5, 0, 0x43, 0x3f, 0xf2, 0xf6, 0x86, 0x76,
1530 	0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3,
1531 	0x29, 0, 0x1, 0, 0x8, 0, 0, 0, 0x6e, 0x4e,
1532 	0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0,
1533 	0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74,
1534 	0x6f, 0x72, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x6f,
1535 	0x72, 0x6d, 0x61, 0x6c, 0x73, 0xe, 0, 0x1, 0, 0x8,
1536 	0, 0, 0, 0x6e, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c,
1537 	0x73, 0xf, 0, 0x14, 0, 0x29, 0, 0x1, 0, 0xc,
1538 	0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x6f,
1539 	0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x1,
1540 	0, 0x8, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46,
1541 	0x61, 0x63, 0x65, 0x1, 0, 0xb, 0, 0, 0, 0x66,
1542 	0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73,
1543 	0xe, 0, 0x1, 0, 0xc, 0, 0, 0, 0x6e, 0x46,
1544 	0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73,
1545 	0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0,
1546 	0x10, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x56, 0x65,
1547 	0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73,
1548 	0xa, 0, 0x5, 0, 0x21, 0xb8, 0x30, 0x16, 0x42, 0x78,
1549 	0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3,
1550 	0x29, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, 0x56,
1551 	0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1552 	0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0xc, 0, 0,
1553 	0, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f,
1554 	0x6c, 0x6f, 0x72, 0x1, 0, 0xc, 0, 0, 0, 0x76,
1555 	0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1556 	0x73, 0xe, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e,
1557 	0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f,
1558 	0x72, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0,
1559 	0x1, 0, 0x4, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68,
1560 	0xa, 0, 0x5, 0, 0x44, 0xab, 0x82, 0x3d, 0xda, 0x62,
1561 	0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33,
1562 	0x29, 0, 0x1, 0, 0x9, 0, 0, 0, 0x6e, 0x56,
1563 	0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34,
1564 	0, 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63,
1565 	0x74, 0x6f, 0x72, 0x1, 0, 0x8, 0, 0, 0, 0x76,
1566 	0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1,
1567 	0, 0x9, 0, 0, 0, 0x6e, 0x56, 0x65, 0x72, 0x74,
1568 	0x69, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0x29, 0,
1569 	0x1, 0, 0x6, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63,
1570 	0x65, 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0x8, 0,
1571 	0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65,
1572 	0x1, 0, 0x5, 0, 0, 0, 0x66, 0x61, 0x63, 0x65,
1573 	0x73, 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x6e,
1574 	0x46, 0x61, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xe,
1575 	0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb,
1576 	0, 0x1f, 0, 0x1, 0, 0x14, 0, 0, 0, 0x46,
1577 	0x72, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66,
1578 	0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0xa,
1579 	0, 0x5, 0, 0x41, 0x3f, 0xf2, 0xf6, 0x86, 0x76, 0xcf,
1580 	0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1,
1581 	0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69,
1582 	0x78, 0x34, 0x78, 0x34, 0x1, 0, 0xb, 0, 0, 0,
1583 	0x66, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x72, 0x69,
1584 	0x78, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x5,
1585 	0, 0, 0, 0x46, 0x72, 0x61, 0x6d, 0x65, 0xa, 0,
1586 	0x5, 0, 0x46, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11,
1587 	0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, 0,
1588 	0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, 0,
1589 	0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, 0x46, 0x6c,
1590 	0x6f, 0x61, 0x74, 0x4b, 0x65, 0x79, 0x73, 0xa, 0, 0x5,
1591 	0, 0xa9, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, 0x8f,
1592 	0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1,
1593 	0, 0x7, 0, 0, 0, 0x6e, 0x56, 0x61, 0x6c, 0x75,
1594 	0x65, 0x73, 0x14, 0, 0x34, 0, 0x2a, 0, 0x1, 0,
1595 	0x6, 0, 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73,
1596 	0xe, 0, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x56,
1597 	0x61, 0x6c, 0x75, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb,
1598 	0, 0x1f, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54,
1599 	0x69, 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b,
1600 	0x65, 0x79, 0x73, 0xa, 0, 0x5, 0, 0x80, 0xb1, 0x6,
1601 	0xf4, 0x3b, 0x7b, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33,
1602 	0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x4, 0, 0,
1603 	0, 0x74, 0x69, 0x6d, 0x65, 0x14, 0, 0x1, 0, 0x9,
1604 	0, 0, 0, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65,
1605 	0x79, 0x73, 0x1, 0, 0x6, 0, 0, 0, 0x74, 0x66,
1606 	0x6b, 0x65, 0x79, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0,
1607 	0x1, 0, 0xc, 0, 0, 0, 0x41, 0x6e, 0x69, 0x6d,
1608 	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0xa, 0,
1609 	0x5, 0, 0xa8, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11,
1610 	0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0,
1611 	0x1, 0, 0x7, 0, 0, 0, 0x6b, 0x65, 0x79, 0x54,
1612 	0x79, 0x70, 0x65, 0x14, 0, 0x29, 0, 0x1, 0, 0x5,
1613 	0, 0, 0, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x14, 0,
1614 	0x34, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, 0x69,
1615 	0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65,
1616 	0x79, 0x73, 0x1, 0, 0x4, 0, 0, 0, 0x6b, 0x65,
1617 	0x79, 0x73, 0xe, 0, 0x1, 0, 0x5, 0, 0, 0,
1618 	0x6e, 0x4b, 0x65, 0x79, 0x73, 0xf, 0, 0x14, 0, 0xb,
1619 	0, 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x41,
1620 	0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70,
1621 	0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0, 0x5, 0, 0xc0,
1622 	0x56, 0xbf, 0xe2, 0xf, 0x84, 0xcf, 0x11, 0x8f, 0x52, 0,
1623 	0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa,
1624 	0, 0, 0, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f,
1625 	0x73, 0x65, 0x64, 0x14, 0, 0x29, 0, 0x1, 0, 0xf,
1626 	0, 0, 0, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
1627 	0x6e, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x14, 0,
1628 	0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0,
1629 	0x41, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa,
1630 	0, 0x5, 0, 0x4f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf,
1631 	0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe,
1632 	0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb,
1633 	0, 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x41,
1634 	0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65,
1635 	0x74, 0xa, 0, 0x5, 0, 0x50, 0xab, 0x82, 0x3d, 0xda,
1636 	0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4,
1637 	0x33, 0xe, 0, 0x1, 0, 0x9, 0, 0, 0, 0x41,
1638 	0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xf, 0,
1639 	0xb, 0, 0x1f, 0, 0x1, 0, 0xa, 0, 0, 0,
1640 	0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61,
1641 	0xa, 0, 0x5, 0, 0xa0, 0xee, 0x23, 0x3a, 0xb1, 0x94,
1642 	0xd0, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33,
1643 	0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x42, 0x49,
1644 	0x4e, 0x41, 0x52, 0x59, 0xf, 0, 0xb, 0, 0x1f, 0,
1645 	0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, 0x6c, 0xa,
1646 	0, 0x5, 0, 0xa1, 0xee, 0x23, 0x3a, 0xb1, 0x94, 0xd0,
1647 	0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29,
1648 	0, 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72,
1649 	0x6c, 0x73, 0x14, 0, 0x34, 0, 0x31, 0, 0x1, 0,
1650 	0x4, 0, 0, 0, 0x75, 0x72, 0x6c, 0x73, 0xe, 0,
1651 	0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, 0x6c,
1652 	0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1,
1653 	0, 0xf, 0, 0, 0, 0x50, 0x72, 0x6f, 0x67, 0x72,
1654 	0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x68,
1655 	0xa, 0, 0x5, 0, 0x60, 0xc3, 0x63, 0x8a, 0x7d, 0x99,
1656 	0xd0, 0x11, 0x94, 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b,
1657 	0xe, 0, 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72,
1658 	0x6c, 0x13, 0, 0x1, 0, 0xa, 0, 0, 0, 0x49,
1659 	0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0xf,
1660 	0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x4, 0, 0,
1661 	0, 0x47, 0x75, 0x69, 0x64, 0xa, 0, 0x5, 0, 0xe0,
1662 	0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0,
1663 	0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x5,
1664 	0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x31, 0x14, 0,
1665 	0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x64, 0x61,
1666 	0x74, 0x61, 0x32, 0x14, 0, 0x28, 0, 0x1, 0, 0x5,
1667 	0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x33, 0x14, 0,
1668 	0x34, 0, 0x2d, 0, 0x1, 0, 0x5, 0, 0, 0,
1669 	0x64, 0x61, 0x74, 0x61, 0x34, 0xe, 0, 0x3, 0, 0x8,
1670 	0, 0, 0, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f,
1671 	0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, 0x72,
1672 	0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
1673 	0x79, 0xa, 0, 0x5, 0, 0xe0, 0x21, 0xf, 0x7f, 0xe1,
1674 	0xbf, 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72,
1675 	0x71, 0x31, 0, 0x1, 0, 0x3, 0, 0, 0, 0x6b,
1676 	0x65, 0x79, 0x14, 0, 0x31, 0, 0x1, 0, 0x5, 0,
1677 	0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x14, 0, 0xb,
1678 	0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x50,
1679 	0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x42, 0x61, 0x67,
1680 	0xa, 0, 0x5, 0, 0xe1, 0x21, 0xf, 0x7f, 0xe1, 0xbf,
1681 	0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71,
1682 	0xe, 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74,
1683 	0x72, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72,
1684 	0x74, 0x79, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0,
1685 	0xe, 0, 0, 0, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e,
1686 	0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6c, 0xa, 0,
1687 	0x5, 0, 0xa0, 0x6a, 0x11, 0x98, 0xba, 0xbd, 0xd1, 0x11,
1688 	0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x1, 0,
1689 	0x4, 0, 0, 0, 0x47, 0x75, 0x69, 0x64, 0x1, 0,
1690 	0x12, 0, 0, 0, 0x67, 0x75, 0x69, 0x64, 0x45, 0x78,
1691 	0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75,
1692 	0x61, 0x6c, 0x14, 0, 0xe, 0, 0x12, 0, 0x12, 0,
1693 	0x12, 0, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0,
1694 	0xb, 0, 0, 0, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48,
1695 	0x61, 0x6e, 0x64, 0x65, 0x64, 0xa, 0, 0x5, 0, 0xa0,
1696 	0x5e, 0x5d, 0x7f, 0x3a, 0xd5, 0xd1, 0x11, 0x82, 0xc0, 0,
1697 	0xa0, 0xc9, 0x69, 0x72, 0x71, 0x29, 0, 0x1, 0, 0xc,
1698 	0, 0, 0, 0x62, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48,
1699 	0x61, 0x6e, 0x64, 0x65, 0x64, 0x14, 0, 0xb, 0
1700 ];
1701 
1702 const GUID DXFILEOBJ_XSkinMeshHeader = DEFINE_GUID!(0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2);
1703 const GUID DXFILEOBJ_VertexDuplicationIndices = DEFINE_GUID!(0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3);
1704 const GUID DXFILEOBJ_FaceAdjacency = DEFINE_GUID!(0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c);
1705 const GUID DXFILEOBJ_SkinWeights = DEFINE_GUID!(0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb);
1706 const GUID DXFILEOBJ_Patch = DEFINE_GUID!(0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6);
1707 const GUID DXFILEOBJ_PatchMesh = DEFINE_GUID!(0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf);
1708 const GUID DXFILEOBJ_PatchMesh9 = DEFINE_GUID!(0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea);
1709 const GUID DXFILEOBJ_PMInfo = DEFINE_GUID!(0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47);
1710 const GUID DXFILEOBJ_PMAttributeRange = DEFINE_GUID!(0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44);
1711 const GUID DXFILEOBJ_PMVSplitRecord = DEFINE_GUID!(0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c);
1712 const GUID DXFILEOBJ_FVFData = DEFINE_GUID!(0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97);
1713 const GUID DXFILEOBJ_VertexElement = DEFINE_GUID!(0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f);
1714 const GUID DXFILEOBJ_DeclData = DEFINE_GUID!(0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93);
1715 const GUID DXFILEOBJ_EffectFloats = DEFINE_GUID!(0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d);
1716 const GUID DXFILEOBJ_EffectString = DEFINE_GUID!(0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42);
1717 const GUID DXFILEOBJ_EffectDWord = DEFINE_GUID!(0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16);
1718 const GUID DXFILEOBJ_EffectParamFloats = DEFINE_GUID!(0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b);
1719 const GUID DXFILEOBJ_EffectParamString = DEFINE_GUID!(0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81);
1720 const GUID DXFILEOBJ_EffectParamDWord = DEFINE_GUID!(0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5);
1721 const GUID DXFILEOBJ_EffectInstance = DEFINE_GUID!(0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f);
1722 const GUID DXFILEOBJ_AnimTicksPerSecond = DEFINE_GUID!(0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76);
1723 const GUID DXFILEOBJ_CompressedAnimationSet = DEFINE_GUID!(0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d);
1724 
1725 align(1) struct XFILECOMPRESSEDANIMATIONSET
1726 {
1727     DWORD CompressedBlockSize;
1728     FLOAT TicksPerSec;
1729     DWORD PlaybackType;
1730     DWORD BufferLength;
1731 }
1732 
1733 const char[] XSKINEXP_TEMPLATES =
1734         "xof 0303txt 0032
1735         template XSkinMeshHeader
1736         {
1737             <3CF169CE-FF7C-44ab-93C0-F78F62D172E2>
1738             WORD nMaxSkinWeightsPerVertex;
1739             WORD nMaxSkinWeightsPerFace;
1740             WORD nBones;
1741         }
1742         template VertexDuplicationIndices
1743         {
1744             <B8D65549-D7C9-4995-89CF-53A9A8B031E3>
1745             DWORD nIndices;
1746             DWORD nOriginalVertices;
1747             array DWORD[nIndices] indices;
1748         }
1749         template FaceAdjacency
1750         {
1751             <A64C844A-E282-4756-8B80-250CDE04398C>
1752             DWORD nIndices;
1753             array DWORD[nIndices] indices;
1754         }
1755         template SkinWeights
1756         {
1757             <6F0D123B-BAD2-4167-A0D0-80224F25FABB>
1758             STRING transformNodeName;
1759             DWORD nWeights;
1760             array DWORD[nWeights] vertexIndices;
1761             array float[nWeights] weights;
1762             Matrix4x4 matrixOffset;
1763         }
1764         template Patch
1765         {
1766             <A3EB5D44-FC22-429D-9AFB-3221CB9719A6>
1767             DWORD nControlIndices;
1768             array DWORD[nControlIndices] controlIndices;
1769         }
1770         template PatchMesh
1771         {
1772             <D02C95CC-EDBA-4305-9B5D-1820D7704BBF>
1773             DWORD nVertices;
1774             array Vector[nVertices] vertices;
1775             DWORD nPatches;
1776             array Patch[nPatches] patches;
1777             [ ... ]
1778         }
1779         template PatchMesh9
1780         {
1781             <B9EC94E1-B9A6-4251-BA18-94893F02C0EA>
1782             DWORD Type;
1783             DWORD Degree;
1784             DWORD Basis;
1785             DWORD nVertices;
1786             array Vector[nVertices] vertices;
1787             DWORD nPatches;
1788             array Patch[nPatches] patches;
1789             [ ... ]
1790         } "
1791         "template EffectFloats
1792         {
1793             <F1CFE2B3-0DE3-4e28-AFA1-155A750A282D>
1794             DWORD nFloats;
1795             array float[nFloats] Floats;
1796         }
1797         template EffectString
1798         {
1799             <D55B097E-BDB6-4c52-B03D-6051C89D0E42>
1800             STRING Value;
1801         }
1802         template EffectDWord
1803         {
1804             <622C0ED0-956E-4da9-908A-2AF94F3CE716>
1805             DWORD Value;
1806         } "
1807         "template EffectParamFloats
1808         {
1809             <3014B9A0-62F5-478c-9B86-E4AC9F4E418B>
1810             STRING ParamName;
1811             DWORD nFloats;
1812             array float[nFloats] Floats;
1813         } "
1814         "template EffectParamString
1815         {
1816             <1DBC4C88-94C1-46ee-9076-2C28818C9481>
1817             STRING ParamName;
1818             STRING Value;
1819         }
1820         template EffectParamDWord
1821         {
1822             <E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5>
1823             STRING ParamName;
1824             DWORD Value;
1825         }
1826         template EffectInstance
1827         {
1828             <E331F7E4-0559-4cc2-8E99-1CEC1657928F>
1829             STRING EffectFilename;
1830             [ ... ]
1831         } "
1832         "template AnimTicksPerSecond
1833         {
1834             <9E415A43-7BA6-4a73-8743-B73D47E88476>
1835             DWORD AnimTicksPerSecond;
1836         }
1837         template CompressedAnimationSet
1838         {
1839             <7F9B00B3-F125-4890-876E-1C42BF697C4D>
1840             DWORD CompressedBlockSize;
1841             FLOAT TicksPerSec;
1842             DWORD PlaybackType;
1843             DWORD BufferLength;
1844             array DWORD[BufferLength] CompressedData;
1845         } ";
1846 
1847 const char[] XEXTENSIONS_TEMPLATES =
1848         "xof 0303txt 0032
1849         template FVFData
1850         {
1851             <B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897>
1852             DWORD dwFVF;
1853             DWORD nDWords;
1854             array DWORD[nDWords] data;
1855         }
1856         template VertexElement
1857         {
1858             <F752461C-1E23-48f6-B9F8-8350850F336F>
1859             DWORD Type;
1860             DWORD Method;
1861             DWORD Usage;
1862             DWORD UsageIndex;
1863         }
1864         template DeclData
1865         {
1866             <BF22E553-292C-4781-9FEA-62BD554BDD93>
1867             DWORD nElements;
1868             array VertexElement[nElements] Elements;
1869             DWORD nDWords;
1870             array DWORD[nDWords] data;
1871         }
1872         template PMAttributeRange
1873         {
1874             <917E0427-C61E-4a14-9C64-AFE65F9E9844>
1875             DWORD iFaceOffset;
1876             DWORD nFacesMin;
1877             DWORD nFacesMax;
1878             DWORD iVertexOffset;
1879             DWORD nVerticesMin;
1880             DWORD nVerticesMax;
1881         }
1882         template PMVSplitRecord
1883         {
1884             <574CCC14-F0B3-4333-822D-93E8A8A08E4C>
1885             DWORD iFaceCLW;
1886             DWORD iVlrOffset;
1887             DWORD iCode;
1888         }
1889         template PMInfo
1890         {
1891             <B6C3E656-EC8B-4b92-9B62-681659522947>
1892             DWORD nAttributes;
1893             array PMAttributeRange[nAttributes] attributeRanges;
1894             DWORD nMaxValence;
1895             DWORD nMinLogicalVertices;
1896             DWORD nMaxLogicalVertices;
1897             DWORD nVSplits;
1898             array PMVSplitRecord[nVSplits] splitRecords;
1899             DWORD nAttributeMispredicts;
1900             array DWORD[nAttributeMispredicts] attributeMispredicts;
1901         } ";
1902 
1903 enum : uint
1904 {
1905 	D3DXF_FILEFORMAT_BINARY          = 0,
1906 	D3DXF_FILEFORMAT_TEXT            = 1,
1907 	D3DXF_FILEFORMAT_COMPRESSED      = 2
1908 }
1909 alias uint D3DXF_FILEFORMAT;
1910 
1911 enum : uint
1912 {
1913 	D3DXF_FILESAVE_TOFILE     = 0x00L,
1914 	D3DXF_FILESAVE_TOWFILE    = 0x01L
1915 }
1916 alias uint D3DXF_FILESAVEOPTIONS;
1917 
1918 enum : uint
1919 {
1920 	D3DXF_FILELOAD_FROMFILE     = 0x00L,
1921 	D3DXF_FILELOAD_FROMWFILE    = 0x01L,
1922 	D3DXF_FILELOAD_FROMRESOURCE = 0x02L,
1923 	D3DXF_FILELOAD_FROMMEMORY   = 0x03L
1924 }
1925 alias uint D3DXF_FILELOADOPTIONS;
1926 
1927 struct D3DXF_FILELOADRESOURCE
1928 {
1929     HMODULE hModule; // Desc
1930     LPCSTR lpName;  // Desc
1931     LPCSTR lpType;  // Desc
1932 }
1933 
1934 struct D3DXF_FILELOADMEMORY
1935 {
1936     LPCVOID lpMemory; // Desc
1937     size_t  dSize;     // Desc
1938 }
1939 
1940 const GUID IID_ID3DXFile = DEFINE_GUID!(0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
1941 const GUID IID_ID3DXFileSaveObject = DEFINE_GUID!(0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
1942 const GUID IID_ID3DXFileSaveData = DEFINE_GUID!(0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
1943 const GUID IID_ID3DXFileEnumObject = DEFINE_GUID!(0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
1944 const GUID IID_ID3DXFileData = DEFINE_GUID!(0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
1945 
1946 interface ID3DXFile : IUnknown
1947 {
1948     HRESULT CreateEnumObject(LPCVOID, D3DXF_FILELOADOPTIONS, ID3DXFileEnumObject*);
1949     HRESULT CreateSaveObject(LPCVOID, D3DXF_FILESAVEOPTIONS, D3DXF_FILEFORMAT, ID3DXFileSaveObject*);
1950     HRESULT RegisterTemplates(LPCVOID, size_t);
1951     HRESULT RegisterEnumTemplates(ID3DXFileEnumObject);
1952 }
1953 
1954 interface ID3DXFileSaveObject : IUnknown
1955 {
1956     HRESULT GetFile(ID3DXFile*);
1957     HRESULT AddDataObject(GUID*, LPCSTR, GUID*, size_t, LPCVOID, ID3DXFileSaveData*);
1958     HRESULT Save();
1959 }
1960 
1961 interface ID3DXFileSaveData : IUnknown
1962 {
1963     HRESULT GetSave(ID3DXFileSaveObject*);
1964     HRESULT GetName(LPSTR, size_t*);
1965     HRESULT GetId(GUID*);
1966     HRESULT GetType(GUID*);
1967     HRESULT AddDataObject(GUID*, LPCSTR, GUID*, size_t, LPCVOID, ID3DXFileSaveData*);
1968     HRESULT AddDataReference(LPCSTR, GUID* );
1969 }
1970 
1971 interface ID3DXFileEnumObject : IUnknown
1972 {
1973     HRESULT GetFile(ID3DXFile*);
1974     HRESULT GetChildren(size_t*);
1975     HRESULT GetChild(size_t, ID3DXFileData*);
1976     HRESULT GetDataObjectById(REFGUID, ID3DXFileData*);
1977     HRESULT GetDataObjectByName(LPCSTR, ID3DXFileData*);
1978 }
1979 
1980 interface ID3DXFileData : IUnknown
1981 {
1982     HRESULT GetEnum(ID3DXFileEnumObject*);
1983     HRESULT GetName(LPSTR, size_t*);
1984     HRESULT GetId(GUID*);
1985     HRESULT Lock(size_t*, LPCVOID*);
1986     HRESULT Unlock();
1987     HRESULT GetType(GUID*);
1988     BOOL IsReference();
1989     HRESULT GetChildren(size_t*);
1990     HRESULT GetChild(size_t, ID3DXFileData*);
1991 }