2 * Copyright 2007,2010 Vijay Kiran Kamuju
3 * Copyright 2007 David ADAM
4 * Copyright 2010 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __D3DRMDEFS_H__
22 #define __D3DRMDEFS_H__
27 #if defined(__cplusplus)
31 typedef struct _D3DRMVECTOR4D
37 } D3DRMVECTOR4D
, *LPD3DRMVECTOR4D
;
39 typedef D3DVALUE D3DRMMATRIX4D
[4][4];
41 typedef struct _D3DRMQUATERNION
{
44 } D3DRMQUATERNION
, *LPD3DRMQUATERNION
;
46 typedef struct _D3DRMRAY
{
49 } D3DRMRAY
, *LPD3DRMRAY
;
51 typedef struct _D3DRMBOX
{
54 } D3DRMBOX
, *LPD3DRMBOX
;
56 typedef void (*D3DRMWRAPCALLBACK
)
57 (LPD3DVECTOR
, int* u
, int* v
, LPD3DVECTOR a
, LPD3DVECTOR b
, LPVOID
);
59 typedef enum _D3DRMLIGHTTYPE
{
63 D3DRMLIGHT_DIRECTIONAL
,
64 D3DRMLIGHT_PARALLELPOINT
65 } D3DRMLIGHTTYPE
, *LPD3DRMLIGHTTYPE
;
67 typedef enum _D3DRMSHADEMODE
{
69 D3DRMSHADE_GOURAUD
= 1,
73 } D3DRMSHADEMODE
, *LPD3DRMSHADEMODE
;
75 typedef enum _D3DRMLIGHTMODE
{
76 D3DRMLIGHT_OFF
= 0 * D3DRMSHADE_MAX
,
77 D3DRMLIGHT_ON
= 1 * D3DRMSHADE_MAX
,
78 D3DRMLIGHT_MASK
= 7 * D3DRMSHADE_MAX
,
79 D3DRMLIGHT_MAX
= 8 * D3DRMSHADE_MAX
80 } D3DRMLIGHTMODE
, *LPD3DRMLIGHTMODE
;
82 typedef enum _D3DRMFILLMODE
{
83 D3DRMFILL_POINTS
= 0 * D3DRMLIGHT_MAX
,
84 D3DRMFILL_WIREFRAME
= 1 * D3DRMLIGHT_MAX
,
85 D3DRMFILL_SOLID
= 2 * D3DRMLIGHT_MAX
,
86 D3DRMFILL_MASK
= 7 * D3DRMLIGHT_MAX
,
87 D3DRMFILL_MAX
= 8 * D3DRMLIGHT_MAX
88 } D3DRMFILLMODE
, *LPD3DRMFILLMODE
;
90 typedef DWORD D3DRMRENDERQUALITY
, *LPD3DRMRENDERQUALITY
;
92 #define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
93 #define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
94 #define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
95 #define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
96 #define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID
98 #define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
99 #define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
100 #define D3DRMRENDERMODE_LIGHTINMODELSPACE 8
101 #define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16
102 #define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32
104 typedef enum _D3DRMTEXTUREQUALITY
{
105 D3DRMTEXTURE_NEAREST
,
107 D3DRMTEXTURE_MIPNEAREST
,
108 D3DRMTEXTURE_MIPLINEAR
,
109 D3DRMTEXTURE_LINEARMIPNEAREST
,
110 D3DRMTEXTURE_LINEARMIPLINEAR
111 } D3DRMTEXTUREQUALITY
, *LPD3DRMTEXTUREQUALITY
;
113 #define D3DRMTEXTURE_FORCERESIDENT 0x00000001
114 #define D3DRMTEXTURE_STATIC 0x00000002
115 #define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004
116 #define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008
117 #define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010
118 #define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020
119 #define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040
120 #define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080
121 #define D3DRMTEXTURE_INVALIDATEONLY 0x00000100
123 #define D3DRMSHADOW_TRUEALPHA 0x00000001
125 typedef enum _D3DRMCOMBINETYPE
{
126 D3DRMCOMBINE_REPLACE
,
129 } D3DRMCOMBINETYPE
, *LPD3DRMCOMBINETYPE
;
131 typedef D3DCOLORMODEL D3DRMCOLORMODEL
, *LPD3DRMCOLORMODEL
;
133 typedef enum _D3DRMPALETTEFLAGS
136 D3DRMPALETTE_READONLY
,
137 D3DRMPALETTE_RESERVED
138 } D3DRMPALETTEFLAGS
, *LPD3DRMPALETTEFLAGS
;
140 typedef struct _D3DRMPALETTEENTRY
{
145 } D3DRMPALETTEENTRY
, *LPD3DRMPALETTEENTRY
;
147 typedef struct _D3DRMIMAGE
{
157 unsigned long red_mask
;
158 unsigned long green_mask
;
159 unsigned long blue_mask
;
160 unsigned long alpha_mask
;
162 D3DRMPALETTEENTRY
* palette
;
163 } D3DRMIMAGE
, *LPD3DRMIMAGE
;
165 typedef enum _D3DRMWRAPTYPE
{
172 } D3DRMWRAPTYPE
, *LPD3DRMWRAPTYPE
;
174 #define D3DRMWIREFRAME_CULL 1
175 #define D3DRMWIREFRAME_HIDDENLINE 2
177 typedef enum _D3DRMPROJECTIONTYPE
179 D3DRMPROJECT_PERSPECTIVE
,
180 D3DRMPROJECT_ORTHOGRAPHIC
,
181 D3DRMPROJECT_RIGHTHANDPERSPECTIVE
,
182 D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC
183 } D3DRMPROJECTIONTYPE
, *LPD3DRMPROJECTIONTYPE
;
185 #define D3DRMOPTIONS_LEFTHANDED 0x00000001
186 #define D3DRMOPTIONS_RIGHTHANDED 0x00000002
188 typedef enum _D3DRMXOFFORMAT
{
192 } D3DRMXOFFORMAT
, *LPD3DRMXOFFORMAT
;
194 typedef DWORD D3DRMSAVEOPTIONS
;
195 #define D3DRMXOFSAVE_NORMALS 1
196 #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
197 #define D3DRMXOFSAVE_MATERIALS 4
198 #define D3DRMXOFSAVE_TEXTURENAMES 8
199 #define D3DRMXOFSAVE_ALL 15
200 #define D3DRMXOFSAVE_TEMPLATES 16
201 #define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
203 typedef enum _D3DRMCOLORSOURCE
{
205 D3DRMCOLOR_FROMVERTEX
206 } D3DRMCOLORSOURCE
, *LPD3DRMCOLORSOURCE
;
208 typedef enum _D3DRMFRAMECONSTRAINT
{
212 } D3DRMFRAMECONSTRAINT
, *LPD3DRMFRAMECONSTRAINT
;
214 typedef enum _D3DRMMATERIALMODE
{
215 D3DRMMATERIAL_FROMMESH
,
216 D3DRMMATERIAL_FROMPARENT
,
217 D3DRMMATERIAL_FROMFRAME
218 } D3DRMMATERIALMODE
, *LPD3DRMMATERIALMODE
;
220 typedef enum _D3DRMFOGMODE
{
222 D3DRMFOG_EXPONENTIAL
,
223 D3DRMFOG_EXPONENTIALSQUARED
224 } D3DRMFOGMODE
, *LPD3DRMFOGMODE
;
226 typedef enum _D3DRMZBUFFERMODE
{
227 D3DRMZBUFFER_FROMPARENT
,
230 } D3DRMZBUFFERMODE
, *LPD3DRMZBUFFERMODE
;
232 typedef enum _D3DRMSORTMODE
{
233 D3DRMSORT_FROMPARENT
,
235 D3DRMSORT_FRONTTOBACK
,
236 D3DRMSORT_BACKTOFRONT
237 } D3DRMSORTMODE
, *LPD3DRMSORTMODE
;
239 typedef struct _D3DRMMATERIALOVERRIDE
{
242 D3DCOLORVALUE dcDiffuse
;
243 D3DCOLORVALUE dcAmbient
;
244 D3DCOLORVALUE dcEmissive
;
245 D3DCOLORVALUE dcSpecular
;
247 LPUNKNOWN lpD3DRMTex
;
248 } D3DRMMATERIALOVERRIDE
, *LPD3DRMMATERIALOVERRIDE
;
250 #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001
251 #define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002
252 #define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003
253 #define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004
254 #define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008
255 #define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010
256 #define D3DRMMATERIALOVERRIDE_POWER 0x00000020
257 #define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040
258 #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080
259 #define D3DRMMATERIALOVERRIDE_ALL 0x000000FF
261 #define D3DRMFPTF_ALPHA 0x00000001
262 #define D3DRMFPTF_NOALPHA 0x00000002
263 #define D3DRMFPTF_PALETTIZED 0x00000004
264 #define D3DRMFPTF_NOTPALETTIZED 0x00000008
266 #define D3DRMSTATECHANGE_UPDATEONLY 0x000000001
267 #define D3DRMSTATECHANGE_VOLATILE 0x000000002
268 #define D3DRMSTATECHANGE_NONVOLATILE 0x000000004
269 #define D3DRMSTATECHANGE_RENDER 0x000000020
270 #define D3DRMSTATECHANGE_LIGHT 0x000000040
272 #define D3DRMDEVICE_NOZBUFFER 0x00000001
274 #define D3DRMCALLBACK_PREORDER 0
275 #define D3DRMCALLBACK_POSTORDER 1
277 #define D3DRMRAYPICK_ONLYBOUNDINGBOXES 0x01
278 #define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 0x02
279 #define D3DRMRAYPICK_INTERPOLATEUV 0x04
280 #define D3DRMRAYPICK_INTERPOLATECOLOR 0x08
281 #define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
283 #define D3DRMADDFACES_VERTICESONLY 1
285 #define D3DRMGENERATENORMALS_PRECOMPACT 1
286 #define D3DRMGENERATENORMALS_USECREASEANGLE 2
288 #define D3DRMMESHBUILDER_DIRECTPARENT 1
289 #define D3DRMMESHBUILDER_ROOTMESH 2
291 #define D3DRMMESHBUILDER_RENDERENABLE 0x00000001
292 #define D3DRMMESHBUILDER_PICKENABLE 0x00000002
294 #define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1
295 #define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2
296 #define D3DRMADDMESHBUILDER_NOSUBMESHES 4
298 #define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001
299 #define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002
300 #define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004
302 #define D3DRMFVF_TYPE 0x00000001
303 #define D3DRMFVF_NORMAL 0x00000002
304 #define D3DRMFVF_COLOR 0x00000004
305 #define D3DRMFVF_TEXTURECOORDS 0x00000008
307 #define D3DRMVERTEX_STRIP 0x00000001
308 #define D3DRMVERTEX_FAN 0x00000002
309 #define D3DRMVERTEX_LIST 0x00000004
311 #define D3DRMCLEAR_TARGET 0x00000001
312 #define D3DRMCLEAR_ZBUFFER 0x00000002
313 #define D3DRMCLEAR_DIRTYRECTS 0x00000004
314 #define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | D3DRMCLEAR_ZBUFFER | D3DRMCLEAR_DIRTYRECTS)
316 #define D3DRMFOGMETHOD_VERTEX 0x00000001
317 #define D3DRMFOGMETHOD_TABLE 0x00000002
318 #define D3DRMFOGMETHOD_ANY 0x00000004
320 #define D3DRMFRAME_RENDERENABLE 0x00000001
321 #define D3DRMFRAME_PICKENABLE 0x00000002
323 typedef DWORD D3DRMANIMATIONOPTIONS
;
324 #define D3DRMANIMATION_OPEN 0x00000001
325 #define D3DRMANIMATION_CLOSED 0x00000002
326 #define D3DRMANIMATION_LINEARPOSITION 0x00000004
327 #define D3DRMANIMATION_SPLINEPOSITION 0x00000008
328 #define D3DRMANIMATION_SCALEANDROTATION 0x00000010
329 #define D3DRMANIMATION_POSITION 0x00000020
331 typedef DWORD D3DRMINTERPOLATIONOPTIONS
;
332 #define D3DRMINTERPOLATION_OPEN 0x0001
333 #define D3DRMINTERPOLATION_CLOSED 0x0002
334 #define D3DRMINTERPOLATION_NEAREST 0x0100
335 #define D3DRMINTERPOLATION_LINEAR 0x0004
336 #define D3DRMINTERPOLATION_SPLINE 0x0008
337 #define D3DRMINTERPOLATION_VERTEXCOLOR 0x0040
338 #define D3DRMINTERPOLATION_SLERPNORMALS 0x0080
340 typedef DWORD D3DRMLOADOPTIONS
;
342 #define D3DRMLOAD_FROMFILE __MSABI_LONG(0x000)
343 #define D3DRMLOAD_FROMRESOURCE __MSABI_LONG(0x001)
344 #define D3DRMLOAD_FROMMEMORY __MSABI_LONG(0x002)
345 #define D3DRMLOAD_FROMSTREAM __MSABI_LONG(0x004)
346 #define D3DRMLOAD_FROMURL __MSABI_LONG(0x008)
348 #define D3DRMLOAD_BYNAME __MSABI_LONG(0x010)
349 #define D3DRMLOAD_BYPOSITION __MSABI_LONG(0x020)
350 #define D3DRMLOAD_BYGUID __MSABI_LONG(0x040)
351 #define D3DRMLOAD_FIRST __MSABI_LONG(0x080)
353 #define D3DRMLOAD_INSTANCEBYREFERENCE __MSABI_LONG(0x100)
354 #define D3DRMLOAD_INSTANCEBYCOPYING __MSABI_LONG(0x200)
356 #define D3DRMLOAD_ASYNCHRONOUS __MSABI_LONG(0x400)
358 typedef struct _D3DRMLOADRESOURCE
{
360 LPCSTR
/*LPCTSTR*/ lpName
;
361 LPCSTR
/*LPCTSTR*/ lpType
;
362 } D3DRMLOADRESOURCE
, *LPD3DRMLOADRESOURCE
;
364 typedef struct _D3DRMLOADMEMORY
{
367 } D3DRMLOADMEMORY
, *LPD3DRMLOADMEMORY
;
369 #define D3DRMPMESHSTATUS_VALID 0x01
370 #define D3DRMPMESHSTATUS_INTERRUPTED 0x02
371 #define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04
372 #define D3DRMPMESHSTATUS_COMPLETE 0x08
373 #define D3DRMPMESHSTATUS_RENDERABLE 0x10
375 #define D3DRMPMESHEVENT_BASEMESH 0x01
376 #define D3DRMPMESHEVENT_COMPLETE 0x02
378 typedef struct _D3DRMPMESHLOADSTATUS
{
381 DWORD dwBaseMeshSize
;
383 DWORD dwVerticesLoaded
;
385 HRESULT dwLoadResult
;
387 } D3DRMPMESHLOADSTATUS
, *LPD3DRMPMESHLOADSTATUS
;
389 typedef enum _D3DRMUSERVISUALREASON
{
390 D3DRMUSERVISUAL_CANSEE
,
391 D3DRMUSERVISUAL_RENDER
392 } D3DRMUSERVISUALREASON
, *LPD3DRMUSERVISUALREASON
;
394 typedef struct _D3DRMANIMATIONKEY
400 #if !defined(__cplusplus) || !defined(D3D_OVERLOADS)
403 D3DRMQUATERNION dqRotateKey
;
404 D3DVECTOR dvScaleKey
;
405 D3DVECTOR dvPositionKey
;
411 typedef D3DRMANIMATIONKEY
*LPD3DRMANIMATIONKEY
;
413 #define D3DRMANIMATION_ROTATEKEY 0x01
414 #define D3DRMANIMATION_SCALEKEY 0x02
415 #define D3DRMANIMATION_POSITIONKEY 0x03
417 typedef DWORD D3DRMMAPPING
, D3DRMMAPPINGFLAG
, *LPD3DRMMAPPING
;
418 static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU
= 1;
419 static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV
= 2;
420 static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT
= 4;
422 typedef struct _D3DRMVERTEX
{
428 } D3DRMVERTEX
, *LPD3DRMVERTEX
;
430 typedef LONG D3DRMGROUPINDEX
;
431 static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS
= -1;
433 void WINAPI
D3DRMMatrixFromQuaternion(D3DRMMATRIX4D
, LPD3DRMQUATERNION
);
435 LPD3DRMQUATERNION WINAPI
D3DRMQuaternionFromRotation(LPD3DRMQUATERNION
,LPD3DVECTOR
,D3DVALUE
);
436 LPD3DRMQUATERNION WINAPI
D3DRMQuaternionMultiply(LPD3DRMQUATERNION
, LPD3DRMQUATERNION
, LPD3DRMQUATERNION
);
437 LPD3DRMQUATERNION WINAPI
D3DRMQuaternionSlerp(LPD3DRMQUATERNION
, LPD3DRMQUATERNION
, LPD3DRMQUATERNION
, D3DVALUE
);
439 LPD3DVECTOR WINAPI
D3DRMVectorAdd(LPD3DVECTOR
, LPD3DVECTOR
, LPD3DVECTOR
);
440 LPD3DVECTOR WINAPI
D3DRMVectorCrossProduct(LPD3DVECTOR
, LPD3DVECTOR
, LPD3DVECTOR
);
441 D3DVALUE WINAPI
D3DRMVectorDotProduct(LPD3DVECTOR
, LPD3DVECTOR
);
442 LPD3DVECTOR WINAPI
D3DRMVectorNormalize(LPD3DVECTOR
);
444 #define D3DRMVectorNormalise D3DRMVectorNormalize
446 D3DVALUE WINAPI
D3DRMVectorModulus(LPD3DVECTOR
);
447 LPD3DVECTOR WINAPI
D3DRMVectorRandom(LPD3DVECTOR
);
448 LPD3DVECTOR WINAPI
D3DRMVectorRotate(LPD3DVECTOR
, LPD3DVECTOR
, LPD3DVECTOR
, D3DVALUE
);
449 LPD3DVECTOR WINAPI
D3DRMVectorReflect(LPD3DVECTOR
, LPD3DVECTOR
, LPD3DVECTOR
);
450 LPD3DVECTOR WINAPI
D3DRMVectorScale(LPD3DVECTOR
, LPD3DVECTOR
, D3DVALUE
);
451 LPD3DVECTOR WINAPI
D3DRMVectorSubtract(LPD3DVECTOR
, LPD3DVECTOR
, LPD3DVECTOR
);
453 D3DCOLOR WINAPI
D3DRMCreateColorRGB(D3DVALUE
, D3DVALUE
, D3DVALUE
);
454 D3DCOLOR WINAPI
D3DRMCreateColorRGBA(D3DVALUE
, D3DVALUE
, D3DVALUE
, D3DVALUE
);
455 D3DVALUE WINAPI
D3DRMColorGetAlpha(D3DCOLOR
);
456 D3DVALUE WINAPI
D3DRMColorGetBlue(D3DCOLOR
);
457 D3DVALUE WINAPI
D3DRMColorGetGreen(D3DCOLOR
);
458 D3DVALUE WINAPI
D3DRMColorGetRed(D3DCOLOR
);
460 #if defined(__cplusplus)