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

  1. #ifndef ROLLTYPE_H
  2. #define ROLLTYPE_H
  3.  
  4. /**********************************************************************
  5.  *
  6.  * File :     rolltype.h
  7.  *
  8.  * Abstract : Interface to the data type encapsulating an
  9.  *            inidividual rollercoaster.
  10.  *
  11.  * This file is a product of Criterion Software Ltd.
  12.  *
  13.  * This file is provided as is with no warranties of any kind and is
  14.  * provided without any obligation on Criterion Software Ltd. or
  15.  * Canon Inc. to assist in its use or modification.
  16.  *
  17.  * Criterion Software Ltd. will not, under any
  18.  * circumstances, be liable for any lost revenue or other damages arising
  19.  * from the use of this file.
  20.  *
  21.  * Copyright (c) 1994 Criterion Software Ltd.
  22.  * All Rights Reserved.
  23.  *
  24.  * RenderWare is a trademark of Canon Inc.
  25.  *
  26.  **********************************************************************/
  27.  
  28. /**********************************************************************
  29.  *
  30.  * Application constants.
  31.  *
  32.  **********************************************************************/
  33.  
  34. #ifndef   M_PI
  35. #define   M_PI  3.141592654
  36. #endif /* M_PI */
  37. #define M_2PI 6.283185308
  38.  
  39. /*
  40.  * Tags used to identify the different clumps in the coaster's scene.
  41.  */
  42. #define CONTROLPOINTTAG                        1
  43. #define GROUNDPLANETAG                         2
  44. #define TRACKTAG                               3
  45. #define CARTAG                                 4
  46.  
  47. /*
  48.  * Default number of control points in the coaster's spline.
  49.  */
  50. #define DEFAULTNUMCONTROLPOINTS                10
  51.  
  52. /*
  53.  * Default radius for the default spline circle.
  54.  */
  55. #define DEFAULTSPLINERADIUS                    CREAL(1.0)
  56.  
  57. /*
  58.  * Default number of samples to take of the spline in generating
  59.  * the coaster's clump.
  60.  */
  61. #define DEFAULTNUMSPLINESAMPLES                100
  62.  
  63. /*
  64.  * Default ground level (beneath which the spline path cannot dip).
  65.  */
  66. #define DEFAULTGROUNDLEVEL                     CREAL(0.05)
  67.  
  68. /*
  69.  * Default sky level (above which the camera cannot climb).
  70.  */
  71. #define DEFAULTSKYLEVEL                        CREAL(3.0)
  72.  
  73. /*
  74.  * Default minimum height of a spline control point.
  75.  */
  76. #define DEFAULTMINCONTROLPOINTHEIGHT           CREAL(0.1)
  77.  
  78. /*
  79.  * Default maximum height of a spline control point.
  80.  */
  81. #define DEFAULTMAXCONTROLPOINTHEIGHT           CREAL(2.0)
  82.  
  83. /*
  84.  * Spline tracking parameters.
  85.  */
  86. #define MINSPLINEDELTA                         CREAL(0.002)
  87. #define DEFAULTSPLINEDELTA                     CREAL(0.004)
  88. #define MAXSPLINEDELTA                         CREAL(0.010)
  89. #define SPLINEDELTAACCELERATION                CREAL(0.0005)
  90. #define SPLINEDELTADECCELERATION               CREAL(0.0006)
  91.  
  92. /**********************************************************************
  93.  *
  94.  * Type definitions.
  95.  *
  96.  **********************************************************************/
  97.  
  98. /*
  99.  * The rollercoaster data type.
  100.  */
  101. typedef struct
  102. {
  103.     RwScene  *scene;
  104.     RwScene  *holdingScene;
  105.     RwLight  *light;
  106.     RwSpline *spline;
  107.     RwClump  *controlPointClumps[DEFAULTNUMCONTROLPOINTS];
  108.     RwClump  *coasterClump;
  109.     RwClump  *groundPlaneClump;
  110.     RwClump  *carClump;
  111.     RwV3d     elevationPosition;
  112.     RwV3d     planPosition;
  113.     RwReal    t;
  114.     RwReal    tDelta;
  115.     RwV3d     tAt;
  116.     RwV3d     tUp;
  117.     RwV3d     tRight;
  118.     RwV3d     tPosition;
  119.     char      filename[_MAX_PATH];
  120.     char      description[20];
  121. } RollerCoasterType;
  122.  
  123. /**********************************************************************
  124.  *
  125.  * Macro function.
  126.  *
  127.  **********************************************************************/
  128.  
  129. #define COASTERCONTROLPOINT(coaster, index) \
  130.     ((coaster)->controlPointClumps[(index) - 1])
  131.  
  132. /**********************************************************************
  133.  *
  134.  * Functions.
  135.  *
  136.  **********************************************************************/
  137.  
  138. /**********************************************************************/
  139.  
  140. extern RollerCoasterType *CreateRollerCoaster(void);
  141. extern RollerCoasterType *ReadRollerCoaster(char* filename);
  142. extern void               DestroyRollerCoaster(RollerCoasterType *coaster);
  143. extern RwBool               WriteRollerCoaster(RollerCoasterType *coaster, char* filename);
  144. extern void               SwitchToCoasterRideMode(RollerCoasterType *coaster);
  145. extern void               SwitchToCoasterEditMode(RollerCoasterType *coaster);
  146. extern int                IsCoasterControlPointPicked(RollerCoasterType *coaster, RwCamera *camera, int x, int y);
  147. extern void               TransformCoasterControlPoint(RollerCoasterType *coaster, int index, RwMatrix4d *matrix);
  148. extern RwBool               UpdateCoasterClump(RollerCoasterType *coaster);
  149. extern void               UpdateViewParameters(RollerCoasterType *coaster);
  150. extern void               TrackCameraToCoaster(RollerCoasterType *coaster, RwCamera *camera);
  151. extern void               UpdateCoasterVelocity(RollerCoasterType *coaster);
  152. extern void               EnableCoasterCar(RollerCoasterType *coaster);
  153. extern void               DisableCoasterCar(RollerCoasterType *coaster);
  154. extern void               EnableCoasterControlPoints(RollerCoasterType *coaster);
  155. extern void               DisableCoasterControlPoints(RollerCoasterType *coaster);
  156. extern RwBool               LoadTextures(RwBool setPalette);
  157. extern void               FreeTextures(void);
  158.  
  159. /**********************************************************************/
  160.  
  161. /**********************************************************************
  162.  *
  163.  * End of file.
  164.  *
  165.  **********************************************************************/
  166.  
  167. #endif /* ROLLTYPE_H */
  168.