home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / d3drmdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  23.8 KB  |  698 lines

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