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
)(D3DVECTOR
*vec
, int *u
, int *v
, D3DVECTOR
*a
, D3DVECTOR
*b
, void *ctx
);
58 typedef enum _D3DRMLIGHTTYPE
{
62 D3DRMLIGHT_DIRECTIONAL
,
63 D3DRMLIGHT_PARALLELPOINT
64 } D3DRMLIGHTTYPE
, *LPD3DRMLIGHTTYPE
;
66 typedef enum _D3DRMSHADEMODE
{
68 D3DRMSHADE_GOURAUD
= 1,
72 } D3DRMSHADEMODE
, *LPD3DRMSHADEMODE
;
74 typedef enum _D3DRMLIGHTMODE
{
75 D3DRMLIGHT_OFF
= 0 * D3DRMSHADE_MAX
,
76 D3DRMLIGHT_ON
= 1 * D3DRMSHADE_MAX
,
77 D3DRMLIGHT_MASK
= 7 * D3DRMSHADE_MAX
,
78 D3DRMLIGHT_MAX
= 8 * D3DRMSHADE_MAX
79 } D3DRMLIGHTMODE
, *LPD3DRMLIGHTMODE
;
81 typedef enum _D3DRMFILLMODE
{
82 D3DRMFILL_POINTS
= 0 * D3DRMLIGHT_MAX
,
83 D3DRMFILL_WIREFRAME
= 1 * D3DRMLIGHT_MAX
,
84 D3DRMFILL_SOLID
= 2 * D3DRMLIGHT_MAX
,
85 D3DRMFILL_MASK
= 7 * D3DRMLIGHT_MAX
,
86 D3DRMFILL_MAX
= 8 * D3DRMLIGHT_MAX
87 } D3DRMFILLMODE
, *LPD3DRMFILLMODE
;
89 typedef DWORD D3DRMRENDERQUALITY
, *LPD3DRMRENDERQUALITY
;
91 #define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
92 #define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
93 #define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
94 #define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
95 #define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID
97 #define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
98 #define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
99 #define D3DRMRENDERMODE_LIGHTINMODELSPACE 8
100 #define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16
101 #define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32
103 typedef enum _D3DRMTEXTUREQUALITY
{
104 D3DRMTEXTURE_NEAREST
,
106 D3DRMTEXTURE_MIPNEAREST
,
107 D3DRMTEXTURE_MIPLINEAR
,
108 D3DRMTEXTURE_LINEARMIPNEAREST
,
109 D3DRMTEXTURE_LINEARMIPLINEAR
110 } D3DRMTEXTUREQUALITY
, *LPD3DRMTEXTUREQUALITY
;
112 #define D3DRMTEXTURE_FORCERESIDENT 0x00000001
113 #define D3DRMTEXTURE_STATIC 0x00000002
114 #define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004
115 #define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008
116 #define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010
117 #define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020
118 #define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040
119 #define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080
120 #define D3DRMTEXTURE_INVALIDATEONLY 0x00000100
122 #define D3DRMSHADOW_TRUEALPHA 0x00000001
124 typedef enum _D3DRMCOMBINETYPE
{
125 D3DRMCOMBINE_REPLACE
,
128 } D3DRMCOMBINETYPE
, *LPD3DRMCOMBINETYPE
;
130 typedef D3DCOLORMODEL D3DRMCOLORMODEL
, *LPD3DRMCOLORMODEL
;
132 typedef enum _D3DRMPALETTEFLAGS
135 D3DRMPALETTE_READONLY
,
136 D3DRMPALETTE_RESERVED
137 } D3DRMPALETTEFLAGS
, *LPD3DRMPALETTEFLAGS
;
139 typedef struct _D3DRMPALETTEENTRY
{
144 } D3DRMPALETTEENTRY
, *LPD3DRMPALETTEENTRY
;
146 typedef struct _D3DRMIMAGE
{
161 D3DRMPALETTEENTRY
* palette
;
162 } D3DRMIMAGE
, *LPD3DRMIMAGE
;
164 typedef enum _D3DRMWRAPTYPE
{
171 } D3DRMWRAPTYPE
, *LPD3DRMWRAPTYPE
;
173 #define D3DRMWIREFRAME_CULL 1
174 #define D3DRMWIREFRAME_HIDDENLINE 2
176 typedef enum _D3DRMPROJECTIONTYPE
178 D3DRMPROJECT_PERSPECTIVE
,
179 D3DRMPROJECT_ORTHOGRAPHIC
,
180 D3DRMPROJECT_RIGHTHANDPERSPECTIVE
,
181 D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC
182 } D3DRMPROJECTIONTYPE
, *LPD3DRMPROJECTIONTYPE
;
184 #define D3DRMOPTIONS_LEFTHANDED 0x00000001
185 #define D3DRMOPTIONS_RIGHTHANDED 0x00000002
187 typedef enum _D3DRMXOFFORMAT
{
191 } D3DRMXOFFORMAT
, *LPD3DRMXOFFORMAT
;
193 typedef DWORD D3DRMSAVEOPTIONS
;
194 #define D3DRMXOFSAVE_NORMALS 1
195 #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
196 #define D3DRMXOFSAVE_MATERIALS 4
197 #define D3DRMXOFSAVE_TEXTURENAMES 8
198 #define D3DRMXOFSAVE_ALL 15
199 #define D3DRMXOFSAVE_TEMPLATES 16
200 #define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
202 typedef enum _D3DRMCOLORSOURCE
{
204 D3DRMCOLOR_FROMVERTEX
205 } D3DRMCOLORSOURCE
, *LPD3DRMCOLORSOURCE
;
207 typedef enum _D3DRMFRAMECONSTRAINT
{
211 } D3DRMFRAMECONSTRAINT
, *LPD3DRMFRAMECONSTRAINT
;
213 typedef enum _D3DRMMATERIALMODE
{
214 D3DRMMATERIAL_FROMMESH
,
215 D3DRMMATERIAL_FROMPARENT
,
216 D3DRMMATERIAL_FROMFRAME
217 } D3DRMMATERIALMODE
, *LPD3DRMMATERIALMODE
;
219 typedef enum _D3DRMFOGMODE
{
221 D3DRMFOG_EXPONENTIAL
,
222 D3DRMFOG_EXPONENTIALSQUARED
223 } D3DRMFOGMODE
, *LPD3DRMFOGMODE
;
225 typedef enum _D3DRMZBUFFERMODE
{
226 D3DRMZBUFFER_FROMPARENT
,
229 } D3DRMZBUFFERMODE
, *LPD3DRMZBUFFERMODE
;
231 typedef enum _D3DRMSORTMODE
{
232 D3DRMSORT_FROMPARENT
,
234 D3DRMSORT_FRONTTOBACK
,
235 D3DRMSORT_BACKTOFRONT
236 } D3DRMSORTMODE
, *LPD3DRMSORTMODE
;
238 typedef struct _D3DRMMATERIALOVERRIDE
{
241 D3DCOLORVALUE dcDiffuse
;
242 D3DCOLORVALUE dcAmbient
;
243 D3DCOLORVALUE dcEmissive
;
244 D3DCOLORVALUE dcSpecular
;
246 IUnknown
*lpD3DRMTex
;
247 } D3DRMMATERIALOVERRIDE
, *LPD3DRMMATERIALOVERRIDE
;
249 #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001
250 #define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002
251 #define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003
252 #define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004
253 #define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008
254 #define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010
255 #define D3DRMMATERIALOVERRIDE_POWER 0x00000020
256 #define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040
257 #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080
258 #define D3DRMMATERIALOVERRIDE_ALL 0x000000FF
260 #define D3DRMFPTF_ALPHA 0x00000001
261 #define D3DRMFPTF_NOALPHA 0x00000002
262 #define D3DRMFPTF_PALETTIZED 0x00000004
263 #define D3DRMFPTF_NOTPALETTIZED 0x00000008
265 #define D3DRMSTATECHANGE_UPDATEONLY 0x000000001
266 #define D3DRMSTATECHANGE_VOLATILE 0x000000002
267 #define D3DRMSTATECHANGE_NONVOLATILE 0x000000004
268 #define D3DRMSTATECHANGE_RENDER 0x000000020
269 #define D3DRMSTATECHANGE_LIGHT 0x000000040
271 #define D3DRMDEVICE_NOZBUFFER 0x00000001
273 #define D3DRMCALLBACK_PREORDER 0
274 #define D3DRMCALLBACK_POSTORDER 1
276 #define D3DRMRAYPICK_ONLYBOUNDINGBOXES 0x01
277 #define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 0x02
278 #define D3DRMRAYPICK_INTERPOLATEUV 0x04
279 #define D3DRMRAYPICK_INTERPOLATECOLOR 0x08
280 #define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
282 #define D3DRMADDFACES_VERTICESONLY 1
284 #define D3DRMGENERATENORMALS_PRECOMPACT 1
285 #define D3DRMGENERATENORMALS_USECREASEANGLE 2
287 #define D3DRMMESHBUILDER_DIRECTPARENT 1
288 #define D3DRMMESHBUILDER_ROOTMESH 2
290 #define D3DRMMESHBUILDER_RENDERENABLE 0x00000001
291 #define D3DRMMESHBUILDER_PICKENABLE 0x00000002
293 #define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1
294 #define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2
295 #define D3DRMADDMESHBUILDER_NOSUBMESHES 4
297 #define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001
298 #define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002
299 #define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004
301 #define D3DRMFVF_TYPE 0x00000001
302 #define D3DRMFVF_NORMAL 0x00000002
303 #define D3DRMFVF_COLOR 0x00000004
304 #define D3DRMFVF_TEXTURECOORDS 0x00000008
306 #define D3DRMVERTEX_STRIP 0x00000001
307 #define D3DRMVERTEX_FAN 0x00000002
308 #define D3DRMVERTEX_LIST 0x00000004
310 #define D3DRMCLEAR_TARGET 0x00000001
311 #define D3DRMCLEAR_ZBUFFER 0x00000002
312 #define D3DRMCLEAR_DIRTYRECTS 0x00000004
313 #define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | D3DRMCLEAR_ZBUFFER | D3DRMCLEAR_DIRTYRECTS)
315 #define D3DRMFOGMETHOD_VERTEX 0x00000001
316 #define D3DRMFOGMETHOD_TABLE 0x00000002
317 #define D3DRMFOGMETHOD_ANY 0x00000004
319 #define D3DRMFRAME_RENDERENABLE 0x00000001
320 #define D3DRMFRAME_PICKENABLE 0x00000002
322 typedef DWORD D3DRMANIMATIONOPTIONS
;
323 #define D3DRMANIMATION_OPEN 0x00000001
324 #define D3DRMANIMATION_CLOSED 0x00000002
325 #define D3DRMANIMATION_LINEARPOSITION 0x00000004
326 #define D3DRMANIMATION_SPLINEPOSITION 0x00000008
327 #define D3DRMANIMATION_SCALEANDROTATION 0x00000010
328 #define D3DRMANIMATION_POSITION 0x00000020
330 typedef DWORD D3DRMINTERPOLATIONOPTIONS
;
331 #define D3DRMINTERPOLATION_OPEN 0x0001
332 #define D3DRMINTERPOLATION_CLOSED 0x0002
333 #define D3DRMINTERPOLATION_NEAREST 0x0100
334 #define D3DRMINTERPOLATION_LINEAR 0x0004
335 #define D3DRMINTERPOLATION_SPLINE 0x0008
336 #define D3DRMINTERPOLATION_VERTEXCOLOR 0x0040
337 #define D3DRMINTERPOLATION_SLERPNORMALS 0x0080
339 typedef DWORD D3DRMLOADOPTIONS
;
341 #define D3DRMLOAD_FROMFILE __MSABI_LONG(0x000)
342 #define D3DRMLOAD_FROMRESOURCE __MSABI_LONG(0x001)
343 #define D3DRMLOAD_FROMMEMORY __MSABI_LONG(0x002)
344 #define D3DRMLOAD_FROMSTREAM __MSABI_LONG(0x004)
345 #define D3DRMLOAD_FROMURL __MSABI_LONG(0x008)
347 #define D3DRMLOAD_BYNAME __MSABI_LONG(0x010)
348 #define D3DRMLOAD_BYPOSITION __MSABI_LONG(0x020)
349 #define D3DRMLOAD_BYGUID __MSABI_LONG(0x040)
350 #define D3DRMLOAD_FIRST __MSABI_LONG(0x080)
352 #define D3DRMLOAD_INSTANCEBYREFERENCE __MSABI_LONG(0x100)
353 #define D3DRMLOAD_INSTANCEBYCOPYING __MSABI_LONG(0x200)
355 #define D3DRMLOAD_ASYNCHRONOUS __MSABI_LONG(0x400)
357 typedef struct _D3DRMLOADRESOURCE
362 } D3DRMLOADRESOURCE
, *LPD3DRMLOADRESOURCE
;
364 typedef struct _D3DRMLOADMEMORY
368 } D3DRMLOADMEMORY
, *LPD3DRMLOADMEMORY
;
370 #define D3DRMPMESHSTATUS_VALID 0x01
371 #define D3DRMPMESHSTATUS_INTERRUPTED 0x02
372 #define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04
373 #define D3DRMPMESHSTATUS_COMPLETE 0x08
374 #define D3DRMPMESHSTATUS_RENDERABLE 0x10
376 #define D3DRMPMESHEVENT_BASEMESH 0x01
377 #define D3DRMPMESHEVENT_COMPLETE 0x02
379 typedef struct _D3DRMPMESHLOADSTATUS
{
382 DWORD dwBaseMeshSize
;
384 DWORD dwVerticesLoaded
;
386 HRESULT dwLoadResult
;
388 } D3DRMPMESHLOADSTATUS
, *LPD3DRMPMESHLOADSTATUS
;
390 typedef enum _D3DRMUSERVISUALREASON
{
391 D3DRMUSERVISUAL_CANSEE
,
392 D3DRMUSERVISUAL_RENDER
393 } D3DRMUSERVISUALREASON
, *LPD3DRMUSERVISUALREASON
;
395 typedef struct _D3DRMANIMATIONKEY
401 #if !defined(__cplusplus) || !defined(D3D_OVERLOADS)
404 D3DRMQUATERNION dqRotateKey
;
405 D3DVECTOR dvScaleKey
;
406 D3DVECTOR dvPositionKey
;
412 typedef D3DRMANIMATIONKEY
*LPD3DRMANIMATIONKEY
;
414 #define D3DRMANIMATION_ROTATEKEY 0x01
415 #define D3DRMANIMATION_SCALEKEY 0x02
416 #define D3DRMANIMATION_POSITIONKEY 0x03
418 typedef DWORD D3DRMMAPPING
, D3DRMMAPPINGFLAG
, *LPD3DRMMAPPING
;
419 static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU
= 1;
420 static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV
= 2;
421 static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT
= 4;
423 typedef struct _D3DRMVERTEX
{
429 } D3DRMVERTEX
, *LPD3DRMVERTEX
;
431 typedef LONG D3DRMGROUPINDEX
;
432 static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS
= -1;
434 void WINAPI
D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m
, D3DRMQUATERNION
*q
);
436 D3DRMQUATERNION
* WINAPI
D3DRMQuaternionFromRotation(D3DRMQUATERNION
*x
, D3DVECTOR
*axis
, D3DVALUE theta
);
437 D3DRMQUATERNION
* WINAPI
D3DRMQuaternionMultiply(D3DRMQUATERNION
*ret
, D3DRMQUATERNION
*x
, D3DRMQUATERNION
*y
);
438 D3DRMQUATERNION
* WINAPI
D3DRMQuaternionSlerp(D3DRMQUATERNION
*ret
,
439 D3DRMQUATERNION
*x
, D3DRMQUATERNION
*y
, D3DVALUE alpha
);
441 D3DVECTOR
* WINAPI
D3DRMVectorAdd(D3DVECTOR
*ret
, D3DVECTOR
*x
, D3DVECTOR
*y
);
442 D3DVECTOR
* WINAPI
D3DRMVectorCrossProduct(D3DVECTOR
*ret
, D3DVECTOR
*x
, D3DVECTOR
*y
);
443 D3DVALUE WINAPI
D3DRMVectorDotProduct(D3DVECTOR
*x
, D3DVECTOR
*y
);
444 D3DVECTOR
* WINAPI
D3DRMVectorNormalize(D3DVECTOR
*x
);
446 #define D3DRMVectorNormalise D3DRMVectorNormalize
448 D3DVALUE WINAPI
D3DRMVectorModulus(D3DVECTOR
*x
);
449 D3DVECTOR
* WINAPI
D3DRMVectorRandom(D3DVECTOR
*ret
);
450 D3DVECTOR
* WINAPI
D3DRMVectorRotate(D3DVECTOR
*ret
, D3DVECTOR
*x
, D3DVECTOR
*axis
, D3DVALUE theta
);
451 D3DVECTOR
* WINAPI
D3DRMVectorReflect(D3DVECTOR
*ret
, D3DVECTOR
*ray
, D3DVECTOR
*normal
);
452 D3DVECTOR
* WINAPI
D3DRMVectorScale(D3DVECTOR
*ret
, D3DVECTOR
*x
, D3DVALUE scale
);
453 D3DVECTOR
* WINAPI
D3DRMVectorSubtract(D3DVECTOR
*ret
, D3DVECTOR
*x
, D3DVECTOR
*y
);
455 D3DCOLOR WINAPI
D3DRMCreateColorRGB(D3DVALUE
, D3DVALUE
, D3DVALUE
);
456 D3DCOLOR WINAPI
D3DRMCreateColorRGBA(D3DVALUE
, D3DVALUE
, D3DVALUE
, D3DVALUE
);
457 D3DVALUE WINAPI
D3DRMColorGetAlpha(D3DCOLOR
);
458 D3DVALUE WINAPI
D3DRMColorGetBlue(D3DCOLOR
);
459 D3DVALUE WINAPI
D3DRMColorGetGreen(D3DCOLOR
);
460 D3DVALUE WINAPI
D3DRMColorGetRed(D3DCOLOR
);
462 #if defined(__cplusplus)