Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

695 lines
21 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: d3drm.h
  6. * Content: Direct3DRM include file
  7. *
  8. ***************************************************************************/
  9. #ifndef __D3DRMDEFS_H__
  10. #define __D3DRMDEFS_H__
  11. #include <stddef.h>
  12. #include "d3dtypes.h"
  13. #ifdef WIN32
  14. #define D3DRMAPI __stdcall
  15. #else
  16. #define D3DRMAPI
  17. #endif
  18. #if defined(__cplusplus)
  19. extern "C" {
  20. #endif
  21. #ifndef TRUE
  22. #define FALSE 0
  23. #define TRUE 1
  24. #endif
  25. typedef struct _D3DRMVECTOR4D
  26. { D3DVALUE x, y, z, w;
  27. } D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
  28. typedef D3DVALUE D3DRMMATRIX4D[4][4];
  29. typedef struct _D3DRMQUATERNION
  30. { D3DVALUE s;
  31. D3DVECTOR v;
  32. } D3DRMQUATERNION, *LPD3DRMQUATERNION;
  33. typedef struct _D3DRMRAY
  34. { D3DVECTOR dvDir;
  35. D3DVECTOR dvPos;
  36. } D3DRMRAY, *LPD3DRMRAY;
  37. typedef struct _D3DRMBOX
  38. { D3DVECTOR min, max;
  39. } D3DRMBOX, *LPD3DRMBOX;
  40. typedef void (*D3DRMWRAPCALLBACK)
  41. (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
  42. typedef enum _D3DRMLIGHTTYPE
  43. { D3DRMLIGHT_AMBIENT,
  44. D3DRMLIGHT_POINT,
  45. D3DRMLIGHT_SPOT,
  46. D3DRMLIGHT_DIRECTIONAL,
  47. D3DRMLIGHT_PARALLELPOINT
  48. } D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
  49. typedef enum _D3DRMSHADEMODE {
  50. D3DRMSHADE_FLAT = 0,
  51. D3DRMSHADE_GOURAUD = 1,
  52. D3DRMSHADE_PHONG = 2,
  53. D3DRMSHADE_MASK = 7,
  54. D3DRMSHADE_MAX = 8
  55. } D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
  56. typedef enum _D3DRMLIGHTMODE {
  57. D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX,
  58. D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX,
  59. D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX,
  60. D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX
  61. } D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
  62. typedef enum _D3DRMFILLMODE {
  63. D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX,
  64. D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
  65. D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX,
  66. D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX,
  67. D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX
  68. } D3DRMFILLMODE, *LPD3DRMFILLMODE;
  69. typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
  70. #define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
  71. #define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
  72. #define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  73. #define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  74. #define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  75. #define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
  76. #define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
  77. #define D3DRMRENDERMODE_LIGHTINMODELSPACE 8
  78. #define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16
  79. #define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32
  80. typedef enum _D3DRMTEXTUREQUALITY
  81. { D3DRMTEXTURE_NEAREST, /* choose nearest texel */
  82. D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */
  83. D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */
  84. D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */
  85. D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */
  86. D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */
  87. } D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
  88. /*
  89. * Texture flags
  90. */
  91. #define D3DRMTEXTURE_FORCERESIDENT 0x00000001 /* texture should be kept in video memory */
  92. #define D3DRMTEXTURE_STATIC 0x00000002 /* texture will not change */
  93. #define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004 /* point filtering should be used when downsampling */
  94. #define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008 /* bilinear filtering should be used when downsampling */
  95. #define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010 /* reduce bit depth when downsampling */
  96. #define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020 /* texture should never be downsampled */
  97. #define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040 /* pixels have changed */
  98. #define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080 /* palette has changed */
  99. #define D3DRMTEXTURE_INVALIDATEONLY 0x00000100 /* dirty regions are invalid */
  100. /*
  101. * Shadow flags
  102. */
  103. #define D3DRMSHADOW_TRUEALPHA 0x00000001 /* shadow should render without artifacts when true alpha is on */
  104. typedef enum _D3DRMCOMBINETYPE
  105. { D3DRMCOMBINE_REPLACE,
  106. D3DRMCOMBINE_BEFORE,
  107. D3DRMCOMBINE_AFTER
  108. } D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
  109. typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
  110. typedef enum _D3DRMPALETTEFLAGS
  111. { D3DRMPALETTE_FREE, /* renderer may use this entry freely */
  112. D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */
  113. D3DRMPALETTE_RESERVED /* may not be used by renderer */
  114. } D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
  115. typedef struct _D3DRMPALETTEENTRY
  116. { unsigned char red; /* 0 .. 255 */
  117. unsigned char green; /* 0 .. 255 */
  118. unsigned char blue; /* 0 .. 255 */
  119. unsigned char flags; /* one of D3DRMPALETTEFLAGS */
  120. } D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
  121. typedef struct _D3DRMIMAGE
  122. { int width, height; /* width and height in pixels */
  123. int aspectx, aspecty; /* aspect ratio for non-square pixels */
  124. int depth; /* bits per pixel */
  125. int rgb; /* if false, pixels are indices into a
  126. palette otherwise, pixels encode
  127. RGB values. */
  128. int bytes_per_line; /* number of bytes of memory for a
  129. scanline. This must be a multiple
  130. of 4. */
  131. void* buffer1; /* memory to render into (first buffer). */
  132. void* buffer2; /* second rendering buffer for double
  133. buffering, set to NULL for single
  134. buffering. */
  135. unsigned long red_mask;
  136. unsigned long green_mask;
  137. unsigned long blue_mask;
  138. unsigned long alpha_mask; /* if rgb is true, these are masks for
  139. the red, green and blue parts of a
  140. pixel. Otherwise, these are masks
  141. for the significant bits of the
  142. red, green and blue elements in the
  143. palette. For instance, most SVGA
  144. displays use 64 intensities of red,
  145. green and blue, so the masks should
  146. all be set to 0xfc. */
  147. int palette_size; /* number of entries in palette */
  148. D3DRMPALETTEENTRY* palette; /* description of the palette (only if
  149. rgb is false). Must be (1<<depth)
  150. elements. */
  151. } D3DRMIMAGE, *LPD3DRMIMAGE;
  152. typedef enum _D3DRMWRAPTYPE
  153. { D3DRMWRAP_FLAT,
  154. D3DRMWRAP_CYLINDER,
  155. D3DRMWRAP_SPHERE,
  156. D3DRMWRAP_CHROME,
  157. D3DRMWRAP_SHEET,
  158. D3DRMWRAP_BOX
  159. } D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
  160. #define D3DRMWIREFRAME_CULL 1 /* cull backfaces */
  161. #define D3DRMWIREFRAME_HIDDENLINE 2 /* lines are obscured by closer objects */
  162. /*
  163. * Do not use righthanded perspective in Viewport2::SetProjection().
  164. * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  165. */
  166. typedef enum _D3DRMPROJECTIONTYPE
  167. { D3DRMPROJECT_PERSPECTIVE,
  168. D3DRMPROJECT_ORTHOGRAPHIC,
  169. D3DRMPROJECT_RIGHTHANDPERSPECTIVE, /* Only valid pre-DX6 */
  170. D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC /* Only valid pre-DX6 */
  171. } D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
  172. #define D3DRMOPTIONS_LEFTHANDED 0x00000001L /* Default */
  173. #define D3DRMOPTIONS_RIGHTHANDED 0x00000002L
  174. typedef enum _D3DRMXOFFORMAT
  175. { D3DRMXOF_BINARY,
  176. D3DRMXOF_COMPRESSED,
  177. D3DRMXOF_TEXT
  178. } D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
  179. typedef DWORD D3DRMSAVEOPTIONS;
  180. #define D3DRMXOFSAVE_NORMALS 1
  181. #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
  182. #define D3DRMXOFSAVE_MATERIALS 4
  183. #define D3DRMXOFSAVE_TEXTURENAMES 8
  184. #define D3DRMXOFSAVE_ALL 15
  185. #define D3DRMXOFSAVE_TEMPLATES 16
  186. #define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
  187. typedef enum _D3DRMCOLORSOURCE
  188. { D3DRMCOLOR_FROMFACE,
  189. D3DRMCOLOR_FROMVERTEX
  190. } D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
  191. typedef enum _D3DRMFRAMECONSTRAINT
  192. { D3DRMCONSTRAIN_Z, /* use only X and Y rotations */
  193. D3DRMCONSTRAIN_Y, /* use only X and Z rotations */
  194. D3DRMCONSTRAIN_X /* use only Y and Z rotations */
  195. } D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
  196. typedef enum _D3DRMMATERIALMODE
  197. { D3DRMMATERIAL_FROMMESH,
  198. D3DRMMATERIAL_FROMPARENT,
  199. D3DRMMATERIAL_FROMFRAME
  200. } D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
  201. typedef enum _D3DRMFOGMODE
  202. { D3DRMFOG_LINEAR, /* linear between start and end */
  203. D3DRMFOG_EXPONENTIAL, /* density * exp(-distance) */
  204. D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
  205. } D3DRMFOGMODE, *LPD3DRMFOGMODE;
  206. typedef enum _D3DRMZBUFFERMODE {
  207. D3DRMZBUFFER_FROMPARENT, /* default */
  208. D3DRMZBUFFER_ENABLE, /* enable zbuffering */
  209. D3DRMZBUFFER_DISABLE /* disable zbuffering */
  210. } D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
  211. typedef enum _D3DRMSORTMODE {
  212. D3DRMSORT_FROMPARENT, /* default */
  213. D3DRMSORT_NONE, /* don't sort child frames */
  214. D3DRMSORT_FRONTTOBACK, /* sort child frames front-to-back */
  215. D3DRMSORT_BACKTOFRONT /* sort child frames back-to-front */
  216. } D3DRMSORTMODE, *LPD3DRMSORTMODE;
  217. typedef struct _D3DRMMATERIALOVERRIDE
  218. {
  219. DWORD dwSize; /* Size of this structure */
  220. DWORD dwFlags; /* Indicate which fields are valid */
  221. D3DCOLORVALUE dcDiffuse; /* RGBA */
  222. D3DCOLORVALUE dcAmbient; /* RGB */
  223. D3DCOLORVALUE dcEmissive; /* RGB */
  224. D3DCOLORVALUE dcSpecular; /* RGB */
  225. D3DVALUE dvPower;
  226. LPUNKNOWN lpD3DRMTex;
  227. } D3DRMMATERIALOVERRIDE, *LPD3DRMMATERIALOVERRIDE;
  228. #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001L
  229. #define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002L
  230. #define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003L
  231. #define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004L
  232. #define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008L
  233. #define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010L
  234. #define D3DRMMATERIALOVERRIDE_POWER 0x00000020L
  235. #define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040L
  236. #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080L
  237. #define D3DRMMATERIALOVERRIDE_ALL 0x000000FFL
  238. #define D3DRMFPTF_ALPHA 0x00000001L
  239. #define D3DRMFPTF_NOALPHA 0x00000002L
  240. #define D3DRMFPTF_PALETTIZED 0x00000004L
  241. #define D3DRMFPTF_NOTPALETTIZED 0x00000008L
  242. #define D3DRMSTATECHANGE_UPDATEONLY 0x000000001L
  243. #define D3DRMSTATECHANGE_VOLATILE 0x000000002L
  244. #define D3DRMSTATECHANGE_NONVOLATILE 0x000000004L
  245. #define D3DRMSTATECHANGE_RENDER 0x000000020L
  246. #define D3DRMSTATECHANGE_LIGHT 0x000000040L
  247. /*
  248. * Values for flags in RM3::CreateDeviceFromSurface
  249. */
  250. #define D3DRMDEVICE_NOZBUFFER 0x00000001L
  251. /*
  252. * Values for flags in Object2::SetClientData
  253. */
  254. #define D3DRMCLIENTDATA_NONE 0x00000001L
  255. #define D3DRMCLIENTDATA_LOCALFREE 0x00000002L
  256. #define D3DRMCLIENTDATA_IUNKNOWN 0x00000004L
  257. /*
  258. * Values for flags in Frame2::AddMoveCallback.
  259. */
  260. #define D3DRMCALLBACK_PREORDER 0
  261. #define D3DRMCALLBACK_POSTORDER 1
  262. /*
  263. * Values for flags in MeshBuilder2::RayPick.
  264. */
  265. #define D3DRMRAYPICK_ONLYBOUNDINGBOXES 1
  266. #define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 2
  267. #define D3DRMRAYPICK_INTERPOLATEUV 4
  268. #define D3DRMRAYPICK_INTERPOLATECOLOR 8
  269. #define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
  270. /*
  271. * Values for flags in MeshBuilder3::AddFacesIndexed.
  272. */
  273. #define D3DRMADDFACES_VERTICESONLY 1
  274. /*
  275. * Values for flags in MeshBuilder2::GenerateNormals.
  276. */
  277. #define D3DRMGENERATENORMALS_PRECOMPACT 1
  278. #define D3DRMGENERATENORMALS_USECREASEANGLE 2
  279. /*
  280. * Values for MeshBuilder3::GetParentMesh
  281. */
  282. #define D3DRMMESHBUILDER_DIRECTPARENT 1
  283. #define D3DRMMESHBUILDER_ROOTMESH 2
  284. /*
  285. * Flags for MeshBuilder3::Enable
  286. */
  287. #define D3DRMMESHBUILDER_RENDERENABLE 0x00000001L
  288. #define D3DRMMESHBUILDER_PICKENABLE 0x00000002L
  289. /*
  290. * Flags for MeshBuilder3::AddMeshBuilder
  291. */
  292. #define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1
  293. #define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2
  294. #define D3DRMADDMESHBUILDER_NOSUBMESHES 4
  295. /*
  296. * Flags for Object2::GetAge when used with MeshBuilders
  297. */
  298. #define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001L
  299. #define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002L
  300. #define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004L
  301. /*
  302. * Format flags for MeshBuilder3::AddTriangles.
  303. */
  304. #define D3DRMFVF_TYPE 0x00000001L
  305. #define D3DRMFVF_NORMAL 0x00000002L
  306. #define D3DRMFVF_COLOR 0x00000004L
  307. #define D3DRMFVF_TEXTURECOORDS 0x00000008L
  308. #define D3DRMVERTEX_STRIP 0x00000001L
  309. #define D3DRMVERTEX_FAN 0x00000002L
  310. #define D3DRMVERTEX_LIST 0x00000004L
  311. /*
  312. * Values for flags in Viewport2::Clear2
  313. */
  314. #define D3DRMCLEAR_TARGET 0x00000001L
  315. #define D3DRMCLEAR_ZBUFFER 0x00000002L
  316. #define D3DRMCLEAR_DIRTYRECTS 0x00000004L
  317. #define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | \
  318. D3DRMCLEAR_ZBUFFER | \
  319. D3DRMCLEAR_DIRTYRECTS)
  320. /*
  321. * Values for flags in Frame3::SetSceneFogMethod
  322. */
  323. #define D3DRMFOGMETHOD_VERTEX 0x00000001L
  324. #define D3DRMFOGMETHOD_TABLE 0x00000002L
  325. #define D3DRMFOGMETHOD_ANY 0x00000004L
  326. /*
  327. * Values for flags in Frame3::SetTraversalOptions
  328. */
  329. #define D3DRMFRAME_RENDERENABLE 0x00000001L
  330. #define D3DRMFRAME_PICKENABLE 0x00000002L
  331. typedef DWORD D3DRMANIMATIONOPTIONS;
  332. #define D3DRMANIMATION_OPEN 0x01L
  333. #define D3DRMANIMATION_CLOSED 0x02L
  334. #define D3DRMANIMATION_LINEARPOSITION 0x04L
  335. #define D3DRMANIMATION_SPLINEPOSITION 0x08L
  336. #define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
  337. #define D3DRMANIMATION_POSITION 0x00000020L
  338. typedef DWORD D3DRMINTERPOLATIONOPTIONS;
  339. #define D3DRMINTERPOLATION_OPEN 0x01L
  340. #define D3DRMINTERPOLATION_CLOSED 0x02L
  341. #define D3DRMINTERPOLATION_NEAREST 0x0100L
  342. #define D3DRMINTERPOLATION_LINEAR 0x04L
  343. #define D3DRMINTERPOLATION_SPLINE 0x08L
  344. #define D3DRMINTERPOLATION_VERTEXCOLOR 0x40L
  345. #define D3DRMINTERPOLATION_SLERPNORMALS 0x80L
  346. typedef DWORD D3DRMLOADOPTIONS;
  347. #define D3DRMLOAD_FROMFILE 0x00L
  348. #define D3DRMLOAD_FROMRESOURCE 0x01L
  349. #define D3DRMLOAD_FROMMEMORY 0x02L
  350. #define D3DRMLOAD_FROMSTREAM 0x04L
  351. #define D3DRMLOAD_FROMURL 0x08L
  352. #define D3DRMLOAD_BYNAME 0x10L
  353. #define D3DRMLOAD_BYPOSITION 0x20L
  354. #define D3DRMLOAD_BYGUID 0x40L
  355. #define D3DRMLOAD_FIRST 0x80L
  356. #define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
  357. #define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
  358. #define D3DRMLOAD_ASYNCHRONOUS 0x400L
  359. typedef struct _D3DRMLOADRESOURCE {
  360. HMODULE hModule;
  361. LPCTSTR lpName;
  362. LPCTSTR lpType;
  363. } D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
  364. typedef struct _D3DRMLOADMEMORY {
  365. LPVOID lpMemory;
  366. DWORD dSize;
  367. } D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
  368. #define D3DRMPMESHSTATUS_VALID 0x01L
  369. #define D3DRMPMESHSTATUS_INTERRUPTED 0x02L
  370. #define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04L
  371. #define D3DRMPMESHSTATUS_COMPLETE 0x08L
  372. #define D3DRMPMESHSTATUS_RENDERABLE 0x10L
  373. #define D3DRMPMESHEVENT_BASEMESH 0x01L
  374. #define D3DRMPMESHEVENT_COMPLETE 0x02L
  375. typedef struct _D3DRMPMESHLOADSTATUS {
  376. DWORD dwSize; // Size of this structure
  377. DWORD dwPMeshSize; // Total Size (bytes)
  378. DWORD dwBaseMeshSize; // Total Size of the Base Mesh
  379. DWORD dwBytesLoaded; // Total bytes loaded
  380. DWORD dwVerticesLoaded; // Number of vertices loaded
  381. DWORD dwFacesLoaded; // Number of faces loaded
  382. HRESULT dwLoadResult; // Result of the load operation
  383. DWORD dwFlags;
  384. } D3DRMPMESHLOADSTATUS, *LPD3DRMPMESHLOADSTATUS;
  385. typedef enum _D3DRMUSERVISUALREASON {
  386. D3DRMUSERVISUAL_CANSEE,
  387. D3DRMUSERVISUAL_RENDER
  388. } D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
  389. typedef struct _D3DRMANIMATIONKEY
  390. {
  391. DWORD dwSize;
  392. DWORD dwKeyType;
  393. D3DVALUE dvTime;
  394. DWORD dwID;
  395. #if (!defined __cplusplus) || (!defined D3D_OVERLOADS)
  396. union
  397. {
  398. D3DRMQUATERNION dqRotateKey;
  399. D3DVECTOR dvScaleKey;
  400. D3DVECTOR dvPositionKey;
  401. };
  402. #else
  403. /*
  404. * We do this as D3D_OVERLOADS defines constructors for D3DVECTOR,
  405. * this can then not be used in a union. Use the inlines provided
  406. * to extract and set the required component.
  407. */
  408. D3DVALUE dvK[4];
  409. #endif
  410. } D3DRMANIMATIONKEY;
  411. typedef D3DRMANIMATIONKEY *LPD3DRMANIMATIONKEY;
  412. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  413. inline VOID
  414. D3DRMAnimationGetRotateKey(const D3DRMANIMATIONKEY& rmKey,
  415. D3DRMQUATERNION& rmQuat)
  416. {
  417. rmQuat.s = rmKey.dvK[0];
  418. rmQuat.v = D3DVECTOR(rmKey.dvK[1], rmKey.dvK[2], rmKey.dvK[3]);
  419. }
  420. inline VOID
  421. D3DRMAnimationGetScaleKey(const D3DRMANIMATIONKEY& rmKey,
  422. D3DVECTOR& dvVec)
  423. {
  424. dvVec = D3DVECTOR(rmKey.dvK[0], rmKey.dvK[1], rmKey.dvK[2]);
  425. }
  426. inline VOID
  427. D3DRMAnimationGetPositionKey(const D3DRMANIMATIONKEY& rmKey,
  428. D3DVECTOR& dvVec)
  429. {
  430. dvVec = D3DVECTOR(rmKey.dvK[0], rmKey.dvK[1], rmKey.dvK[2]);
  431. }
  432. inline VOID
  433. D3DRMAnimationSetRotateKey(D3DRMANIMATIONKEY& rmKey,
  434. const D3DRMQUATERNION& rmQuat)
  435. {
  436. rmKey.dvK[0] = rmQuat.s;
  437. rmKey.dvK[1] = rmQuat.v.x;
  438. rmKey.dvK[2] = rmQuat.v.y;
  439. rmKey.dvK[3] = rmQuat.v.z;
  440. }
  441. inline VOID
  442. D3DRMAnimationSetScaleKey(D3DRMANIMATIONKEY& rmKey,
  443. const D3DVECTOR& dvVec)
  444. {
  445. rmKey.dvK[0] = dvVec.x;
  446. rmKey.dvK[1] = dvVec.y;
  447. rmKey.dvK[2] = dvVec.z;
  448. }
  449. inline VOID
  450. D3DRMAnimationSetPositionKey(D3DRMANIMATIONKEY& rmKey,
  451. const D3DVECTOR& dvVec)
  452. {
  453. rmKey.dvK[0] = dvVec.x;
  454. rmKey.dvK[1] = dvVec.y;
  455. rmKey.dvK[2] = dvVec.z;
  456. }
  457. #endif
  458. #define D3DRMANIMATION_ROTATEKEY 0x01
  459. #define D3DRMANIMATION_SCALEKEY 0x02
  460. #define D3DRMANIMATION_POSITIONKEY 0x03
  461. typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
  462. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
  463. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
  464. static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
  465. typedef struct _D3DRMVERTEX
  466. { D3DVECTOR position;
  467. D3DVECTOR normal;
  468. D3DVALUE tu, tv;
  469. D3DCOLOR color;
  470. } D3DRMVERTEX, *LPD3DRMVERTEX;
  471. typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
  472. static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
  473. /*
  474. * Create a color from three components in the range 0-1 inclusive.
  475. */
  476. extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGB(D3DVALUE red,
  477. D3DVALUE green,
  478. D3DVALUE blue);
  479. /*
  480. * Create a color from four components in the range 0-1 inclusive.
  481. */
  482. extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGBA(D3DVALUE red,
  483. D3DVALUE green,
  484. D3DVALUE blue,
  485. D3DVALUE alpha);
  486. /*
  487. * Get the red component of a color.
  488. */
  489. extern D3DVALUE D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
  490. /*
  491. * Get the green component of a color.
  492. */
  493. extern D3DVALUE D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
  494. /*
  495. * Get the blue component of a color.
  496. */
  497. extern D3DVALUE D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
  498. /*
  499. * Get the alpha component of a color.
  500. */
  501. extern D3DVALUE D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
  502. /*
  503. * Add two vectors. Returns its first argument.
  504. */
  505. extern LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
  506. LPD3DVECTOR s1,
  507. LPD3DVECTOR s2);
  508. /*
  509. * Subtract two vectors. Returns its first argument.
  510. */
  511. extern LPD3DVECTOR D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
  512. LPD3DVECTOR s1,
  513. LPD3DVECTOR s2);
  514. /*
  515. * Reflect a ray about a given normal. Returns its first argument.
  516. */
  517. extern LPD3DVECTOR D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
  518. LPD3DVECTOR ray,
  519. LPD3DVECTOR norm);
  520. /*
  521. * Calculate the vector cross product. Returns its first argument.
  522. */
  523. extern LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
  524. LPD3DVECTOR s1,
  525. LPD3DVECTOR s2);
  526. /*
  527. * Return the vector dot product.
  528. */
  529. extern D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
  530. LPD3DVECTOR s2);
  531. /*
  532. * Scale a vector so that its modulus is 1. Returns its argument or
  533. * NULL if there was an error (e.g. a zero vector was passed).
  534. */
  535. extern LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
  536. #define D3DRMVectorNormalise D3DRMVectorNormalize
  537. /*
  538. * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  539. */
  540. extern D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
  541. /*
  542. * Set the rotation part of a matrix to be a rotation of theta radians
  543. * around the given axis.
  544. */
  545. extern LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
  546. /*
  547. * Scale a vector uniformly in all three axes
  548. */
  549. extern LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
  550. /*
  551. * Return a random unit vector
  552. */
  553. extern LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
  554. /*
  555. * Returns a unit quaternion that represents a rotation of theta radians
  556. * around the given axis.
  557. */
  558. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
  559. LPD3DVECTOR v,
  560. D3DVALUE theta);
  561. /*
  562. * Calculate the product of two quaternions
  563. */
  564. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
  565. LPD3DRMQUATERNION a,
  566. LPD3DRMQUATERNION b);
  567. /*
  568. * Interpolate between two quaternions
  569. */
  570. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
  571. LPD3DRMQUATERNION a,
  572. LPD3DRMQUATERNION b,
  573. D3DVALUE alpha);
  574. /*
  575. * Calculate the matrix for the rotation that a unit quaternion represents
  576. */
  577. extern void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
  578. /*
  579. * Calculate the quaternion that corresponds to a rotation matrix
  580. */
  581. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromMatrix(LPD3DRMQUATERNION, D3DRMMATRIX4D);
  582. #if defined(__cplusplus)
  583. };
  584. #endif
  585. #endif