home *** CD-ROM | disk | FTP | other *** search
/ Learn 3D Graphics Programming on the PC / Learn_3D_Graphics_Programming_on_the_PC_Ferraro.iso / rwdos / rwtypes.h < prev    next >
C/C++ Source or Header  |  1995-02-15  |  11KB  |  509 lines

  1. /****************************************/
  2. /*                    */
  3. /*   RenderWare(TM) Graphics Library    */
  4. /*                    */
  5. /****************************************/
  6.  
  7. /*
  8.  * This file is a product of Criterion Software Ltd.
  9.  *
  10.  * This file is provided as is with no warranties of any kind and is
  11.  * provided without any obligiation on Criterion Software Ltd.
  12.  * or Canon Inc. to assist in its use or modifiation.
  13.  *
  14.  * Criterion Software Ltd. and Canon Inc. will not, under any
  15.  * circumstances, be liable for any lost revenue or other damages
  16.  * arising from the use of this file.
  17.  *
  18.  * Copyright (c) 1991, 1992, 1993, 1994. Canon Inc.
  19.  * All Rights Reserved.
  20.  */
  21.  
  22. #ifndef _RWTYPE_H
  23. #define _RWTYPE_H
  24.  
  25. /* Common type definitions needed everywhere. */
  26. typedef short          RwInt16;
  27. typedef unsigned short RwUInt16;
  28. typedef long           RwInt32;
  29. typedef unsigned long  RwUInt32;
  30. typedef RwInt32        RwBool;
  31.  
  32. /* syntax sugar */
  33. #ifndef _MODELH
  34. typedef struct
  35. {
  36.     void *rs0;
  37. }
  38. RwMatrix4d;
  39.  
  40. typedef struct _userdraw
  41. {
  42.     void *rs0;
  43. }
  44. RwUserDraw;
  45.  
  46. typedef struct
  47. {
  48.     void *rs0;
  49. }
  50. RwCamera;
  51.  
  52. typedef struct _lite
  53. {
  54.     void *rs0;
  55. }
  56. RwLight;
  57.  
  58. typedef struct _clump
  59. {
  60.     void *rs0;
  61. }
  62. RwClump;
  63.  
  64. typedef struct _rwpolygon
  65. {
  66.     void *rs0;
  67. }
  68. RwPolygon3d;
  69.  
  70. typedef struct
  71. {
  72.     void *rs0;
  73. }
  74. RwFont;
  75.  
  76. typedef struct
  77. {
  78.     void *rs0;
  79. }
  80. RwText;
  81.  
  82. typedef struct
  83. {
  84.     void *rs0;
  85. }
  86. RwSpline;
  87.  
  88. typedef struct
  89. {
  90.     void *rs0;
  91. }
  92. RwScene;
  93.  
  94. typedef struct
  95. {
  96.     void *rs0;
  97. }
  98. RwRaster;
  99.  
  100. typedef struct _RwTexture
  101. {
  102.     void *rs0;
  103. }
  104. RwTexture;
  105.  
  106. typedef struct
  107. {
  108.     void *rs0;
  109. }
  110. RwMaterial;
  111.  
  112. #endif /* _MODEL_H */
  113.  
  114. typedef enum
  115. {
  116.     rwNALIGHTTYPE=0,
  117.     rwDIRECTIONAL,
  118.     rwPOINT,
  119.     rwCONICAL
  120. }
  121. RwLightType;
  122.  
  123. typedef enum
  124. {
  125.     rwNASTATE=0,
  126.     rwOFF,
  127.     rwON
  128. }
  129. RwState;
  130.  
  131. typedef enum
  132. {
  133.     rwNACAMERAPROJECTION=0,
  134.     rwPERSPECTIVE = 1,
  135.     rwPARALLEL = 2    /* These are bit operators */
  136. }
  137. RwCameraProjection;
  138.  
  139. typedef enum
  140. {
  141.     rwNACOMBINEOPERATION=0,
  142.     rwREPLACE,
  143.     rwPRECONCAT,
  144.     rwPOSTCONCAT
  145.  
  146. }
  147. RwCombineOperation;
  148.  
  149. typedef enum
  150. {
  151.     rwNALIGHTSAMPLING = 0,
  152.     rwFACET = 1,
  153.     rwVERTEX = 2    /* These are bit operators, so next comes 4 etc. */
  154. }
  155. RwLightSampling;
  156.  
  157. typedef enum
  158. {
  159.     rwNAGEOMETRYSAMPLING=0,
  160.     rwPOINTCLOUD,
  161.     rwWIREFRAME,
  162.     rwSOLID
  163. }
  164. RwGeometrySampling;
  165.  
  166. typedef enum
  167. {
  168.     rwNASPLINETYPE=0,
  169.     rwOPENLOOP,
  170.     rwCLOSEDLOOP
  171. }
  172. RwSplineType;
  173.  
  174. typedef enum
  175. {
  176.     rwNASPLINEPATH=0,
  177.     rwSMOOTH,
  178.     rwNICEENDS
  179. }
  180. RwSplinePath;
  181.  
  182. typedef enum
  183. {
  184.     rwNASEARCHMODE=0,
  185.     rwLOCAL,
  186.     rwGLOBAL
  187. }
  188. RwSearchMode;
  189.  
  190. /* The RwDebugState type will be removed in the next release of 
  191.    RenderWare. The following defines are included for backward 
  192.    compatibility. Use RwState for new references to this type */
  193.  
  194. #define RwDebugState RwState
  195. #define rwNADEBUGMESSAGESTATUS rwNASTATE
  196. #define rwDISABLE rwOFF
  197. #define rwENABLE  rwON
  198.  
  199. typedef enum
  200. {
  201.     rwNADEBUGMESSAGESEVERITY=0,
  202.     rwINFORM,
  203.     rwWARNING,
  204.     rwERROR
  205. }
  206. RwDebugSeverity;
  207.  
  208. typedef enum
  209. {
  210.     rwNATEXTUREDITHER=0,
  211.     rwDITHERON,
  212.     rwDITHEROFF,
  213.     rwAUTODITHER
  214. }
  215. RwTextureDitherMode;
  216.  
  217. /*
  218.  * Pick object type. Not an enum so that we can
  219.  * force structure packing to long word sized (which
  220.  * is not possible in the general case with an enum).
  221.  */
  222. typedef RwInt32            RwPickObject;
  223. #define rwNAPICKOBJECT     (RwInt32)0
  224. #define rwPICKCLUMP        (RwInt32)1
  225. #define rwPICKVERTEX       (RwInt32)2
  226.  
  227. /*
  228.  * Clump hints
  229.  */
  230. typedef RwUInt32           RwClumpHints;
  231. #define rwCONTAINER        (RwUInt32)0x0001
  232. #define rwHS               (RwUInt32)0x0002
  233. #define rwEDITABLE         (RwUInt32)0x0004
  234.  
  235. /*
  236.  * Texture modes.
  237.  */
  238. typedef RwUInt32           RwTextureModes;
  239. #define rwLIT              (RwUInt32)0x0001
  240. #define rwFORESHORTEN      (RwUInt32)0x0002
  241. #define rwFILTER           (RwUInt32)0x0004
  242.  
  243. /*
  244.  * Raster processing options. These options determine
  245.  * how a bitmap (either read from a file or created
  246.  * by the system) is processed when it is converted
  247.  * into a raster. Currently the flags control whether
  248.  * the incoming bitmap is dithered, filtered to
  249.  * texture size, matched against the RenderWare palette
  250.  * and/or gamma corrected.
  251.  */
  252. typedef RwUInt32           RwRasterOptions;
  253. #define rwAUTODITHERRASTER (RwUInt32)0x0001
  254. #define rwDITHERRASTER     (RwUInt32)0x0002
  255. #define rwFITRASTER        (RwUInt32)0x0004
  256. #define rwINDEXRASTER      (RwUInt32)0x0008
  257. #define rwGAMMARASTER      (RwUInt32)0x0010
  258. #define rwOFFSETRASTER     (RwUInt32)0x0020
  259.  
  260. /*
  261.  * Palette processing options. These options determine
  262.  * how a palette is processed when it is being written.
  263.  */
  264. typedef RwUInt32           RwPaletteOptions;
  265. #define rwGAMMAPALETTE     (RwUInt32)0x0001
  266.  
  267. /*
  268.  * UserDraw alignment types.
  269.  */
  270. typedef RwUInt32           RwUserDrawAlignmentTypes;
  271. #define rwALIGNTOP         (RwUInt32)0x0001
  272. #define rwALIGNBOTTOM      (RwUInt32)0x0002
  273. #define rwALIGNLEFT        (RwUInt32)0x0004
  274. #define rwALIGNRIGHT       (RwUInt32)0x0008
  275. #define rwALIGNTOPLEFT     (rwALIGNTOP | rwALIGNLEFT)
  276. #define rwALIGNBOTTOMRIGHT (rwALIGNBOTTOM | rwALIGNRIGHT)
  277.  
  278. typedef enum
  279. {
  280.     rwNAUSERDRAWTYPE=0,
  281.     rwCLUMPALIGN,
  282.     rwVERTEXALIGN,
  283.     rwBBOXALIGN,
  284.     rwVPALIGN
  285. } RwUserDrawType;
  286.  
  287. typedef struct
  288. {
  289.     RwInt32 x, y, w, h;
  290. } RwRect;
  291.  
  292. typedef struct
  293. {
  294.     RwReal x, y, z;
  295. }
  296. RwV3d;
  297.  
  298. typedef struct
  299. {
  300.     RwReal u, v;
  301.     /* Possibly add more elements here in future. */
  302. }
  303. RwUV;
  304.  
  305. /*
  306.  * Called RwRGBColor as we may introduce other color models at some
  307.  * time later, i.e. RwHSVColor.
  308.  */
  309. typedef struct
  310. {
  311.     RwReal r, g, b;
  312. }
  313. RwRGBColor;
  314.  
  315. typedef struct
  316. {
  317.     unsigned char r;
  318.     unsigned char g;
  319.     unsigned char b;
  320.     unsigned char flags;
  321. }
  322. RwPaletteEntry;
  323.  
  324. typedef struct
  325. {
  326.     RwInt32 vindex;        /* closest vertex to pick point */
  327.     RwInt32 d2;            /* distance squared in pixels */
  328. }
  329. RwPickVertexData;
  330.  
  331. typedef struct
  332. {
  333.     struct _clump *clump;
  334.     struct _rwpolygon *polygon;
  335.     RwPickVertexData vertex;
  336.     RwV3d wcpoint;
  337. }
  338. RwPickClumpData;
  339.  
  340. typedef struct
  341. {
  342.     RwPickObject type;
  343.     union
  344.     {
  345.     RwPickClumpData clump;
  346.     RwPickVertexData vertex;
  347.     }
  348.     object;
  349. }
  350. RwPickRecord;
  351.  
  352. /*
  353.  * Clump call backs
  354.  */
  355.  
  356. typedef struct _clump *
  357.     (*RwClumpFuncVoid) ARGS((struct _clump *target));
  358. typedef struct _clump *
  359.     (*RwClumpFuncInt) ARGS((struct _clump *target, RwInt32 arg));
  360. typedef struct _clump *
  361.     (*RwClumpFuncLong) ARGS((struct _clump *target, RwInt32 arg));
  362. typedef struct _clump *
  363.     (*RwClumpFuncReal) ARGS((struct _clump *target, RwReal arg));
  364. typedef struct _clump *
  365.     (*RwClumpFuncPointer) ARGS((struct _clump *target, void *arg));
  366. /*
  367.  * Light call backs
  368.  */
  369.  
  370. typedef struct _lite *
  371.     (*RwLightFuncVoid) ARGS((struct _lite *target));
  372. typedef struct _lite *
  373.     (*RwLightFuncInt) ARGS((struct _lite *target, RwInt32 arg));
  374. typedef struct _lite *
  375.     (*RwLightFuncLong) ARGS((struct _lite *target, RwInt32 arg));
  376. typedef struct _lite *
  377.     (*RwLightFuncReal) ARGS((struct _lite *target, RwReal arg));
  378. typedef struct _lite *
  379.     (*RwLightFuncPointer) ARGS((struct _lite *target, void *arg));
  380. /*
  381.  * Polygon call backs
  382.  */
  383.  
  384. typedef struct _rwpolygon *
  385.     (*RwPolygon3dFuncVoid) ARGS((struct _rwpolygon *target));
  386. typedef struct _rwpolygon *
  387.     (*RwPolygon3dFuncInt) ARGS((struct _rwpolygon *target, RwInt32 arg));
  388. typedef struct _rwpolygon *
  389.     (*RwPolygon3dFuncLong) ARGS((struct _rwpolygon *target, RwInt32 arg));
  390. typedef struct _rwpolygon *
  391.     (*RwPolygon3dFuncReal) ARGS((struct _rwpolygon *target, RwReal arg));
  392. typedef struct _rwpolygon *
  393.     (*RwPolygon3dFuncPointer) ARGS((struct _rwpolygon *target, void *arg));
  394. /*
  395.  * Texture call backs
  396.  */
  397.  
  398. typedef struct _RwTexture *
  399.     (*RwTextureFuncVoid) ARGS((struct _RwTexture *target));
  400. typedef struct _RwTexture *
  401.     (*RwTextureFuncInt) ARGS((struct _RwTexture *target, RwInt32 arg));
  402. typedef struct _RwTexture *
  403.     (*RwTextureFuncLong) ARGS((struct _RwTexture *target, RwInt32 arg));
  404. typedef struct _RwTexture *
  405.     (*RwTextureFuncReal) ARGS((struct _RwTexture *target, RwReal arg));
  406. typedef struct _RwTexture *
  407.     (*RwTextureFuncPointer) ARGS((struct _RwTexture *target, void *arg));
  408. /*
  409.  * UserDraw call backs
  410.  */
  411.  
  412. typedef struct _userdraw *
  413.     (*RwUserDrawFuncVoid) ARGS((struct _userdraw *target));
  414. typedef struct _userdraw *
  415.     (*RwUserDrawFuncInt) ARGS((struct _userdraw *target, RwInt32 arg));
  416. typedef struct _userdraw *
  417.     (*RwUserDrawFuncLong) ARGS((struct _userdraw *target, RwInt32 arg));
  418. typedef struct _userdraw *
  419.     (*RwUserDrawFuncReal) ARGS((struct _userdraw *target, RwReal arg));
  420. typedef struct _userdraw *
  421.     (*RwUserDrawFuncPointer) ARGS((struct _userdraw *target, void *arg));
  422.  
  423. /*
  424.  * The User Draw Function Prototype
  425.  */
  426. typedef struct _userdraw *(*RwUserDrawCallBack) ARGS((struct _userdraw *userdraw,
  427.                           void *ddimage,
  428.                           RwRect *rect,
  429.                           void *data));
  430.  
  431. /* clump axis alignment types */
  432.  
  433. typedef enum
  434. {
  435.     rwNAAXISALIGNMENT=0,
  436.     rwNOAXISALIGNMENT,
  437.     rwALIGNAXISZORIENTX,
  438.     rwALIGNAXISZORIENTY,
  439.     rwALIGNAXISXYZ
  440. } RwAxisAlignment;
  441.  
  442. /* codes used for interogating system information */
  443.  
  444. typedef enum
  445. {
  446.     rwNASYSTEMINFO=0,
  447.     rwVERSIONSTRING,
  448.     rwVERSIONMAJOR,
  449.     rwVERSIONMINOR,
  450.     rwVERSIONRELEASE,
  451.     rwFIXEDPOINTLIB,
  452.     rwDEBUGGINGLIB
  453. } RwSystemInfo;
  454.  
  455. /*
  456.  * Device info type.
  457.  * Note this is defined as a int rather than an enumerated type
  458.  * to make it simpler for individual devices to specify
  459.  * addional pieces of device info.
  460.  */
  461. typedef RwUInt32               RwDeviceInfo;
  462.  
  463. /* Generic device info. */
  464. #define rwNADEVICEINFO         (RwUInt32)0
  465. #define rwRENDERDEPTH          (RwUInt32)1
  466. #define rwINDEXEDRENDERING     (RwUInt32)2
  467. #define rwPALETTEBASED         (RwUInt32)3
  468.  
  469. /* For output devices with a hardware palette. */
  470. #define rwPALETTE              (RwUInt32)4
  471. #define rwPALETTESIZE          (RwUInt32)5
  472. #define rwFIRSTPALETTEENTRY    (RwUInt32)6
  473. #define rwLASTPALETTEENTRY     (RwUInt32)7
  474.  
  475. /*First code available for device specific info types. */
  476. #define rwDEVICESPECIFICINFO   (RwUInt32)1000
  477.  
  478. typedef RwUInt32               RwDeviceAction;
  479.  
  480. /* Generic device control actions. */
  481. #define rwNADEVICEACTION       (RwUInt32)0
  482.  
  483. /* First code available for device specific action types. */
  484. #define rwDEVICESPECIFICACTION (RwUInt32)1000
  485.  
  486. /*
  487.  * RwOpenExt paramater type. Contains a attribute-value pair for
  488.  * device opening.
  489.  */
  490. typedef RwUInt32 RwOpenOption;
  491. typedef struct
  492. {
  493.     RwOpenOption  option;
  494.     void         *value;
  495. } RwOpenArgument;
  496.  
  497. /* Generic RwOpenExt paramaters. */
  498. #define rwNAOPENOPTION         (RwUInt32)0
  499. #define rwNOOPENOPTION         (RwUInt32)1
  500.  
  501. #define rwGAMMACORRECT         (RwUInt32)2
  502.  
  503. /* First code available for device specific open options. */
  504. #define rwDEVICESPECIFICOPEN   (RwUInt32)1000
  505.  
  506. #define RWMAXPATHLEN    1024
  507.  
  508. #endif
  509.