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.

940 lines
29 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: d3drm.h
  6. * Content: Direct3DRM include file
  7. *@@BEGIN_MSINTERNAL
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 27/02/96 stevela Moved from RL to D3DRM.
  13. *@@END_MSINTERNAL
  14. *
  15. ***************************************************************************/
  16. #ifndef __D3DRMDEFS_H__
  17. #define __D3DRMDEFS_H__
  18. #include <stddef.h>
  19. #include "d3dtypes.h"
  20. #ifdef WIN32
  21. #define D3DRMAPI __stdcall
  22. #else
  23. #define D3DRMAPI
  24. #endif
  25. #if defined(__cplusplus)
  26. extern "C" {
  27. #endif
  28. #ifndef TRUE
  29. #define FALSE 0
  30. #define TRUE 1
  31. #endif
  32. typedef struct _D3DRMVECTOR4D
  33. { D3DVALUE x, y, z, w;
  34. } D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
  35. typedef D3DVALUE D3DRMMATRIX4D[4][4];
  36. typedef struct _D3DRMQUATERNION
  37. { D3DVALUE s;
  38. D3DVECTOR v;
  39. } D3DRMQUATERNION, *LPD3DRMQUATERNION;
  40. typedef struct _D3DRMRAY
  41. { D3DVECTOR dvDir;
  42. D3DVECTOR dvPos;
  43. } D3DRMRAY, *LPD3DRMRAY;
  44. typedef struct _D3DRMBOX
  45. { D3DVECTOR min, max;
  46. } D3DRMBOX, *LPD3DRMBOX;
  47. typedef void (*D3DRMWRAPCALLBACK)
  48. (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
  49. typedef enum _D3DRMLIGHTTYPE
  50. { D3DRMLIGHT_AMBIENT,
  51. D3DRMLIGHT_POINT,
  52. D3DRMLIGHT_SPOT,
  53. D3DRMLIGHT_DIRECTIONAL,
  54. D3DRMLIGHT_PARALLELPOINT
  55. } D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
  56. typedef enum _D3DRMSHADEMODE {
  57. D3DRMSHADE_FLAT = 0,
  58. D3DRMSHADE_GOURAUD = 1,
  59. D3DRMSHADE_PHONG = 2,
  60. D3DRMSHADE_MASK = 7,
  61. D3DRMSHADE_MAX = 8
  62. } D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
  63. typedef enum _D3DRMLIGHTMODE {
  64. D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX,
  65. D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX,
  66. D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX,
  67. D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX
  68. } D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
  69. typedef enum _D3DRMFILLMODE {
  70. D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX,
  71. D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
  72. D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX,
  73. D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX,
  74. D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX
  75. } D3DRMFILLMODE, *LPD3DRMFILLMODE;
  76. typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
  77. #define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
  78. #define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
  79. #define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  80. #define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  81. #define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  82. #define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
  83. #define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
  84. //@@BEGIN_MSINTERNAL
  85. #define D3DRMRENDERMODE_SORTIFNOZBUFFER 4
  86. //@@END_MSINTERNAL
  87. #define D3DRMRENDERMODE_LIGHTINMODELSPACE 8
  88. #define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16
  89. #define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32
  90. //@@BEGIN_MSINTERNAL
  91. typedef enum _D3DRMLIGHTINGFREQUENCY
  92. { D3DRMLIGHT_NEVER,
  93. D3DRMLIGHT_ONCE,
  94. D3DRMLIGHT_CONTINUALLY
  95. } D3DRMLIGHTINGFREQUENCY;
  96. //@@END_MSINTERNAL
  97. typedef enum _D3DRMTEXTUREQUALITY
  98. { D3DRMTEXTURE_NEAREST, /* choose nearest texel */
  99. D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */
  100. D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */
  101. D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */
  102. D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */
  103. D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */
  104. } D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
  105. /*
  106. * Texture flags
  107. */
  108. #define D3DRMTEXTURE_FORCERESIDENT 0x00000001 /* texture should be kept in video memory */
  109. #define D3DRMTEXTURE_STATIC 0x00000002 /* texture will not change */
  110. #define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004 /* point filtering should be used when downsampling */
  111. #define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008 /* bilinear filtering should be used when downsampling */
  112. #define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010 /* reduce bit depth when downsampling */
  113. #define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020 /* texture should never be downsampled */
  114. #define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040 /* pixels have changed */
  115. #define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080 /* palette has changed */
  116. #define D3DRMTEXTURE_INVALIDATEONLY 0x00000100 /* dirty regions are invalid */
  117. /*
  118. * Shadow flags
  119. */
  120. #define D3DRMSHADOW_TRUEALPHA 0x00000001 /* shadow should render without artifacts when true alpha is on */
  121. typedef enum _D3DRMCOMBINETYPE
  122. { D3DRMCOMBINE_REPLACE,
  123. D3DRMCOMBINE_BEFORE,
  124. D3DRMCOMBINE_AFTER
  125. } D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
  126. typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
  127. typedef enum _D3DRMPALETTEFLAGS
  128. { D3DRMPALETTE_FREE, /* renderer may use this entry freely */
  129. D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */
  130. D3DRMPALETTE_RESERVED /* may not be used by renderer */
  131. } D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
  132. typedef struct _D3DRMPALETTEENTRY
  133. { unsigned char red; /* 0 .. 255 */
  134. unsigned char green; /* 0 .. 255 */
  135. unsigned char blue; /* 0 .. 255 */
  136. unsigned char flags; /* one of D3DRMPALETTEFLAGS */
  137. } D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
  138. typedef struct _D3DRMIMAGE
  139. { int width, height; /* width and height in pixels */
  140. int aspectx, aspecty; /* aspect ratio for non-square pixels */
  141. int depth; /* bits per pixel */
  142. int rgb; /* if false, pixels are indices into a
  143. palette otherwise, pixels encode
  144. RGB values. */
  145. int bytes_per_line; /* number of bytes of memory for a
  146. scanline. This must be a multiple
  147. of 4. */
  148. void* buffer1; /* memory to render into (first buffer). */
  149. void* buffer2; /* second rendering buffer for double
  150. buffering, set to NULL for single
  151. buffering. */
  152. unsigned long red_mask;
  153. unsigned long green_mask;
  154. unsigned long blue_mask;
  155. unsigned long alpha_mask; /* if rgb is true, these are masks for
  156. the red, green and blue parts of a
  157. pixel. Otherwise, these are masks
  158. for the significant bits of the
  159. red, green and blue elements in the
  160. palette. For instance, most SVGA
  161. displays use 64 intensities of red,
  162. green and blue, so the masks should
  163. all be set to 0xfc. */
  164. int palette_size; /* number of entries in palette */
  165. D3DRMPALETTEENTRY* palette; /* description of the palette (only if
  166. rgb is false). Must be (1<<depth)
  167. elements. */
  168. } D3DRMIMAGE, *LPD3DRMIMAGE;
  169. typedef enum _D3DRMWRAPTYPE
  170. { D3DRMWRAP_FLAT,
  171. D3DRMWRAP_CYLINDER,
  172. D3DRMWRAP_SPHERE,
  173. D3DRMWRAP_CHROME,
  174. D3DRMWRAP_SHEET,
  175. D3DRMWRAP_BOX
  176. } D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
  177. #define D3DRMWIREFRAME_CULL 1 /* cull backfaces */
  178. #define D3DRMWIREFRAME_HIDDENLINE 2 /* lines are obscured by closer objects */
  179. /*
  180. * Do not use righthanded perspective in Viewport2::SetProjection().
  181. * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  182. */
  183. typedef enum _D3DRMPROJECTIONTYPE
  184. { D3DRMPROJECT_PERSPECTIVE,
  185. D3DRMPROJECT_ORTHOGRAPHIC,
  186. D3DRMPROJECT_RIGHTHANDPERSPECTIVE, /* Only valid pre-DX6 */
  187. D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC /* Only valid pre-DX6 */
  188. } D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
  189. #define D3DRMOPTIONS_LEFTHANDED 0x00000001L /* Default */
  190. #define D3DRMOPTIONS_RIGHTHANDED 0x00000002L
  191. typedef enum _D3DRMXOFFORMAT
  192. { D3DRMXOF_BINARY,
  193. D3DRMXOF_COMPRESSED,
  194. D3DRMXOF_TEXT
  195. } D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
  196. typedef DWORD D3DRMSAVEOPTIONS;
  197. #define D3DRMXOFSAVE_NORMALS 1
  198. #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
  199. #define D3DRMXOFSAVE_MATERIALS 4
  200. #define D3DRMXOFSAVE_TEXTURENAMES 8
  201. #define D3DRMXOFSAVE_ALL 15
  202. #define D3DRMXOFSAVE_TEMPLATES 16
  203. #define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
  204. typedef enum _D3DRMCOLORSOURCE
  205. { D3DRMCOLOR_FROMFACE,
  206. D3DRMCOLOR_FROMVERTEX
  207. } D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
  208. typedef enum _D3DRMFRAMECONSTRAINT
  209. { D3DRMCONSTRAIN_Z, /* use only X and Y rotations */
  210. D3DRMCONSTRAIN_Y, /* use only X and Z rotations */
  211. D3DRMCONSTRAIN_X /* use only Y and Z rotations */
  212. } D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
  213. typedef enum _D3DRMMATERIALMODE
  214. { D3DRMMATERIAL_FROMMESH,
  215. D3DRMMATERIAL_FROMPARENT,
  216. D3DRMMATERIAL_FROMFRAME
  217. } D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
  218. typedef enum _D3DRMFOGMODE
  219. { D3DRMFOG_LINEAR, /* linear between start and end */
  220. D3DRMFOG_EXPONENTIAL, /* density * exp(-distance) */
  221. D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
  222. } D3DRMFOGMODE, *LPD3DRMFOGMODE;
  223. typedef enum _D3DRMZBUFFERMODE {
  224. D3DRMZBUFFER_FROMPARENT, /* default */
  225. D3DRMZBUFFER_ENABLE, /* enable zbuffering */
  226. D3DRMZBUFFER_DISABLE /* disable zbuffering */
  227. } D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
  228. typedef enum _D3DRMSORTMODE {
  229. D3DRMSORT_FROMPARENT, /* default */
  230. D3DRMSORT_NONE, /* don't sort child frames */
  231. D3DRMSORT_FRONTTOBACK, /* sort child frames front-to-back */
  232. D3DRMSORT_BACKTOFRONT /* sort child frames back-to-front */
  233. } D3DRMSORTMODE, *LPD3DRMSORTMODE;
  234. typedef struct _D3DRMMATERIALOVERRIDE
  235. {
  236. DWORD dwSize; /* Size of this structure */
  237. DWORD dwFlags; /* Indicate which fields are valid */
  238. D3DCOLORVALUE dcDiffuse; /* RGBA */
  239. D3DCOLORVALUE dcAmbient; /* RGB */
  240. D3DCOLORVALUE dcEmissive; /* RGB */
  241. D3DCOLORVALUE dcSpecular; /* RGB */
  242. D3DVALUE dvPower;
  243. LPUNKNOWN lpD3DRMTex;
  244. } D3DRMMATERIALOVERRIDE, *LPD3DRMMATERIALOVERRIDE;
  245. #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001L
  246. #define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002L
  247. #define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003L
  248. #define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004L
  249. #define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008L
  250. #define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010L
  251. #define D3DRMMATERIALOVERRIDE_POWER 0x00000020L
  252. #define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040L
  253. #define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080L
  254. #define D3DRMMATERIALOVERRIDE_ALL 0x000000FFL
  255. #define D3DRMFPTF_ALPHA 0x00000001L
  256. #define D3DRMFPTF_NOALPHA 0x00000002L
  257. #define D3DRMFPTF_PALETTIZED 0x00000004L
  258. #define D3DRMFPTF_NOTPALETTIZED 0x00000008L
  259. #define D3DRMSTATECHANGE_UPDATEONLY 0x000000001L
  260. #define D3DRMSTATECHANGE_VOLATILE 0x000000002L
  261. #define D3DRMSTATECHANGE_NONVOLATILE 0x000000004L
  262. //@@BEGIN_MSINTERNAL
  263. #define D3DRMSTATECHANGE_OVERRIDE 0x000000008L
  264. //@@END_MSINTERNAL
  265. #define D3DRMSTATECHANGE_RENDER 0x000000020L
  266. #define D3DRMSTATECHANGE_LIGHT 0x000000040L
  267. /*
  268. * Values for flags in RM3::CreateDeviceFromSurface
  269. */
  270. #define D3DRMDEVICE_NOZBUFFER 0x00000001L
  271. /*
  272. * Values for flags in Object2::SetClientData
  273. */
  274. #define D3DRMCLIENTDATA_NONE 0x00000001L
  275. #define D3DRMCLIENTDATA_LOCALFREE 0x00000002L
  276. #define D3DRMCLIENTDATA_IUNKNOWN 0x00000004L
  277. /*
  278. * Values for flags in Frame2::AddMoveCallback.
  279. */
  280. #define D3DRMCALLBACK_PREORDER 0
  281. #define D3DRMCALLBACK_POSTORDER 1
  282. /*
  283. * Values for flags in MeshBuilder2::RayPick.
  284. */
  285. #define D3DRMRAYPICK_ONLYBOUNDINGBOXES 1
  286. #define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 2
  287. #define D3DRMRAYPICK_INTERPOLATEUV 4
  288. #define D3DRMRAYPICK_INTERPOLATECOLOR 8
  289. #define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
  290. /*
  291. * Values for flags in MeshBuilder3::AddFacesIndexed.
  292. */
  293. #define D3DRMADDFACES_VERTICESONLY 1
  294. /*
  295. * Values for flags in MeshBuilder2::GenerateNormals.
  296. */
  297. #define D3DRMGENERATENORMALS_PRECOMPACT 1
  298. #define D3DRMGENERATENORMALS_USECREASEANGLE 2
  299. /*
  300. * Values for MeshBuilder3::GetParentMesh
  301. */
  302. #define D3DRMMESHBUILDER_DIRECTPARENT 1
  303. #define D3DRMMESHBUILDER_ROOTMESH 2
  304. /*
  305. * Flags for MeshBuilder3::Enable
  306. */
  307. #define D3DRMMESHBUILDER_RENDERENABLE 0x00000001L
  308. #define D3DRMMESHBUILDER_PICKENABLE 0x00000002L
  309. /*
  310. * Flags for MeshBuilder3::AddMeshBuilder
  311. */
  312. #define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1
  313. #define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2
  314. #define D3DRMADDMESHBUILDER_NOSUBMESHES 4
  315. /*
  316. * Flags for Object2::GetAge when used with MeshBuilders
  317. */
  318. #define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001L
  319. #define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002L
  320. #define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004L
  321. /*
  322. * Format flags for MeshBuilder3::AddTriangles.
  323. */
  324. #define D3DRMFVF_TYPE 0x00000001L
  325. #define D3DRMFVF_NORMAL 0x00000002L
  326. #define D3DRMFVF_COLOR 0x00000004L
  327. #define D3DRMFVF_TEXTURECOORDS 0x00000008L
  328. #define D3DRMVERTEX_STRIP 0x00000001L
  329. #define D3DRMVERTEX_FAN 0x00000002L
  330. #define D3DRMVERTEX_LIST 0x00000004L
  331. /*
  332. * Values for flags in Viewport2::Clear2
  333. */
  334. #define D3DRMCLEAR_TARGET 0x00000001L
  335. #define D3DRMCLEAR_ZBUFFER 0x00000002L
  336. #define D3DRMCLEAR_DIRTYRECTS 0x00000004L
  337. #define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | \
  338. D3DRMCLEAR_ZBUFFER | \
  339. D3DRMCLEAR_DIRTYRECTS)
  340. /*
  341. * Values for flags in Frame3::SetSceneFogMethod
  342. */
  343. #define D3DRMFOGMETHOD_VERTEX 0x00000001L
  344. #define D3DRMFOGMETHOD_TABLE 0x00000002L
  345. #define D3DRMFOGMETHOD_ANY 0x00000004L
  346. /*
  347. * Values for flags in Frame3::SetTraversalOptions
  348. */
  349. #define D3DRMFRAME_RENDERENABLE 0x00000001L
  350. #define D3DRMFRAME_PICKENABLE 0x00000002L
  351. typedef DWORD D3DRMANIMATIONOPTIONS;
  352. #define D3DRMANIMATION_OPEN 0x01L
  353. #define D3DRMANIMATION_CLOSED 0x02L
  354. #define D3DRMANIMATION_LINEARPOSITION 0x04L
  355. #define D3DRMANIMATION_SPLINEPOSITION 0x08L
  356. #define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
  357. #define D3DRMANIMATION_POSITION 0x00000020L
  358. typedef DWORD D3DRMINTERPOLATIONOPTIONS;
  359. #define D3DRMINTERPOLATION_OPEN 0x01L
  360. #define D3DRMINTERPOLATION_CLOSED 0x02L
  361. #define D3DRMINTERPOLATION_NEAREST 0x0100L
  362. #define D3DRMINTERPOLATION_LINEAR 0x04L
  363. #define D3DRMINTERPOLATION_SPLINE 0x08L
  364. #define D3DRMINTERPOLATION_VERTEXCOLOR 0x40L
  365. #define D3DRMINTERPOLATION_SLERPNORMALS 0x80L
  366. typedef DWORD D3DRMLOADOPTIONS;
  367. #define D3DRMLOAD_FROMFILE 0x00L
  368. #define D3DRMLOAD_FROMRESOURCE 0x01L
  369. #define D3DRMLOAD_FROMMEMORY 0x02L
  370. #define D3DRMLOAD_FROMSTREAM 0x04L
  371. #define D3DRMLOAD_FROMURL 0x08L
  372. #define D3DRMLOAD_BYNAME 0x10L
  373. #define D3DRMLOAD_BYPOSITION 0x20L
  374. #define D3DRMLOAD_BYGUID 0x40L
  375. #define D3DRMLOAD_FIRST 0x80L
  376. #define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
  377. #define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
  378. #define D3DRMLOAD_ASYNCHRONOUS 0x400L
  379. typedef struct _D3DRMLOADRESOURCE {
  380. HMODULE hModule;
  381. LPCTSTR lpName;
  382. LPCTSTR lpType;
  383. } D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
  384. typedef struct _D3DRMLOADMEMORY {
  385. LPVOID lpMemory;
  386. DWORD dSize;
  387. } D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
  388. #define D3DRMPMESHSTATUS_VALID 0x01L
  389. #define D3DRMPMESHSTATUS_INTERRUPTED 0x02L
  390. #define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04L
  391. #define D3DRMPMESHSTATUS_COMPLETE 0x08L
  392. #define D3DRMPMESHSTATUS_RENDERABLE 0x10L
  393. #define D3DRMPMESHEVENT_BASEMESH 0x01L
  394. #define D3DRMPMESHEVENT_COMPLETE 0x02L
  395. typedef struct _D3DRMPMESHLOADSTATUS {
  396. DWORD dwSize; // Size of this structure
  397. DWORD dwPMeshSize; // Total Size (bytes)
  398. DWORD dwBaseMeshSize; // Total Size of the Base Mesh
  399. DWORD dwBytesLoaded; // Total bytes loaded
  400. DWORD dwVerticesLoaded; // Number of vertices loaded
  401. DWORD dwFacesLoaded; // Number of faces loaded
  402. HRESULT dwLoadResult; // Result of the load operation
  403. DWORD dwFlags;
  404. } D3DRMPMESHLOADSTATUS, *LPD3DRMPMESHLOADSTATUS;
  405. typedef enum _D3DRMUSERVISUALREASON {
  406. D3DRMUSERVISUAL_CANSEE,
  407. D3DRMUSERVISUAL_RENDER
  408. } D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
  409. //@@BEGIN_MSINTERNAL
  410. typedef LPVOID (*D3DRMMALLOCFUNCTION)(DWORD);
  411. typedef D3DRMMALLOCFUNCTION *LPD3DRMMALLOCFUNCTION;
  412. typedef LPVOID (*D3DRMREALLOCFUNCTION)(LPVOID, DWORD);
  413. typedef D3DRMREALLOCFUNCTION *LPD3DRMREALLOCFUNCTION;
  414. typedef VOID (*D3DRMFREEFUNCTION)(LPVOID);
  415. typedef D3DRMFREEFUNCTION *LPD3DRMFREEFUNCTION;
  416. //@@END_MSINTERNAL
  417. typedef struct _D3DRMANIMATIONKEY
  418. {
  419. DWORD dwSize;
  420. DWORD dwKeyType;
  421. D3DVALUE dvTime;
  422. DWORD dwID;
  423. #if (!defined __cplusplus) || (!defined D3D_OVERLOADS)
  424. union
  425. {
  426. D3DRMQUATERNION dqRotateKey;
  427. D3DVECTOR dvScaleKey;
  428. D3DVECTOR dvPositionKey;
  429. };
  430. #else
  431. /*
  432. * We do this as D3D_OVERLOADS defines constructors for D3DVECTOR,
  433. * this can then not be used in a union. Use the inlines provided
  434. * to extract and set the required component.
  435. */
  436. D3DVALUE dvK[4];
  437. #endif
  438. } D3DRMANIMATIONKEY;
  439. typedef D3DRMANIMATIONKEY *LPD3DRMANIMATIONKEY;
  440. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  441. inline VOID
  442. D3DRMAnimationGetRotateKey(const D3DRMANIMATIONKEY& rmKey,
  443. D3DRMQUATERNION& rmQuat)
  444. {
  445. rmQuat.s = rmKey.dvK[0];
  446. rmQuat.v = D3DVECTOR(rmKey.dvK[1], rmKey.dvK[2], rmKey.dvK[3]);
  447. }
  448. inline VOID
  449. D3DRMAnimationGetScaleKey(const D3DRMANIMATIONKEY& rmKey,
  450. D3DVECTOR& dvVec)
  451. {
  452. dvVec = D3DVECTOR(rmKey.dvK[0], rmKey.dvK[1], rmKey.dvK[2]);
  453. }
  454. inline VOID
  455. D3DRMAnimationGetPositionKey(const D3DRMANIMATIONKEY& rmKey,
  456. D3DVECTOR& dvVec)
  457. {
  458. dvVec = D3DVECTOR(rmKey.dvK[0], rmKey.dvK[1], rmKey.dvK[2]);
  459. }
  460. inline VOID
  461. D3DRMAnimationSetRotateKey(D3DRMANIMATIONKEY& rmKey,
  462. const D3DRMQUATERNION& rmQuat)
  463. {
  464. rmKey.dvK[0] = rmQuat.s;
  465. rmKey.dvK[1] = rmQuat.v.x;
  466. rmKey.dvK[2] = rmQuat.v.y;
  467. rmKey.dvK[3] = rmQuat.v.z;
  468. }
  469. inline VOID
  470. D3DRMAnimationSetScaleKey(D3DRMANIMATIONKEY& rmKey,
  471. const D3DVECTOR& dvVec)
  472. {
  473. rmKey.dvK[0] = dvVec.x;
  474. rmKey.dvK[1] = dvVec.y;
  475. rmKey.dvK[2] = dvVec.z;
  476. }
  477. inline VOID
  478. D3DRMAnimationSetPositionKey(D3DRMANIMATIONKEY& rmKey,
  479. const D3DVECTOR& dvVec)
  480. {
  481. rmKey.dvK[0] = dvVec.x;
  482. rmKey.dvK[1] = dvVec.y;
  483. rmKey.dvK[2] = dvVec.z;
  484. }
  485. #endif
  486. #define D3DRMANIMATION_ROTATEKEY 0x01
  487. #define D3DRMANIMATION_SCALEKEY 0x02
  488. #define D3DRMANIMATION_POSITIONKEY 0x03
  489. typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
  490. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
  491. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
  492. static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
  493. typedef struct _D3DRMVERTEX
  494. { D3DVECTOR position;
  495. D3DVECTOR normal;
  496. D3DVALUE tu, tv;
  497. D3DCOLOR color;
  498. } D3DRMVERTEX, *LPD3DRMVERTEX;
  499. typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
  500. static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
  501. /*
  502. * Create a color from three components in the range 0-1 inclusive.
  503. */
  504. extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGB(D3DVALUE red,
  505. D3DVALUE green,
  506. D3DVALUE blue);
  507. /*
  508. * Create a color from four components in the range 0-1 inclusive.
  509. */
  510. extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGBA(D3DVALUE red,
  511. D3DVALUE green,
  512. D3DVALUE blue,
  513. D3DVALUE alpha);
  514. /*
  515. * Get the red component of a color.
  516. */
  517. extern D3DVALUE D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
  518. /*
  519. * Get the green component of a color.
  520. */
  521. extern D3DVALUE D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
  522. /*
  523. * Get the blue component of a color.
  524. */
  525. extern D3DVALUE D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
  526. /*
  527. * Get the alpha component of a color.
  528. */
  529. extern D3DVALUE D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
  530. /*
  531. * Add two vectors. Returns its first argument.
  532. */
  533. extern LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
  534. LPD3DVECTOR s1,
  535. LPD3DVECTOR s2);
  536. /*
  537. * Subtract two vectors. Returns its first argument.
  538. */
  539. extern LPD3DVECTOR D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
  540. LPD3DVECTOR s1,
  541. LPD3DVECTOR s2);
  542. /*
  543. * Reflect a ray about a given normal. Returns its first argument.
  544. */
  545. extern LPD3DVECTOR D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
  546. LPD3DVECTOR ray,
  547. LPD3DVECTOR norm);
  548. /*
  549. * Calculate the vector cross product. Returns its first argument.
  550. */
  551. extern LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
  552. LPD3DVECTOR s1,
  553. LPD3DVECTOR s2);
  554. /*
  555. * Return the vector dot product.
  556. */
  557. extern D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
  558. LPD3DVECTOR s2);
  559. /*
  560. * Scale a vector so that its modulus is 1. Returns its argument or
  561. * NULL if there was an error (e.g. a zero vector was passed).
  562. */
  563. extern LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
  564. #define D3DRMVectorNormalise D3DRMVectorNormalize
  565. /*
  566. * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  567. */
  568. extern D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
  569. /*
  570. * Set the rotation part of a matrix to be a rotation of theta radians
  571. * around the given axis.
  572. */
  573. extern LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
  574. /*
  575. * Scale a vector uniformly in all three axes
  576. */
  577. extern LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
  578. /*
  579. * Return a random unit vector
  580. */
  581. extern LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
  582. /*
  583. * Returns a unit quaternion that represents a rotation of theta radians
  584. * around the given axis.
  585. */
  586. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
  587. LPD3DVECTOR v,
  588. D3DVALUE theta);
  589. /*
  590. * Calculate the product of two quaternions
  591. */
  592. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
  593. LPD3DRMQUATERNION a,
  594. LPD3DRMQUATERNION b);
  595. /*
  596. * Interpolate between two quaternions
  597. */
  598. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
  599. LPD3DRMQUATERNION a,
  600. LPD3DRMQUATERNION b,
  601. D3DVALUE alpha);
  602. /*
  603. * Calculate the matrix for the rotation that a unit quaternion represents
  604. */
  605. extern void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
  606. /*
  607. * Calculate the quaternion that corresponds to a rotation matrix
  608. */
  609. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromMatrix(LPD3DRMQUATERNION, D3DRMMATRIX4D);
  610. //@@BEGIN_MSINTERNAL
  611. #ifdef BUILD_RLAPI
  612. #ifdef __psx__
  613. #ifndef FIXED_POINT_API
  614. #define FIXED_POINT_API
  615. #endif
  616. #ifndef FIXED_POINT_INTERNAL
  617. #define FIXED_POINT_INTERNAL
  618. #endif
  619. #endif
  620. /* RLRGB and RLRGBA may be used as initialisers for RLColors
  621. * The int or float values must be in the range 0..1
  622. */
  623. #define RLRGB(r, g, b) \
  624. (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  625. #define RLRGBA(r, g, b, a) \
  626. ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  627. | (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  628. )
  629. typedef D3DVALUE RLValue;
  630. typedef D3DCOLOR RLColor;
  631. #ifdef FIXED_POINT_API
  632. #ifndef __psx__
  633. #define RLVal(x) ((RLValue)((x) * (double)(1<<16)))
  634. #else
  635. #define RLVal(x) ((RLValue)((x) * 65536))
  636. #endif
  637. #define RLInt(x) ((x) >> 16)
  638. #define RLFloat(x) ((x) / 65536.0)
  639. extern RLValue D3DRMAPI RLDivide(RLValue, RLValue);
  640. extern RLValue D3DRMAPI RLMultiply(RLValue, RLValue);
  641. #define RLMultiply3(a,b,c) RLMultiply(RLMultiply(a, b), c)
  642. #else
  643. typedef float RLValue;
  644. #define RLVal(x) ((RLValue) (x))
  645. #define RLInt(x) ((int)(x))
  646. #define RLFloat(x) ((float) (x))
  647. #define RLDivide(a,b) ((RLValue) ((double) (a) / (double) (b)))
  648. #define RLMultiply(a,b) ((RLValue) ((a) * (b)))
  649. #define RLMultiply3(a,b,c) ((RLValue) ((a) * (b) * (c)))
  650. #endif
  651. /*
  652. * These types for internal compilation
  653. */
  654. typedef D3DRECT RLRectangle;
  655. typedef D3DVECTOR RLVector;
  656. typedef D3DRMVECTOR4D RLVector4d;
  657. typedef D3DRMMATRIX4D RLMatrix4d;
  658. typedef D3DRMQUATERNION RLQuaternion;
  659. typedef D3DRMBOX RLBox;
  660. typedef D3DRMWRAPCALLBACK RLWrapCallback;
  661. typedef D3DRMLIGHTTYPE RLLightType;
  662. #define RLLightAmbient D3DRMLIGHT_AMBIENT
  663. #define RLLightPoint D3DRMLIGHT_POINT
  664. #define RLLightSpot D3DRMLIGHT_SPOT
  665. #define RLLightDirectional D3DRMLIGHT_DIRECTIONAL
  666. #define RLLightParallelPoint D3DRMLIGHT_PARALLELPOINT
  667. typedef D3DRMSHADEMODE RLShadeMode;
  668. #define RLShadeFlat D3DRMSHADE_FLAT
  669. #define RLShadeGouraud D3DRMSHADE_GOURAUD
  670. #define RLShadePhong D3DRMSHADE_PHONG
  671. #define RLShadeMask D3DRMSHADE_MASK
  672. #define RLShadeMax D3DRMSHADE_MAX
  673. typedef D3DRMLIGHTMODE RLLightMode;
  674. #define RLLightOff D3DRMLIGHT_OFF
  675. #define RLLightOn D3DRMLIGHT_ON
  676. #define RLLightMask D3DRMLIGHT_MASK
  677. #define RLLightMax D3DRMLIGHT_MAX
  678. typedef D3DRMFILLMODE RLFillMode;
  679. #define RLFillPoints D3DRMFILL_POINTS
  680. #define RLFillWireframe D3DRMFILL_WIREFRAME
  681. #define RLFillSolid D3DRMFILL_SOLID
  682. #define RLFillMask D3DRMFILL_MASK
  683. #define RLFillMax D3DRMFILL_MAX
  684. typedef D3DRMRENDERQUALITY RLRenderQuality;
  685. #define RLRenderWireframe D3DRMRENDER_WIREFRAME
  686. #define RLRenderUnlitflat D3DRMRENDER_UNLITFLAT
  687. #define RLRenderFlat D3DRMRENDER_FLAT
  688. #define RLRenderGouraud D3DRMRENDER_GOURAUD
  689. #define RLRenderPhong D3DRMRENDER_PHONG
  690. typedef D3DRMLIGHTINGFREQUENCY RLLightingFrequency;
  691. #define RLLightNever D3DRMLIGHT_NEVER
  692. #define RLLightOnce D3DRMLIGHT_ONCE
  693. #define RLLightContinually D3DRMLIGHT_CONTINUALLY
  694. typedef D3DRMTEXTUREQUALITY RLTextureQuality;
  695. #define RLTextureNearest D3DRMTEXTURE_NEAREST
  696. #define RLTextureLinear D3DRMTEXTURE_LINEAR
  697. #define RLTextureMipNearest D3DRMTEXTURE_MIPNEAREST
  698. #define RLTextureMipLinear D3DRMTEXTURE_MIPLINEAR
  699. #define RLTextureLinearMipNearest D3DRMTEXTURE_LINEARMIPNEAREST
  700. #define RLTextureLinearMipLinear D3DRMTEXTURE_LINEARMIPLINEAR
  701. typedef D3DRMCOMBINETYPE RLCombineType;
  702. #define RLCombineReplace D3DRMCOMBINE_REPLACE
  703. #define RLCombineBefore D3DRMCOMBINE_BEFORE
  704. #define RLCombineAfter D3DRMCOMBINE_AFTER
  705. typedef D3DCOLORMODEL RLColorModel;
  706. #define RLColorRamp D3DCOLOR_MONO
  707. #define RLColorRGB D3DCOLOR_RGB
  708. typedef D3DRMPALETTEFLAGS RLPaletteFlags;
  709. #define RLPaletteFree D3DRMPALETTE_FREE
  710. #define RLPaletteReadOnly D3DRMPALETTE_READONLY
  711. #define RLPaletteReserved D3DRMPALETTE_RESERVED
  712. typedef D3DRMPALETTEENTRY RLPaletteEntry;
  713. typedef D3DRMIMAGE RLImage;
  714. typedef D3DRMWRAPTYPE RLWrapType;
  715. #define RLWrapFlat D3DRMWRAP_FLAT
  716. #define RLWrapCylinder D3DRMWRAP_CYLINDER
  717. #define RLWrapSphere D3DRMWRAP_SPHERE
  718. #define RLWrapChrome D3DRMWRAP_CHROME
  719. #define RLWrapSheet D3DRMWRAP_SHEET
  720. #define RLWrapBox D3DRMWRAP_BOX
  721. #define RLWireframeCull D3DRMWIREFRAME_CULL
  722. #define RLWireframeHiddenLine D3DRMWIREFRAME_HIDDENLINE
  723. typedef D3DRMPROJECTIONTYPE RLProjectionType;
  724. #define RLProjectPerspective D3DRMPROJECT_PERSPECTIVE
  725. #define RLProjectOrthographic D3DRMPROJECT_ORTHOGRAPHIC
  726. #define RLProjectRightHandPerspective D3DRMPROJECT_RIGHTHANDPERSPECTIVE
  727. #define RLProjectRightHandOrthographic D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC
  728. typedef D3DRMXOFFORMAT RLXOFFormat;
  729. #define RLXOFBinary D3DRMXOF_BINARY
  730. #define RLXOFCompressed D3DRMXOF_COMPRESSED
  731. #define RLXOFText D3DRMXOF_TEXT
  732. #define RLXOFSaveNormals D3DRMXOFSAVE_NORMALS
  733. #define RLXOFSaveTextureCoordinates D3DRMXOFSAVE_TEXTURECOORDINATES
  734. #define RLXOFSaveMaterials D3DRMXOFSAVE_MATERIALS
  735. #define RLXOFSaveTextureNames D3DRMXOFSAVE_TEXTURENAMES
  736. #define RLXOFSaveAll D3DRMXOFSAVE_ALL
  737. #define RLXOFSaveTemplates D3DRMXOFSAVE_TEMPLATES
  738. typedef D3DRMCOLORSOURCE RLColorSource;
  739. #define RLColorFromFace D3DRMCOLOR_FROMFACE
  740. #define RLColorFromVertex D3DRMCOLOR_FROMVERTEX
  741. typedef D3DRMFRAMECONSTRAINT RLFrameConstraint;
  742. #define RLConstrainZ D3DRMCONSTRAIN_Z
  743. #define RLConstrainY D3DRMCONSTRAIN_Y
  744. #define RLConstrainX D3DRMCONSTRAIN_X
  745. typedef D3DRMMATERIALMODE RLMaterialMode;
  746. #define RLMaterialFromMesh D3DRMMATERIAL_FROMMESH
  747. #define RLMaterialFromParent D3DRMMATERIAL_FROMPARENT
  748. #define RLMaterialFromFrame D3DRMMATERIAL_FROMFRAME
  749. typedef D3DRMFOGMODE RLFogMode;
  750. #define RLFogLinear D3DRMFOG_LINEAR
  751. #define RLFogExponential D3DRMFOG_EXPONENTIAL
  752. #define RLFogExponentialSquared D3DRMFOG_EXPONENTIALSQUARED
  753. #define RLAnimationOpen D3DRMANIMATION_OPEN
  754. #define RLAnimationClosed D3DRMANIMATION_CLOSED
  755. #define RLAnimationLinearPosition D3DRMANIMATION_LINEARPOSITION
  756. #define RLAnimationSplinePosition D3DRMANIMATION_SPLINEPOSITION
  757. #define RLAnimationScaleAndRotation D3DRMANIMATION_SCALEANDROTATION
  758. #define RLAnimationPosition D3DRMANIMATION_POSITION
  759. typedef D3DRMUSERVISUALREASON RLUserVisualReason;
  760. #define RLUserVisualCanSee D3DRMUSERVISUAL_CANSEE
  761. #define RLUserVisualRender D3DRMUSERVISUAL_RENDER
  762. typedef D3DRMMALLOCFUNCTION RLMallocFunction;
  763. typedef D3DRMREALLOCFUNCTION RLReallocFunction;
  764. typedef D3DRMFREEFUNCTION RLFreeFunction;
  765. typedef D3DRMMAPPING RLMapping, RLMappingFlag;
  766. static const RLMapping RLMapWrapU = 1;
  767. static const RLMapping RLMapWrapV = 2;
  768. static const RLMapping RLMapPerspCorrect = 4;
  769. typedef D3DRMVERTEX RLVertex;
  770. typedef D3DRMGROUPINDEX RLGroupIndex;
  771. static const RLGroupIndex RLAllGroups = -1;
  772. #define RLCreateColorRGB D3DRMCreateColorRGB
  773. #define RLCreateColorRGBA D3DRMCreateColorRGBA
  774. #define RLColorGetRed D3DRMColorGetRed
  775. #define RLColorGetGreen D3DRMColorGetGreen
  776. #define RLColorGetBlue D3DRMColorGetBlue
  777. #define RLColorGetAlpha D3DRMColorGetAlpha
  778. #define RLVectorAdd D3DRMVectorAdd
  779. #define RLVectorSubtract D3DRMVectorSubtract
  780. #define RLVectorReflect D3DRMVectorReflect
  781. #define RLVectorCrossProduct D3DRMVectorCrossProduct
  782. #define RLVectorDotProduct D3DRMVectorDotProduct
  783. #define RLVectorNormalize D3DRMVectorNormalize
  784. #define RLVectorNormalise D3DRMVectorNormalize
  785. #define RLVectorModulus D3DRMVectorModulus
  786. #define RLVectorRotate D3DRMVectorRotate
  787. #define RLVectorScale D3DRMVectorScale
  788. #define RLVectorRandom D3DRMVectorRandom
  789. #define RLQuaternionFromRotation D3DRMQuaternionFromRotation
  790. #define RLQuaternionMultiply D3DRMQuaternionMultiply
  791. #define RLQuaternionSlerp D3DRMQuaternionSlerp
  792. #define RLMatrixFromQuaternion D3DRMMatrixFromQuaternion
  793. #define RLQuaternionFromMatrix D3DRMQuaternionFromMatrix
  794. #endif /* BUILD_RLAPI */
  795. //@@END_MSINTERNAL
  796. #if defined(__cplusplus)
  797. };
  798. #endif
  799. #endif