Source code of Windows XP (NT5)
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.

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