00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _GRTRACKMAP_H_
00028 #define _GRTRACKMAP_H_
00029
00030 #include <car.h>
00031 #include <raceman.h>
00032 #include <GL/gl.h>
00033 #include <GL/glut.h>
00034 #include <GL/glu.h>
00035
00036 #ifndef WIN32
00037 #include <unistd.h>
00038 #include "win32_glext.h"
00039 #endif
00040 #include <math.h>
00041
00042 #define TRACK_MAP_NONE (1<<0)
00043 #define TRACK_MAP_NORMAL (1<<1)
00044 #define TRACK_MAP_NORMAL_WITH_OPPONENTS (1<<2)
00045 #define TRACK_MAP_PAN (1<<3)
00046 #define TRACK_MAP_PAN_WITH_OPPONENTS (1<<4)
00047 #define TRACK_MAP_PAN_ALIGNED (1<<5)
00048 #define TRACK_MAP_PAN_ALIGNED_WITH_OPPONENTS (1<<6)
00049
00050
00051 #define TRACK_MAP_MASK (1<<6)
00052
00053
00054 #include <track.h>
00055 extern tTrack *grTrack;
00056
00057
00058 #include "grmain.h"
00059
00060 class cGrTrackMap
00061 {
00062 public:
00063
00064
00065 cGrTrackMap();
00066
00067
00068 ~cGrTrackMap();
00069
00070
00071 void selectTrackMap();
00072
00073
00074 void display(
00075 tCarElt *currentCar,
00076 tSituation *situation,
00077 int Winx,
00078 int Winy,
00079 int Winw,
00080 int Winh
00081 );
00082
00083
00084 void setViewMode(int vm);
00085
00086
00087 int getViewMode();
00088
00089
00090 int getDefaultViewMode();
00091
00092 private:
00093
00094 static const float RESOLUTION;
00095
00096
00097 static const float MINLINEWIDTH;
00098 static const float MAXLINEWIDTH;
00099
00100
00101 static bool isinitalized;
00102
00103
00104 static GLuint mapTexture;
00105
00106
00107 static GLuint cardot;
00108
00109
00110 static float track_min_x;
00111 static float track_max_x;
00112 static float track_min_y;
00113 static float track_max_y;
00114 static float track_width;
00115 static float track_height;
00116
00117
00118 static float track_x_ratio;
00119 static float track_y_ratio;
00120
00121
00122 static int map_x;
00123 static int map_y;
00124 static int map_size;
00125
00126
00127 static float ratio;
00128
00129
00130 static GLfloat currentCarColor[4];
00131 static GLfloat aheadCarColor[4];
00132 static GLfloat behindCarColor[4];
00133
00134
00135 int viewmode;
00136
00137
00138 void drawTrackNormal(int x, int y);
00139
00140
00141 void drawTrackPanning(int Winx, int Winy, int Winw, int Winh, tCarElt *currentCar, tSituation *situation);
00142
00143
00144 void drawTrackPanningAligned(int Winx, int Winy, int Winw, int Winh, tCarElt *currentCar, tSituation *s);
00145
00146
00147 void drawCar(tCarElt *currentCar, GLfloat* color, int x, int y);
00148
00149
00150 void drawCars(tCarElt *currentCar, tSituation *s, int x, int y);
00151
00152
00153 void initColors();
00154
00155 void checkAndSetMinimum(float ¤tmin, float &value);
00156 void checkAndSetMaximum(float ¤tmax, float &value);
00157 };
00158
00159 #endif // _GRTRACKMAP_H_
00160