torcs - 1.2.2

src/interfaces/track.h

Go to the documentation of this file.
00001 /***************************************************************************
00002 
00003     file                 : track.h
00004     created              : Sun Jan 30 23:00:06 CET 2000
00005     copyright            : (C) 2000 by Eric Espie
00006     email                : torcs@free.fr
00007     version              : $Id: track.h,v 1.18 2003/11/23 20:21:11 torcs Exp $
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00028 #ifndef _TRACKV1_H_
00029 #define _TRACKV1_H_
00030 
00031 #include <tgf.h>
00032 
00033 #define TRK_IDENT       0       /* from 0x01 to 0xFF */
00034 
00035 /* Parameters strings for track files */
00036 
00037 #define TRK_SECT_HDR    "Header"
00038 
00039 #define TRK_ATT_WIDTH   "width"
00040 #define TRK_ATT_SURF    "surface"
00041 #define TRK_ATT_NAME    "name"
00042 #define TRK_ATT_VERSION "version"
00043 #define TRK_ATT_AUTHOR  "author"
00044 #define TRK_ATT_DESCR   "description"
00045 #define TRK_ATT_CAT     "category"
00046 
00047 #define TRK_SECT_GRAPH  "Graphic"
00048 
00049 #define TRK_ATT_3DDESC  "3d description"
00050 #define TRK_ATT_BKGRND  "background image"
00051 #define TRK_ATT_BKGRND2 "background image2"
00052 #define TRK_ATT_BGTYPE  "background type"
00053 #define TRK_ATT_BGCLR_R "background color R"
00054 #define TRK_ATT_BGCLR_G "background color G"
00055 #define TRK_ATT_BGCLR_B "background color B"
00056 #define TRK_LST_ENV     "Environment Mapping"
00057 #define TRK_ATT_ENVNAME "env map image"
00058 #define TRK_ATT_SPEC_R  "specular color R"
00059 #define TRK_ATT_SPEC_G  "specular color G"
00060 #define TRK_ATT_SPEC_B  "specular color B"
00061 #define TRK_ATT_AMBIENT_R       "ambient color R"
00062 #define TRK_ATT_AMBIENT_G       "ambient color G"
00063 #define TRK_ATT_AMBIENT_B       "ambient color B"
00064 #define TRK_ATT_DIFFUSE_R       "diffuse color R"
00065 #define TRK_ATT_DIFFUSE_G       "diffuse color G"
00066 #define TRK_ATT_DIFFUSE_B       "diffuse color B"
00067 #define TRK_ATT_SHIN    "shininess"
00068 #define TRK_ATT_LIPOS_X "light position x"
00069 #define TRK_ATT_LIPOS_Y "light position y"
00070 #define TRK_ATT_LIPOS_Z "light position z"
00071 #define TRK_ATT_FOVFACT "fov factor"
00072 
00073 #define TRK_SECT_TURNMARKS "Graphic/Turn Marks"
00074 #define TRK_ATT_HSPACE  "horizontal space"
00075 #define TRK_ATT_VSPACE  "vertical space"
00076 
00077 #define TRK_SECT_TERRAIN  "Graphic/Terrain Generation"
00078 
00079 #define TRK_ATT_TSTEP   "track step"
00080 #define TRK_ATT_BMARGIN "border margin"
00081 #define TRK_ATT_BSTEP   "border step"
00082 #define TRK_ATT_ORIENT  "orientation"
00083 #define TRK_VAL_CLOCK   "clockwise"
00084 #define TRK_VAL_CCLOCK  "counter-clockwise"
00085 #define TRK_ATT_SURFRAND        "texture randomness"
00086 #define TRK_ATT_RELIEF  "relief file"
00087 #define TRK_ATT_ELEVATION       "elevation map"
00088 #define TRK_ATT_ALT_MAX "maximum altitude"
00089 #define TRK_ATT_ALT_MIN "minimum altitude"
00090 #define TRK_ATT_GRPSZ   "group size"
00091 #define TRK_ATT_OBJMAP  "object map"
00092 #define TRK_ATT_COLOR   "color"
00093 #define TRK_ATT_OBJECT  "object"
00094 #define TRK_ATT_SEED    "random seed"
00095 #define TRK_ATT_ORIENTATION_TYPE "orientation type"
00096 #define TRK_ATT_ORIENTATION "orientation"
00097 #define TRK_ATT_DH      "delta height"
00098 #define TRK_ATT_DV      "delta vert"
00099 #define TRK_SECT_OBJMAP "Object Maps"
00100 #define TRK_SECT_SURFACES "Surfaces"
00101 #define TRK_SECT_OBJECTS  "Objects"
00102 
00103 #define TRK_ATT_FRICTION "friction"
00104 #define TRK_ATT_ROLLRES  "rolling resistance"
00105 #define TRK_ATT_ROUGHT   "roughness"
00106 #define TRK_ATT_ROUGHTWL "roughness wavelength"
00107 #define TRK_ATT_DAMMAGE  "dammage"
00108 #define TRK_ATT_REBOUND  "rebound"
00109 #define TRK_ATT_TEXTURE  "texture name"
00110 #define TRK_ATT_BUMPNAME "bump name"
00111 #define TRK_ATT_TEXTYPE  "texture type"
00112 #define TRK_ATT_TEXLINK  "texture link with previous"
00113 #define TRK_ATT_TEXSIZE  "texture size"
00114 #define TRK_ATT_BUMPSIZE "bump size"
00115 #define TRK_ATT_TEXSTARTBOUNDARY "texture start on boundary"
00116 #define TRK_ATT_TEXMIPMAP "texture mipmap"
00117 #define TRK_ATT_R1       "color R1"
00118 #define TRK_ATT_G1       "color G1"
00119 #define TRK_ATT_B1       "color B1"
00120 #define TRK_ATT_R2       "color R2"
00121 #define TRK_ATT_G2       "color G2"
00122 #define TRK_ATT_B2       "color B2"
00123 
00124 #define TRK_ATT_STEPLEN "steps length"
00125 
00126 #define TRK_VAL_YES     "yes"
00127 #define TRK_VAL_NO      "no"
00128 
00129 #define TRK_SECT_MAIN   "Main Track"
00130 #define TRK_LST_SEGMENTS        "Track Segments"
00131 #define TRK_ATT_TYPE            "type"
00132 
00133 #define TRK_VAL_STR             "str"
00134 #define TRK_VAL_LFT             "lft"
00135 #define TRK_VAL_RGT             "rgt"
00136 
00137 #define TRK_ATT_LG              "lg"
00138 #define TRK_ATT_RADIUS          "radius"
00139 #define TRK_ATT_RADIUSEND       "end radius"
00140 #define TRK_ATT_ARC             "arc"
00141 #define TRK_ATT_ZS              "z start"
00142 #define TRK_ATT_ZE              "z end"
00143 #define TRK_ATT_ZSL             "z start left"
00144 #define TRK_ATT_ZSR             "z start right"
00145 #define TRK_ATT_ZEL             "z end left"
00146 #define TRK_ATT_ZER             "z end right"
00147 #define TRK_ATT_GRADE           "grade"
00148 #define TRK_ATT_BKS             "banking start"
00149 #define TRK_ATT_BKE             "banking end"
00150 #define TRK_ATT_ID              "id"
00151 #define TRK_ATT_PROFIL          "profil"
00152 #define TRK_ATT_PROFSTEPS       "profil steps"
00153 #define TRK_ATT_PROFSTEPSLEN    "profil steps length"
00154 #define TRK_ATT_PROFTGTS        "profil start tangent"
00155 #define TRK_ATT_PROFTGTE        "profil end tangent"
00156 #define TRK_ATT_PROFTGTSL       "profil start tangent left"
00157 #define TRK_ATT_PROFTGTEL       "profil end tangent left"
00158 #define TRK_ATT_PROFTGTSR       "profil start tangent right"
00159 #define TRK_ATT_PROFTGTER       "profil end tangent right"
00160 #define TRK_ATT_MARKS           "marks"
00161 #define TRK_ATT_ENVMAP          "env map"
00162 #define TRK_ATT_DOVFACTOR       "DoV factor"
00163 
00164 #define TRK_SECT_PITS           "Pits"
00165 
00166 #define TRK_ATT_ENTRY           "entry"
00167 #define TRK_ATT_EXIT            "exit"
00168 #define TRK_ATT_START           "start"
00169 #define TRK_ATT_END             "end"
00170 #define TRK_ATT_SIDE            "side"
00171 #define TRK_ATT_LEN             "length"
00172 #define TRK_ATT_SPD_LIM         "speed limit"
00173 
00174 #define TRK_SECT_LSIDE          "Left Side"
00175 #define TRK_SECT_RSIDE          "Right Side"
00176 #define TRK_SECT_LBORDER        "Left Border"
00177 #define TRK_SECT_RBORDER        "Right Border"
00178 #define TRK_SECT_LBARRIER       "Left Barrier"
00179 #define TRK_SECT_RBARRIER       "Right Barrier"
00180 
00181 #define TRK_ATT_SWIDTH          "start width"
00182 #define TRK_ATT_EWIDTH          "end width"
00183 #define TRK_ATT_STYLE           "style"
00184 #define TRK_ATT_HEIGHT          "height"
00185 #define TRK_ATT_BANKTYPE        "banking type"
00186 
00187 #define TRK_VAL_PLAN            "plan"
00188 #define TRK_VAL_WALL            "wall"
00189 #define TRK_VAL_CURB            "curb"
00190 #define TRK_VAL_FENCE           "fence"
00191 
00192 
00193 #define TRK_SECT_CAM            "Cameras"
00194 
00195 #define TRK_ATT_SEGMENT         "segment"
00196 #define TRK_ATT_TORIGHT         "to right"
00197 #define TRK_ATT_TOSTART         "to start"
00198 #define TRK_ATT_HEIGHT          "height"
00199 #define TRK_ATT_CAM_FOV         "fov start"
00200 #define TRK_ATT_CAM_FOVE        "fov end"
00201 
00202 #define TRK_VAL_ASPHALT         "asphalt"
00203 #define TRK_VAL_CONCRETE        "concrete"
00204 #define TRK_VAL_GRASS           "grass"
00205 #define TRK_VAL_SAND            "sand"
00206 #define TRK_VAL_DIRT            "dirt"
00207 #define TRK_VAL_BARRIER         "barrier"
00208 
00209 #define TRK_VAL_LINEAR          "linear"
00210 #define TRK_VAL_SPLINE          "spline"
00211 
00212 #define TRK_VAL_TANGENT         "tangent"
00213 #define TRK_VAL_LEVEL           "level"
00214 
00216 typedef struct RoadCam
00217 {
00218     char                *name;
00219     t3Dd                pos;
00220     struct RoadCam      *next;
00221 } tRoadCam;
00222 
00224 typedef struct SegExt
00225 {
00226     int         nbMarks;        
00227     int         *marks;         
00228 } tSegExt;
00229 
00230 
00232 typedef struct trackSurface {
00233     struct trackSurface *next;  
00235     char *material;             
00237     tdble kFriction;            
00238     tdble kRebound;             
00239     tdble kRollRes;             
00240     tdble kRoughness;           
00241     tdble kRoughWaveLen;        
00242     tdble kDammage;             
00244 } tTrackSurface;
00245 
00246 
00247 
00249 typedef struct trackBarrier {
00250     int                 style;  
00251     tdble               width;  
00252     tdble               height; 
00253     tTrackSurface       *surface; 
00254 } tTrackBarrier;
00255 
00256 
00265 typedef struct trackSeg {
00266     char *name;                 
00267     int id;                     
00269     int type;                   
00274 #define TR_RGT      1           
00275 #define TR_LFT      2           
00276 #define TR_STR      3           
00278     int type2;                  
00285 #define TR_MAIN     1           
00286 #define TR_LSIDE    2           
00287 #define TR_RSIDE    3           
00288 #define TR_LBORDER  4           
00289 #define TR_RBORDER  5           
00291     int style;                  
00298 #define TR_PLAN         0       
00299 #define TR_CURB         1       
00300 #define TR_WALL         2       
00301 #define TR_FENCE        3       
00302 #define TR_PITBUILDING  4       
00304     tdble length;               
00305     tdble width;                
00306     tdble startWidth;           
00307     tdble endWidth;             
00308     tdble lgfromstart;          
00309     tdble radius;               
00310     tdble radiusr;              
00311     tdble radiusl;              
00312     tdble arc;                  
00313     t3Dd center;                
00314     t3Dd vertex[4];             
00321 #define TR_SL   0               
00322 #define TR_SR   1               
00323 #define TR_EL   2               
00324 #define TR_ER   3               
00326     tdble angle[7];             
00336 #define TR_ZS   0               
00337 #define TR_ZE   1               
00338 #define TR_YL   2               
00339 #define TR_YR   3               
00340 #define TR_XS   4               
00341 #define TR_XE   5               
00342 #define TR_CS   6               
00344     /* constants used to find the height of a point */
00345     tdble Kzl;          /* long constant */
00346     tdble Kzw;          /* width constant */
00347     /* constant used to find the width of a segment */
00348     tdble       Kyl;            /* find y along x */
00349     t3Dd        rgtSideNormal;  /* normal to the right side in case of straight segment */
00350     int         envIndex;       /* Environment mapping image index */
00351 
00352     tdble       height;         
00354     unsigned int raceInfo;      
00365 #define TR_NORMAL       0x00000000 
00366 #define TR_LAST         0x00000001 
00367 #define TR_START        0x00000002 
00368 #define TR_PITLANE      0x00000004 
00369 #define TR_SPEEDLIMIT   0x00000008 
00370 #define TR_PITENTRY     0x00000010 
00371 #define TR_PITEXIT      0x00000020 
00372 #define TR_PIT          0x00000040 
00373 #define TR_PITSTART     0x00000080 
00374 #define TR_PITEND       0x00000100 
00376     tdble DoVfactor;            /* the factor to use in calculating DoV for this Seg */
00377 
00378     /* pointers */
00379 
00380     /* optionnal extensions */
00381     tSegExt             *ext;
00382 
00383     tTrackSurface       *surface; 
00384     tTrackBarrier       *barrier[2]; 
00385     tRoadCam        *cam;       /* current camera */
00386     struct trackSeg *next;      
00387     struct trackSeg *prev;      
00388     struct trackSeg *lside;     
00389     struct trackSeg *rside;     
00390 } tTrackSeg;
00391 
00392 /* selection for local position structure */
00393 #define TR_TORIGHT      0
00394 #define TR_TOMIDDLE     1
00395 #define TR_TOLEFT       2
00396 
00398 typedef struct
00399 {
00400     tTrackSeg   *seg;           
00401     int         type;           
00407 #define TR_LPOS_MAIN    0       
00408 #define TR_LPOS_SEGMENT 1       
00409 #define TR_LPOS_TRACK   2       
00411     tdble       toStart;        
00412     tdble       toRight;        
00413     tdble       toMiddle;       
00414     tdble       toLeft;         
00415 } tTrkLocPos;
00416 
00417 struct CarElt;
00418 
00420 typedef struct TrackOwnPit
00421 {
00422     tTrkLocPos          pos;    
00424     int                 state;  /* not yet used (will be used for pit sharing within teams) */
00425 #define TR_PIT_STATE_FREE       0
00426 #define TR_PIT_STATE_USED       1
00427 #define TR_PIT_STATE_ASKED      2
00428     tdble               lmin;   
00429     tdble               lmax;   
00430     struct CarElt       *car;   
00431 } tTrackOwnPit;
00432 
00434 typedef struct 
00435 {
00436     int         type;           
00440 #define TR_PIT_NONE             0 
00441 #define TR_PIT_ON_TRACK_SIDE    1 
00442 #define TR_PIT_ON_SEPARATE_PATH 2
00443     int         nMaxPits;       
00444     int         nPitSeg;        
00445     int         side;           
00449     tdble       len;            
00450     tdble       width;          
00451     tdble       speedLimit;     
00452     tTrackSeg   *pitEntry;      
00453     tTrackSeg   *pitStart;      
00454     tTrackSeg   *pitEnd;        
00455     tTrackSeg   *pitExit;       
00456     tTrackOwnPit *driversPits;  
00457     int         driversPitsNb;  
00458 } tTrackPitInfo;
00459 
00460 typedef struct
00461 {
00462     tdble       height;
00463     tdble       width;
00464     tdble       hSpace;
00465     tdble       vSpace;
00466 } tTurnMarksInfo;
00467 
00468 typedef struct 
00469 {
00470     char                *background;
00471     char                *background2;
00472     int                 bgtype;
00473     float               bgColor[3];
00474     int                 envnb;
00475     char                **env;
00476     tTurnMarksInfo      turnMarksInfo;
00477 } tTrackGraphicInfo;
00478 
00482 typedef struct
00483 {
00484     char          *name;        
00485     char          *author;      
00486     char          *filename;    
00487     void          *params;      
00488     char          *internalname; 
00489     char          *category;    
00490     int           nseg;         
00491     int           version;      
00492     tdble         length;       
00493     tdble         width;        
00494     tTrackPitInfo pits;         
00495     tTrackSeg     *seg;         
00496     tTrackSurface *surfaces;    
00498     t3Dd                min;
00499     t3Dd                max;
00500     tTrackGraphicInfo   graphic;
00501 } tTrack;
00502 
00503 
00504 
00505 typedef tTrack*(*tfTrackBuild)(char*);
00506 typedef tdble(*tfTrackHeightG)(tTrackSeg*, tdble, tdble);
00507 typedef tdble(*tfTrackHeightL)(tTrkLocPos*);
00508 typedef void(*tfTrackGlobal2Local)(tTrackSeg* /*seg*/, tdble /*X*/, tdble /*Y*/, tTrkLocPos* /*pos*/, int /*sides*/);
00509 typedef void(*tfTrackLocal2Global)(tTrkLocPos*, tdble *, tdble *);
00510 typedef void(*tfTrackSideNormal)(tTrackSeg*, tdble, tdble, int, t3Dd*);
00511 typedef void(*tfTrackSurfaceNormal)(tTrkLocPos *, t3Dd*);
00512 typedef void(*tfTrackShutdown)(void);
00513 
00514 typedef struct {
00515     tfTrackBuild                trkBuild;               /* build track structure for simu */
00516     tfTrackBuild                trkBuildEx;             /* build with graphic extensions  */
00517     tfTrackHeightG              trkHeightG;
00518     tfTrackHeightL              trkHeightL;
00519     tfTrackGlobal2Local         trkGlobal2Local;
00520     tfTrackLocal2Global         trkLocal2Global;
00521     tfTrackSideNormal           trkSideNormal;
00522     tfTrackSurfaceNormal        trkSurfaceNormal;
00523     tfTrackShutdown             trkShutdown;
00524 } tTrackItf;
00525 
00526 
00527 /* For Type 3 tracks (now obsolete) */
00528 
00529 #define TRK_LST_SURF                    "List"
00530 #define TRK_LST_CAM                     "list"
00531 #define TRK_ATT_PIT_ENTRY               "pit entry"
00532 #define TRK_ATT_PIT_EXIT                "pit exit"
00533 #define TRK_ATT_PIT_START               "pit start"
00534 #define TRK_ATT_PIT_END                 "pit end"
00535 #define TRK_ATT_PIT_TYPE                "pit type"
00536 #define TRK_ATT_PIT_SIDE                "pit side"
00537 #define TRK_ATT_PIT_LEN                 "pit length"
00538 #define TRK_ATT_PIT_WIDTH               "pit width"
00539 
00540 #define TRK_LST_SEG     "segments"
00541 #define TRK_ATT_ENVIND  "env map index"
00542 
00543 
00544 #define TRK_ATT_LST     "lside type"
00545 #define TRK_ATT_LSW     "lside width"
00546 #define TRK_ATT_LSWS    "lside start width"
00547 #define TRK_ATT_LSWE    "lside end width"
00548 #define TRK_ATT_LSSURF  "lside surface"
00549 #define TRK_ATT_RST     "rside type"
00550 #define TRK_ATT_RSW     "rside width"
00551 #define TRK_ATT_RSWS    "rside start width"
00552 #define TRK_ATT_RSWE    "rside end width"
00553 #define TRK_ATT_RSSURF  "rside surface"
00554 #define TRK_ATT_LBS     "lborder style"
00555 #define TRK_ATT_LBW     "lborder width"
00556 #define TRK_ATT_LBH     "lborder height"
00557 #define TRK_ATT_LBSURF  "lborder surface"
00558 #define TRK_ATT_RBS     "rborder style"
00559 #define TRK_ATT_RBW     "rborder width"
00560 #define TRK_ATT_RBH     "rborder height"
00561 #define TRK_ATT_RBSURF  "rborder surface"
00562 
00563 #define TRK_ATT_BHEIGHT "border height"
00564 
00565 #define TRK_ATT_LBAS    "lbarrier style"
00566 #define TRK_ATT_LBAW    "lbarrier width"
00567 #define TRK_ATT_LBAH    "lbarrier height"
00568 #define TRK_ATT_LBAFRCT "lbarrier friction"
00569 #define TRK_ATT_LBASURF "lbarrier surface"
00570 #define TRK_ATT_RBAS    "rbarrier style"
00571 #define TRK_ATT_RBAW    "rbarrier width"
00572 #define TRK_ATT_RBAH    "rbarrier height"
00573 #define TRK_ATT_LBAFRCT "lbarrier friction"
00574 #define TRK_ATT_RBASURF "rbarrier surface"
00575 
00576 #define TRK_VAL_PIT_TYPE_NONE           "no pit"
00577 #define TRK_VAL_PIT_TYPE_SIDE           "track side"
00578 #define TRK_VAL_PIT_TYPE_SEP_PATH       "seperate path"
00579 
00580 #define TRK_ATT_FINISH  "finish segment"
00581 
00582 #endif /* _TRACKV1_H_ */ 
00583 
00584 
00585 

Generated at Thu Feb 26 21:52:27 2004 for torcs by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.