home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / D3DRMDEF.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  14KB  |  409 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       d3drm.h
  6.  *  Content:    Direct3DRM include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __D3DRMDEFS_H__
  11. #define __D3DRMDEFS_H__
  12. #pragma option -b
  13.  
  14. #pragma option -b.
  15. #include <stddef.h>
  16. #pragma option -b
  17. #pragma option -b.
  18. #include "d3dtypes.h"
  19. #pragma option -b
  20.  
  21. #ifdef WIN32
  22. #define D3DRMAPI  __stdcall
  23. #else
  24. #define D3DRMAPI
  25. #endif
  26.  
  27. #if defined(__cplusplus)
  28. extern "C" {
  29. #endif
  30.  
  31. #ifndef TRUE
  32. #define FALSE 0
  33. #define TRUE 1
  34. #endif
  35.  
  36. typedef struct _D3DRMVECTOR4D
  37. {   D3DVALUE x, y, z, w;
  38. } D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
  39.  
  40. typedef D3DVALUE D3DRMMATRIX4D[4][4];
  41.  
  42. typedef struct _D3DRMQUATERNION
  43. {   D3DVALUE s;
  44.     D3DVECTOR v;
  45. } D3DRMQUATERNION, *LPD3DRMQUATERNION;
  46.  
  47. typedef struct _D3DRMBOX
  48. {   D3DVECTOR min, max;
  49. } D3DRMBOX, *LPD3DRMBOX;
  50.  
  51. typedef void (*D3DRMWRAPCALLBACK)
  52.     (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
  53.  
  54. typedef enum _D3DRMLIGHTTYPE
  55. {   D3DRMLIGHT_AMBIENT,
  56.     D3DRMLIGHT_POINT,
  57.     D3DRMLIGHT_SPOT,
  58.     D3DRMLIGHT_DIRECTIONAL,
  59.     D3DRMLIGHT_PARALLELPOINT
  60. } D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
  61.  
  62. typedef enum _D3DRMSHADEMODE {
  63.     D3DRMSHADE_FLAT     = 0,
  64.     D3DRMSHADE_GOURAUD  = 1,
  65.     D3DRMSHADE_PHONG    = 2,
  66.  
  67.     D3DRMSHADE_MASK     = 7,
  68.     D3DRMSHADE_MAX      = 8
  69. } D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
  70.  
  71. typedef enum _D3DRMLIGHTMODE {
  72.     D3DRMLIGHT_OFF      = 0 * D3DRMSHADE_MAX,
  73.     D3DRMLIGHT_ON       = 1 * D3DRMSHADE_MAX,
  74.  
  75.     D3DRMLIGHT_MASK     = 7 * D3DRMSHADE_MAX,
  76.     D3DRMLIGHT_MAX      = 8 * D3DRMSHADE_MAX
  77. } D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
  78.  
  79. typedef enum _D3DRMFILLMODE {
  80.     D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX,
  81.     D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
  82.     D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX,
  83.  
  84.     D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX,
  85.     D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX
  86. } D3DRMFILLMODE, *LPD3DRMFILLMODE;
  87.  
  88. typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
  89.  
  90. #define D3DRMRENDER_WIREFRAME   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
  91. #define D3DRMRENDER_UNLITFLAT   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
  92. #define D3DRMRENDER_FLAT        (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  93. #define D3DRMRENDER_GOURAUD     (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  94. #define D3DRMRENDER_PHONG       (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  95.  
  96. typedef enum _D3DRMTEXTUREQUALITY
  97. {   D3DRMTEXTURE_NEAREST,               /* choose nearest texel */
  98.     D3DRMTEXTURE_LINEAR,                /* interpolate 4 texels */
  99.     D3DRMTEXTURE_MIPNEAREST,            /* nearest texel in nearest mipmap  */
  100.     D3DRMTEXTURE_MIPLINEAR,             /* interpolate 2 texels from 2 mipmaps */
  101.     D3DRMTEXTURE_LINEARMIPNEAREST,      /* interpolate 4 texels in nearest mipmap */
  102.     D3DRMTEXTURE_LINEARMIPLINEAR        /* interpolate 8 texels from 2 mipmaps */
  103. } D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
  104.  
  105. typedef enum _D3DRMCOMBINETYPE
  106. {   D3DRMCOMBINE_REPLACE,
  107.     D3DRMCOMBINE_BEFORE,
  108.     D3DRMCOMBINE_AFTER
  109. } D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
  110.  
  111. typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
  112.  
  113. typedef enum _D3DRMPALETTEFLAGS
  114. {   D3DRMPALETTE_FREE,                  /* renderer may use this entry freely */
  115.     D3DRMPALETTE_READONLY,              /* fixed but may be used by renderer */
  116.     D3DRMPALETTE_RESERVED               /* may not be used by renderer */
  117. } D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
  118.  
  119. typedef struct _D3DRMPALETTEENTRY
  120. {   unsigned char red;          /* 0 .. 255 */
  121.     unsigned char green;        /* 0 .. 255 */
  122.     unsigned char blue;         /* 0 .. 255 */
  123.     unsigned char flags;        /* one of D3DRMPALETTEFLAGS */
  124. } D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
  125.  
  126. typedef struct _D3DRMIMAGE
  127. {   int width, height;          /* width and height in pixels */
  128.     int aspectx, aspecty;       /* aspect ratio for non-square pixels */
  129.     int depth;                  /* bits per pixel */
  130.     int rgb;                    /* if false, pixels are indices into a
  131.                                    palette otherwise, pixels encode
  132.                                    RGB values. */
  133.     int bytes_per_line;         /* number of bytes of memory for a
  134.                                    scanline. This must be a multiple
  135.                                    of 4. */
  136.     void* buffer1;              /* memory to render into (first buffer). */
  137.     void* buffer2;              /* second rendering buffer for double
  138.                                    buffering, set to NULL for single
  139.                                    buffering. */
  140.     unsigned long red_mask;
  141.     unsigned long green_mask;
  142.     unsigned long blue_mask;
  143.     unsigned long alpha_mask;   /* if rgb is true, these are masks for
  144.                                    the red, green and blue parts of a
  145.                                    pixel.  Otherwise, these are masks
  146.                                    for the significant bits of the
  147.                                    red, green and blue elements in the
  148.                                    palette.  For instance, most SVGA
  149.                                    displays use 64 intensities of red,
  150.                                    green and blue, so the masks should
  151.                                    all be set to 0xfc. */
  152.     int palette_size;           /* number of entries in palette */
  153.     D3DRMPALETTEENTRY* palette; /* description of the palette (only if
  154.                                    rgb is false).  Must be (1<<depth)
  155.                                    elements. */
  156. } D3DRMIMAGE, *LPD3DRMIMAGE;
  157.  
  158. typedef enum _D3DRMWRAPTYPE
  159. {   D3DRMWRAP_FLAT,
  160.     D3DRMWRAP_CYLINDER,
  161.     D3DRMWRAP_SPHERE,
  162.     D3DRMWRAP_CHROME
  163. } D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
  164.  
  165. #define D3DRMWIREFRAME_CULL             1 /* cull backfaces */
  166. #define D3DRMWIREFRAME_HIDDENLINE       2 /* lines are obscured by closer objects */
  167.  
  168. typedef enum _D3DRMPROJECTIONTYPE
  169. {   D3DRMPROJECT_PERSPECTIVE,
  170.     D3DRMPROJECT_ORTHOGRAPHIC
  171. } D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
  172.  
  173. typedef enum _D3DRMXOFFORMAT
  174. {   D3DRMXOF_BINARY,
  175.     D3DRMXOF_COMPRESSED,
  176.     D3DRMXOF_TEXT
  177. } D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
  178.  
  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.  
  186. typedef enum _D3DRMCOLORSOURCE
  187. {   D3DRMCOLOR_FROMFACE,
  188.     D3DRMCOLOR_FROMVERTEX
  189. } D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
  190.  
  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.  
  197. typedef enum _D3DRMMATERIALMODE
  198. {   D3DRMMATERIAL_FROMMESH,
  199.     D3DRMMATERIAL_FROMPARENT,
  200.     D3DRMMATERIAL_FROMFRAME
  201. } D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
  202.  
  203. typedef enum _D3DRMFOGMODE
  204. {   D3DRMFOG_LINEAR,            /* linear between start and end */
  205.     D3DRMFOG_EXPONENTIAL,       /* density * exp(-distance) */
  206.     D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
  207. } D3DRMFOGMODE, *LPD3DRMFOGMODE;
  208.  
  209. typedef enum _D3DRMZBUFFERMODE {
  210.     D3DRMZBUFFER_FROMPARENT,    /* default */
  211.     D3DRMZBUFFER_ENABLE,        /* enable zbuffering */
  212.     D3DRMZBUFFER_DISABLE        /* disable zbuffering */
  213. } D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
  214.  
  215. typedef enum _D3DRMSORTMODE {
  216.     D3DRMSORT_FROMPARENT,       /* default */
  217.     D3DRMSORT_NONE,             /* don't sort child frames */
  218.     D3DRMSORT_FRONTTOBACK,      /* sort child frames front-to-back */
  219.     D3DRMSORT_BACKTOFRONT       /* sort child frames back-to-front */
  220. } D3DRMSORTMODE, *LPD3DRMSORTMODE;
  221.  
  222. typedef DWORD D3DRMANIMATIONOPTIONS;
  223. #define D3DRMANIMATION_OPEN 0x01L
  224. #define D3DRMANIMATION_CLOSED 0x02L
  225. #define D3DRMANIMATION_LINEARPOSITION 0x04L
  226. #define D3DRMANIMATION_SPLINEPOSITION 0x08L
  227. #define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
  228. #define D3DRMANIMATION_POSITION 0x00000020L
  229.  
  230. typedef DWORD D3DRMLOADOPTIONS;
  231.  
  232. #define D3DRMLOAD_FROMFILE  0x00L
  233. #define D3DRMLOAD_FROMRESOURCE 0x01L
  234. #define D3DRMLOAD_FROMMEMORY 0x02L
  235. #define D3DRMLOAD_FROMSTREAM 0x04L
  236.  
  237. #define D3DRMLOAD_BYNAME 0x10L
  238. #define D3DRMLOAD_BYPOSITION 0x20L
  239. #define D3DRMLOAD_BYGUID 0x40L
  240. #define D3DRMLOAD_FIRST 0x80L
  241.  
  242. #define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
  243. #define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
  244.  
  245. typedef struct _D3DRMLOADRESOURCE {
  246.   HMODULE hModule;
  247.   LPCTSTR lpName;
  248.   LPCTSTR lpType;
  249. } D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
  250.  
  251. typedef struct _D3DRMLOADMEMORY {
  252.   LPVOID lpMemory;
  253.   DWORD dSize;
  254. } D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
  255.  
  256. typedef enum _D3DRMUSERVISUALREASON {
  257.     D3DRMUSERVISUAL_CANSEE,
  258.     D3DRMUSERVISUAL_RENDER
  259. } D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
  260.  
  261.  
  262. typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
  263. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
  264. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
  265. static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
  266.  
  267. typedef struct _D3DRMVERTEX
  268. {   D3DVECTOR       position;
  269.     D3DVECTOR       normal;
  270.     D3DVALUE        tu, tv;
  271.     D3DCOLOR        color;
  272. } D3DRMVERTEX, *LPD3DRMVERTEX;
  273.  
  274. typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
  275. static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
  276.  
  277. /*
  278.  * Create a color from three components in the range 0-1 inclusive.
  279.  */
  280. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGB(D3DVALUE red,
  281.                                           D3DVALUE green,
  282.                                           D3DVALUE blue);
  283.  
  284. /*
  285.  * Create a color from four components in the range 0-1 inclusive.
  286.  */
  287. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGBA(D3DVALUE red,
  288.                                                  D3DVALUE green,
  289.                                                  D3DVALUE blue,
  290.                                                  D3DVALUE alpha);
  291.  
  292. /*
  293.  * Get the red component of a color.
  294.  */
  295. extern D3DVALUE                 D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
  296.  
  297. /*
  298.  * Get the green component of a color.
  299.  */
  300. extern D3DVALUE                 D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
  301.  
  302. /*
  303.  * Get the blue component of a color.
  304.  */
  305. extern D3DVALUE                 D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
  306.  
  307. /*
  308.  * Get the alpha component of a color.
  309.  */
  310. extern D3DVALUE                 D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
  311.  
  312. /*
  313.  * Add two vectors.  Returns its first argument.
  314.  */
  315. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
  316.                                           LPD3DVECTOR s1,
  317.                                           LPD3DVECTOR s2);
  318.  
  319. /*
  320.  * Subtract two vectors.  Returns its first argument.
  321.  */
  322. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
  323.                                                LPD3DVECTOR s1,
  324.                                                LPD3DVECTOR s2);
  325. /*
  326.  * Reflect a ray about a given normal.  Returns its first argument.
  327.  */
  328. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
  329.                                               LPD3DVECTOR ray,
  330.                                               LPD3DVECTOR norm);
  331.  
  332. /*
  333.  * Calculate the vector cross product.  Returns its first argument.
  334.  */
  335. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
  336.                                                    LPD3DVECTOR s1,
  337.                                                    LPD3DVECTOR s2);
  338. /*
  339.  * Return the vector dot product.
  340.  */
  341. extern D3DVALUE                 D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
  342.                                                  LPD3DVECTOR s2);
  343.  
  344. /*
  345.  * Scale a vector so that its modulus is 1.  Returns its argument or
  346.  * NULL if there was an error (e.g. a zero vector was passed).
  347.  */
  348. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
  349. #define D3DRMVectorNormalise D3DRMVectorNormalize
  350.  
  351. /*
  352.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  353.  */
  354. extern D3DVALUE                 D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
  355.  
  356. /*
  357.  * Set the rotation part of a matrix to be a rotation of theta radians
  358.  * around the given axis.
  359.  */
  360.  
  361. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
  362.  
  363. /*
  364.  * Scale a vector uniformly in all three axes
  365.  */
  366. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
  367.  
  368. /*
  369.  * Return a random unit vector
  370.  */
  371. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
  372.  
  373. /*
  374.  * Returns a unit quaternion that represents a rotation of theta radians
  375.  * around the given axis.
  376.  */
  377.  
  378. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
  379.                                                               LPD3DVECTOR v,
  380.                                                               D3DVALUE theta);
  381.  
  382. /*
  383.  * Calculate the product of two quaternions
  384.  */
  385. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
  386.                                                           LPD3DRMQUATERNION a,
  387.                                                           LPD3DRMQUATERNION b);
  388.  
  389. /*
  390.  * Interpolate between two quaternions
  391.  */
  392. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
  393.                                                        LPD3DRMQUATERNION a,
  394.                                                        LPD3DRMQUATERNION b,
  395.                                                        D3DVALUE alpha);
  396.  
  397. /*
  398.  * Calculate the matrix for the rotation that a unit quaternion represents
  399.  */
  400. extern void             D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
  401.  
  402.  
  403. #if defined(__cplusplus)
  404. };
  405. #endif
  406.  
  407. #pragma option -b.
  408. #endif
  409.