00001 #include <windows.h>
00002 #include "shared.h"
00003 #include "polygon.h"
00004 #include "camera.h"
00005 #include "texture.h"
00006 #include "light.h"
00007 #include "locmath.h"
00008 #include "bspline.h"
00009 #include "glFont.h"
00010 #include "bsp.h"
00011 #include "tll.h"
00012 #include "plane.h"
00013 #include "mmgr.h"
00014
00015 extern int numWorldPolygons;
00016 extern int numCameras;
00017 extern int cameraMode;
00018 extern int currentCamera;
00019 extern int numLights;
00020 extern int currentLight;
00021 extern int fps;
00022 extern float multiplier;
00023 extern GLFONT myFont;
00024 extern char HaloTypeName[MAX_PATH];
00025 extern char FireTypeName[MAX_PATH];
00026 extern int numSplines;
00027 extern int lookAtPath;
00028 extern int currentSpline;
00029 extern SPLINE* spline;
00030 extern char SplineFileName[MAX_PATH];
00031 extern PLANE frustum[6];
00032 extern int showportals;
00033 extern int currentleaf;
00034 extern int numcurrentportals;
00035 extern int numleavesvisible;
00036
00037
00038
00039
00040
00041 float dist_Point_to_Segment(VECTOR P, VECTOR S0, VECTOR S1, VECTOR* Output)
00042 {
00043 VECTOR v = S1 - S0;
00044 VECTOR w = P - S0;
00045
00046 float c1 = dot(w, v);
00047 if ( c1 <= 0 )
00048 {
00049 *Output = S0 - P;
00050 return d(P, S0);
00051 }
00052
00053 float c2 = dot(v, v);
00054 if ( c2 <= c1 )
00055 {
00056 *Output = S1 - P;
00057 return d(P, S1);
00058 }
00059
00060 float b = c1 / c2;
00061 VECTOR Pb = S0 + b * v;
00062 *Output = Pb - P;
00063 return d(P, Pb);
00064 }
00065
00066 bool CheckForParallelVectors(VECTOR Vect1, VECTOR Vect2)
00067 {
00068 Vect1.Normalize();
00069 Vect2.Normalize();
00070 float DotProduct = Vect1.DotProduct(Vect2);
00071 float Length1 = Vect1.GetMagnitude();
00072 float Length2 = Vect2.GetMagnitude();
00073
00074 if (acos(DotProduct / (Length1 * Length2)) == 0)
00075 return 1;
00076 else
00077 return 0;
00078 }
00079
00080
00081 VECTOR line_plane_collision(VECTOR *a, VECTOR *b, POLYGON *plane)
00082 {
00083 float Distance = -(plane->Vertex[0].coords.x * plane->Vertex[0].normal.x + plane->Vertex[0].coords.y * plane->Vertex[0].normal.y + plane->Vertex[0].coords.z * plane->Vertex[0].normal.z);
00084 float final_x,final_y,final_z,final_t;
00085 float t,i;
00086 VECTOR temp;
00087
00088 t=(float)0; i=(float)0;
00089 i+=(float)(plane->Vertex[0].normal.x*b->x)+(plane->Vertex[0].normal.y*b->y)+(plane->Vertex[0].normal.z*b->z)+(Distance);
00090 t+=(float)(plane->Vertex[0].normal.x*(b->x*-1))+(plane->Vertex[0].normal.y*(b->y*-1))+(plane->Vertex[0].normal.z*(b->z*-1));
00091 t+=(float)(plane->Vertex[0].normal.x*a->x)+(plane->Vertex[0].normal.y*a->y)+(plane->Vertex[0].normal.z*a->z);
00092
00093
00094 if (t)
00095 final_t = (-i)/t;
00096 else
00097 final_t = 0;
00098
00099 if ((a->x == b->x)&&(a->z == b->z))
00100 {
00101
00102 temp.x = a->x;
00103 temp.y = (-((plane->Vertex[0].normal.x*a->x)+(plane->Vertex[0].normal.z*a->z)+(Distance)))/(plane->Vertex[0].normal.y);
00104 temp.z = a->z;
00105
00106 return(temp);
00107 }
00108
00109 final_x = (((a->x)*(final_t))+((b->x)*(1-final_t)));
00110 final_y = (((a->y)*(final_t))+((b->y)*(1-final_t)));
00111 final_z = (((a->z)*(final_t))+((b->z)*(1-final_t)));
00112
00113 temp.x = final_x;
00114 temp.y = final_y;
00115 temp.z = final_z;
00116
00117 return(temp);
00118 }
00119
00120 int SphereInFrustum(VECTOR point, float radius )
00121 {
00122 int p;
00123 int c = 0;
00124 float d;
00125
00126 for( p = 0; p < 6; p++ )
00127 {
00128 d = frustum[p].normal.x * point.x + frustum[p].normal.y * point.y + frustum[p].normal.z * point.z + frustum[p].Distance;
00129 if( d <= -radius )
00130 return 0;
00131 if( d > radius )
00132 c++;
00133 }
00134 return (c == 6) ? 2 : 1;
00135 }
00136
00137 bool PointInFrustum(VECTOR point)
00138 {
00139 int p;
00140
00141 for( p = 0; p < 6; p++ )
00142 if( frustum[p].normal.x * point.x + frustum[p].normal.y * point.y + frustum[p].normal.z * point.z + frustum[p].Distance <= 0 )
00143 return false;
00144 return true;
00145 }
00146
00147 void ExtractFrustum()
00148 {
00149 float proj[16];
00150 float modl[16];
00151 float clip[16];
00152 float t;
00153
00154 glGetFloatv( GL_PROJECTION_MATRIX, proj );
00155
00156 glGetFloatv( GL_MODELVIEW_MATRIX, modl );
00157
00158 clip[ 0] = modl[ 0] * proj[ 0] + modl[ 1] * proj[ 4] + modl[ 2] * proj[ 8] + modl[ 3] * proj[12];
00159 clip[ 1] = modl[ 0] * proj[ 1] + modl[ 1] * proj[ 5] + modl[ 2] * proj[ 9] + modl[ 3] * proj[13];
00160 clip[ 2] = modl[ 0] * proj[ 2] + modl[ 1] * proj[ 6] + modl[ 2] * proj[10] + modl[ 3] * proj[14];
00161 clip[ 3] = modl[ 0] * proj[ 3] + modl[ 1] * proj[ 7] + modl[ 2] * proj[11] + modl[ 3] * proj[15];
00162 clip[ 4] = modl[ 4] * proj[ 0] + modl[ 5] * proj[ 4] + modl[ 6] * proj[ 8] + modl[ 7] * proj[12];
00163 clip[ 5] = modl[ 4] * proj[ 1] + modl[ 5] * proj[ 5] + modl[ 6] * proj[ 9] + modl[ 7] * proj[13];
00164 clip[ 6] = modl[ 4] * proj[ 2] + modl[ 5] * proj[ 6] + modl[ 6] * proj[10] + modl[ 7] * proj[14];
00165 clip[ 7] = modl[ 4] * proj[ 3] + modl[ 5] * proj[ 7] + modl[ 6] * proj[11] + modl[ 7] * proj[15];
00166 clip[ 8] = modl[ 8] * proj[ 0] + modl[ 9] * proj[ 4] + modl[10] * proj[ 8] + modl[11] * proj[12];
00167 clip[ 9] = modl[ 8] * proj[ 1] + modl[ 9] * proj[ 5] + modl[10] * proj[ 9] + modl[11] * proj[13];
00168 clip[10] = modl[ 8] * proj[ 2] + modl[ 9] * proj[ 6] + modl[10] * proj[10] + modl[11] * proj[14];
00169 clip[11] = modl[ 8] * proj[ 3] + modl[ 9] * proj[ 7] + modl[10] * proj[11] + modl[11] * proj[15];
00170 clip[12] = modl[12] * proj[ 0] + modl[13] * proj[ 4] + modl[14] * proj[ 8] + modl[15] * proj[12];
00171 clip[13] = modl[12] * proj[ 1] + modl[13] * proj[ 5] + modl[14] * proj[ 9] + modl[15] * proj[13];
00172 clip[14] = modl[12] * proj[ 2] + modl[13] * proj[ 6] + modl[14] * proj[10] + modl[15] * proj[14];
00173 clip[15] = modl[12] * proj[ 3] + modl[13] * proj[ 7] + modl[14] * proj[11] + modl[15] * proj[15];
00174
00175
00176 frustum[0].normal.x = clip[ 3] - clip[ 0];
00177 frustum[0].normal.y = clip[ 7] - clip[ 4];
00178 frustum[0].normal.z = clip[11] - clip[ 8];
00179 frustum[0].Distance = clip[15] - clip[12];
00180
00181 t = sqrt( frustum[0].normal.x * frustum[0].normal.x + frustum[0].normal.y * frustum[0].normal.y + frustum[0].normal.z * frustum[0].normal.z);
00182 frustum[0].normal.x /= t;
00183 frustum[0].normal.y /= t;
00184 frustum[0].normal.z /= t;
00185 frustum[0].Distance /= t;
00186
00187 frustum[1].normal.x = clip[ 3] + clip[ 0];
00188 frustum[1].normal.y = clip[ 7] + clip[ 4];
00189 frustum[1].normal.z = clip[11] + clip[ 8];
00190 frustum[1].Distance = clip[15] + clip[12];
00191
00192 t = sqrt( frustum[1].normal.x * frustum[1].normal.x + frustum[1].normal.y * frustum[1].normal.y + frustum[1].normal.z * frustum[1].normal.z);
00193 frustum[1].normal.x /= t;
00194 frustum[1].normal.y /= t;
00195 frustum[1].normal.z /= t;
00196 frustum[1].Distance /= t;
00197
00198 frustum[2].normal.x = clip[ 3] + clip[ 1];
00199 frustum[2].normal.y = clip[ 7] + clip[ 5];
00200 frustum[2].normal.z = clip[11] + clip[ 9];
00201 frustum[2].Distance = clip[15] + clip[13];
00202
00203 t = sqrt( frustum[2].normal.x * frustum[2].normal.x + frustum[2].normal.y * frustum[2].normal.y + frustum[2].normal.z * frustum[2].normal.z);
00204 frustum[2].normal.x /= t;
00205 frustum[2].normal.y /= t;
00206 frustum[2].normal.z /= t;
00207 frustum[2].Distance /= t;
00208
00209 frustum[3].normal.x = clip[ 3] - clip[ 1];
00210 frustum[3].normal.y = clip[ 7] - clip[ 5];
00211 frustum[3].normal.z = clip[11] - clip[ 9];
00212 frustum[3].Distance = clip[15] - clip[13];
00213
00214 t = sqrt( frustum[3].normal.x * frustum[3].normal.x + frustum[3].normal.y * frustum[3].normal.y + frustum[3].normal.z * frustum[3].normal.z);
00215 frustum[3].normal.x /= t;
00216 frustum[3].normal.y /= t;
00217 frustum[3].normal.z /= t;
00218 frustum[3].Distance /= t;
00219
00220 frustum[4].normal.x = clip[ 3] - clip[ 2];
00221 frustum[4].normal.y = clip[ 7] - clip[ 6];
00222 frustum[4].normal.z = clip[11] - clip[10];
00223 frustum[4].Distance = clip[15] - clip[14];
00224
00225 t = sqrt( frustum[4].normal.x * frustum[4].normal.x + frustum[4].normal.y * frustum[4].normal.y + frustum[4].normal.z * frustum[4].normal.z);
00226 frustum[4].normal.x /= t;
00227 frustum[4].normal.y /= t;
00228 frustum[4].normal.z /= t;
00229 frustum[4].Distance /= t;
00230
00231 frustum[5].normal.x = clip[ 3] + clip[ 2];
00232 frustum[5].normal.y = clip[ 7] + clip[ 6];
00233 frustum[5].normal.z = clip[11] + clip[10];
00234 frustum[5].Distance = clip[15] + clip[14];
00235
00236 t = sqrt( frustum[5].normal.x * frustum[5].normal.x + frustum[5].normal.y * frustum[5].normal.y + frustum[5].normal.z * frustum[5].normal.z);
00237 frustum[5].normal.x /= t;
00238 frustum[5].normal.y /= t;
00239 frustum[5].normal.z /= t;
00240 frustum[5].Distance /= t;
00241 }
00242
00243 void AddSpline(int Number, LinkedList<SPLINE>& SplineList)
00244 {
00245 SPLINE* spline2 = new SPLINE;
00246 spline2->Active = 1;
00247 spline2->Repeat = 1;
00248 spline2->Degree = 3;
00249 spline2->NumControl = 7;
00250 spline2->NumPoints = 100;
00251 spline2->Control = new VECTOR[100];
00252 spline2->Output = new VECTOR[1000];
00253 spline2->StartTime = 5000;
00254 spline2->EndTime = 25000;
00255 spline2->CopyOfStartTime = spline2->StartTime;
00256 spline2->CopyOfEndTime = spline2->EndTime;
00257
00258 spline2->Red = ((float)(rand()%226) + 30.0) / 255;
00259 spline2->Green = ((float)(rand()%226) + 30.0) / 255;
00260 spline2->Blue = ((float)(rand()%266) + 30.0) / 255;
00261
00262 for (int loop = 0; loop < 100; loop++)
00263 {
00264 spline2->Control[loop].x = rand()%60 - 29; spline2->Control[loop].y = rand()%60 - 29; spline2->Control[loop].z = rand()%60 - 29;
00265 }
00266
00267 spline2->linkPosition = Number;
00268 SplineList.Insert(spline2);
00269 }
00270
00271 void DeleteSpline(int Number, LinkedList<SPLINE>& SplineList)
00272 {
00273 SPLINE* temp = SplineList.Get(Number);
00274 delete[] temp->Control;
00275 delete[] temp->Output;
00276 SplineList.Delete(Number);
00277 delete temp;
00278 }
00279
00280 int LoadSplines(char* SplineFileName, LinkedList<SPLINE>& SplineList)
00281 {
00282 const int stringLength = 33;
00283 char tempString[stringLength];
00284 FILE* SplineFile;
00285 SplineFile = fopen(SplineFileName, "rt");
00286 if (!SplineFile)
00287 {
00288 MessageBox(NULL, "Spline File didn't open", "Error", MB_OK | MB_ICONERROR);
00289 return 0;
00290 }
00291 fseek(SplineFile, 0, SEEK_SET);
00292 int InitialNumSplines = numSplines;
00293 if (!fgets(tempString, stringLength, SplineFile))
00294 {
00295 MessageBox(NULL, "Error reading from the spline data file", "Error", MB_OK | MB_ICONERROR);
00296 numSplines = InitialNumSplines;
00297 return FALSE;
00298 }
00299 numSplines = atoi(tempString);
00300 if (InitialNumSplines > numSplines)
00301 {
00302 for (int loop = InitialNumSplines - 1; loop >= numSplines; loop--)
00303 {
00304 DeleteSpline(loop, SplineList);
00305 }
00306 }
00307 if (numSplines > InitialNumSplines)
00308 {
00309 for (int loop = InitialNumSplines; loop < numSplines; loop++)
00310 {
00311 AddSpline(loop, SplineList);
00312 }
00313 }
00314 for (int loop = 0; loop < numSplines; loop++)
00315 {
00316 spline = SplineList.Get(loop);
00317
00318 fgets(tempString, stringLength, SplineFile);
00319 spline->Active = atoi(tempString);
00320
00321 fgets(tempString, stringLength, SplineFile);
00322 spline->Repeat = atoi(tempString);
00323
00324 fgets(tempString, stringLength, SplineFile);
00325 spline->Degree = atoi(tempString);
00326
00327 fgets(tempString, stringLength, SplineFile);
00328 spline->NumControl = atoi(tempString);
00329
00330 fgets(tempString, stringLength, SplineFile);
00331 spline->NumPoints = atoi(tempString);
00332
00333 fgets(tempString, stringLength, SplineFile);
00334 spline->StartTime = atof(tempString);
00335
00336 fgets(tempString, stringLength, SplineFile);
00337 spline->EndTime = atof(tempString);
00338
00339 fgets(tempString, stringLength, SplineFile);
00340 spline->Red = atof(tempString);
00341
00342 fgets(tempString, stringLength, SplineFile);
00343 spline->Green = atof(tempString);
00344
00345 fgets(tempString, stringLength, SplineFile);
00346 spline->Blue = atof(tempString);
00347
00348 for (int loop2 = 0; loop2 <= spline->NumControl; loop2++)
00349 {
00350 fgets(tempString, stringLength, SplineFile);
00351 spline->Control[loop2].x = atof(tempString);
00352 fgets(tempString, stringLength, SplineFile);
00353 spline->Control[loop2].y = atof(tempString);
00354 fgets(tempString, stringLength, SplineFile);
00355 spline->Control[loop2].z = atof(tempString);
00356 }
00357 spline->CopyOfStartTime = spline->StartTime;
00358 spline->CopyOfEndTime = spline->EndTime;
00359 }
00360
00361 currentSpline = numSplines - 1;
00362 if (lookAtPath >= numSplines)
00363 lookAtPath = numSplines - 1;
00364 if (fclose(SplineFile))
00365 MessageBox(NULL, "File didn't close", "Error", MB_OK | MB_ICONERROR);
00366 return 1;
00367 }
00368
00369 void SetSplines(LinkedList<SPLINE>& SplineList)
00370 {
00371 srand((unsigned)time(NULL));
00372
00373 for (int loop = 0; loop < numSplines; loop++)
00374 {
00375 AddSpline(loop, SplineList);
00376 }
00377
00378 LoadSplines(SplineFileName, SplineList);
00379 }
00380
00381 void SetGLLighting(LIGHT* light)
00382 {
00383 int temp;
00384 for (temp = 0; temp <= numLights; temp++)
00385 {
00386 light[temp].LightNumber = temp;
00387 light[temp].Reset();
00388 }
00389 glEnable(GL_LIGHTING);
00390 }
00391
00392 void SetGLCamera(CAMERA* camera)
00393 {
00394 int temp;
00395 for(temp = 0; temp <= numCameras; temp++)
00396 camera[temp].Reset();
00397 }
00398
00399 void SetGLVertices(VERTEX* vertex)
00400 {
00401 vertex[0].coords.x = -80;
00402 vertex[0].coords.y = -10;
00403 vertex[0].coords.z = -60;
00404
00405 vertex[1].coords.x = 20;
00406 vertex[1].coords.y = -10;
00407 vertex[1].coords.z = -60;
00408
00409 vertex[2].coords.x = 20;
00410 vertex[2].coords.y = -10;
00411 vertex[2].coords.z = -40;
00412
00413 vertex[3].coords.x = 170;
00414 vertex[3].coords.y = -10;
00415 vertex[3].coords.z = -40;
00416
00417 vertex[4].coords.x = 170;
00418 vertex[4].coords.y = -10;
00419 vertex[4].coords.z = 40;
00420
00421 vertex[5].coords.x = 120;
00422 vertex[5].coords.y = -10;
00423 vertex[5].coords.z = 40;
00424
00425 vertex[6].coords.x = 120;
00426 vertex[6].coords.y = -10;
00427 vertex[6].coords.z = 80;
00428
00429 vertex[7].coords.x = 160;
00430 vertex[7].coords.y = -10;
00431 vertex[7].coords.z = 80;
00432
00433 vertex[8].coords.x = 160;
00434 vertex[8].coords.y = -10;
00435 vertex[8].coords.z = 160;
00436
00437 vertex[9].coords.x = 60;
00438 vertex[9].coords.y = -10;
00439 vertex[9].coords.z = 160;
00440
00441 vertex[10].coords.x = 60;
00442 vertex[10].coords.y = -10;
00443 vertex[10].coords.z = 80;
00444
00445 vertex[11].coords.x = 100;
00446 vertex[11].coords.y = -10;
00447 vertex[11].coords.z = 80;
00448
00449 vertex[12].coords.x = 100;
00450 vertex[12].coords.y = -10;
00451 vertex[12].coords.z = 40;
00452
00453 vertex[13].coords.x = 20;
00454 vertex[13].coords.y = -10;
00455 vertex[13].coords.z = 40;
00456
00457 vertex[14].coords.x = 20;
00458 vertex[14].coords.y = -10;
00459 vertex[14].coords.z = 60;
00460
00461 vertex[15].coords.x = -80;
00462 vertex[15].coords.y = -10;
00463 vertex[15].coords.z = 60;
00464
00465 vertex[16].coords.x = -80;
00466 vertex[16].coords.y = 10;
00467 vertex[16].coords.z = -60;
00468
00469 vertex[17].coords.x = 20;
00470 vertex[17].coords.y = 10;
00471 vertex[17].coords.z = -60;
00472
00473 vertex[18].coords.x = 20;
00474 vertex[18].coords.y = 10;
00475 vertex[18].coords.z = -40;
00476
00477 vertex[19].coords.x = 170;
00478 vertex[19].coords.y = 10;
00479 vertex[19].coords.z = -40;
00480
00481 vertex[20].coords.x = 170;
00482 vertex[20].coords.y = 10;
00483 vertex[20].coords.z = 40;
00484
00485 vertex[21].coords.x = 120;
00486 vertex[21].coords.y = 10;
00487 vertex[21].coords.z = 40;
00488
00489 vertex[22].coords.x = 120;
00490 vertex[22].coords.y = 10;
00491 vertex[22].coords.z = 80;
00492
00493 vertex[23].coords.x = 160;
00494 vertex[23].coords.y = 10;
00495 vertex[23].coords.z = 80;
00496
00497 vertex[24].coords.x = 160;
00498 vertex[24].coords.y = 10;
00499 vertex[24].coords.z = 160;
00500
00501 vertex[25].coords.x = 60;
00502 vertex[25].coords.y = 10;
00503 vertex[25].coords.z = 160;
00504
00505 vertex[26].coords.x = 60;
00506 vertex[26].coords.y = 10;
00507 vertex[26].coords.z = 80;
00508
00509 vertex[27].coords.x = 100;
00510 vertex[27].coords.y = 10;
00511 vertex[27].coords.z = 80;
00512
00513 vertex[28].coords.x = 100;
00514 vertex[28].coords.y = 10;
00515 vertex[28].coords.z = 40;
00516
00517 vertex[29].coords.x = 20;
00518 vertex[29].coords.y = 10;
00519 vertex[29].coords.z = 40;
00520
00521 vertex[30].coords.x = 20;
00522 vertex[30].coords.y = 10;
00523 vertex[30].coords.z = 60;
00524
00525 vertex[31].coords.x = -80;
00526 vertex[31].coords.y = 10;
00527 vertex[31].coords.z = 60;
00528
00529 vertex[32].coords.x = -80;
00530 vertex[32].coords.y = 10;
00531 vertex[32].coords.z = 40;
00532
00533 vertex[33].coords.x = -80;
00534 vertex[33].coords.y = 40;
00535 vertex[33].coords.z = 0;
00536
00537 vertex[34].coords.x = -80;
00538 vertex[34].coords.y = 10;
00539 vertex[34].coords.z = -40;
00540
00541 vertex[35].coords.x = 20;
00542 vertex[35].coords.y = 40;
00543 vertex[35].coords.z = 0;
00544
00545 vertex[36].coords.x = 170;
00546 vertex[36].coords.y = 40;
00547 vertex[36].coords.z = 0;
00548 }
00549
00550
00551 void SetGLWorld(POLYGON* polygon, TEXTURE* texture, VERTEX* vertex)
00552 {
00553 SetGLVertices(vertex);
00554
00555 polygon[0].Scale[0] = 6.0;
00556 polygon[0].Scale[1] = 1.0;
00557 polygon[0].Shift[0] = 0.0;
00558 polygon[0].Shift[1] = 0.0;
00559 polygon[0].Rotate = 0.0;
00560 polygon[0].Vertex[0] = vertex[0];
00561 polygon[0].Vertex[1] = vertex[17];
00562 polygon[0].Vertex[2] = vertex[16];
00563 polygon[0].Texture = texture[2].TexID;
00564 polygon[0].Vertex[0].u = 0.0;
00565 polygon[0].Vertex[0].v = 0.0;
00566 polygon[0].Vertex[1].u = 1.0;
00567 polygon[0].Vertex[1].v = 1.0;
00568 polygon[0].Vertex[2].u = 0.0;
00569 polygon[0].Vertex[2].v = 1.0;
00570
00571 polygon[1].Scale[0] = 6.0;
00572 polygon[1].Scale[1] = 1.0;
00573 polygon[1].Shift[0] = 0.0;
00574 polygon[1].Shift[1] = 0.0;
00575 polygon[1].Rotate = 0.0;
00576 polygon[1].Vertex[0] = vertex[0];
00577 polygon[1].Vertex[1] = vertex[1];
00578 polygon[1].Vertex[2] = vertex[17];
00579 polygon[1].Texture = texture[2].TexID;
00580 polygon[1].Vertex[0].u = 0.0;
00581 polygon[1].Vertex[0].v = 0.0;
00582 polygon[1].Vertex[1].u = 1.0;
00583 polygon[1].Vertex[1].v = 0.0;
00584 polygon[1].Vertex[2].u = 1.0;
00585 polygon[1].Vertex[2].v = 1.0;
00586
00587 polygon[2].Scale[0] = 1.0;
00588 polygon[2].Scale[1] = 1.0;
00589 polygon[2].Shift[0] = 0.0;
00590 polygon[2].Shift[1] = 0.0;
00591 polygon[2].Rotate = 0.0;
00592 polygon[2].Vertex[0] = vertex[1];
00593 polygon[2].Vertex[1] = vertex[18];
00594 polygon[2].Vertex[2] = vertex[17];
00595 polygon[2].Texture = texture[2].TexID;
00596 polygon[2].Vertex[0].u = 0.0;
00597 polygon[2].Vertex[0].v = 0.0;
00598 polygon[2].Vertex[1].u = 1.0;
00599 polygon[2].Vertex[1].v = 1.0;
00600 polygon[2].Vertex[2].u = 0.0;
00601 polygon[2].Vertex[2].v = 1.0;
00602
00603 polygon[3].Scale[0] = 1.0;
00604 polygon[3].Scale[1] = 1.0;
00605 polygon[3].Shift[0] = 0.0;
00606 polygon[3].Shift[1] = 0.0;
00607 polygon[3].Rotate = 0.0;
00608 polygon[3].Vertex[0] = vertex[1];
00609 polygon[3].Vertex[1] = vertex[2];
00610 polygon[3].Vertex[2] = vertex[18];
00611 polygon[3].Texture = texture[2].TexID;
00612 polygon[3].Vertex[0].u = 0.0;
00613 polygon[3].Vertex[0].v = 0.0;
00614 polygon[3].Vertex[1].u = 1.0;
00615 polygon[3].Vertex[1].v = 0.0;
00616 polygon[3].Vertex[2].u = 1.0;
00617 polygon[3].Vertex[2].v = 1.0;
00618
00619 polygon[4].Scale[0] = 5.0;
00620 polygon[4].Scale[1] = 1.0;
00621 polygon[4].Shift[0] = 0.0;
00622 polygon[4].Shift[1] = 0.0;
00623 polygon[4].Rotate = 0.0;
00624 polygon[4].Vertex[0] = vertex[2];
00625 polygon[4].Vertex[1] = vertex[19];
00626 polygon[4].Vertex[2] = vertex[18];
00627 polygon[4].Texture = texture[2].TexID;
00628 polygon[4].Vertex[0].u = 0.0;
00629 polygon[4].Vertex[0].v = 0.0;
00630 polygon[4].Vertex[1].u = 1.0;
00631 polygon[4].Vertex[1].v = 1.0;
00632 polygon[4].Vertex[2].u = 0.0;
00633 polygon[4].Vertex[2].v = 1.0;
00634
00635 polygon[5].Scale[0] = 5.0;
00636 polygon[5].Scale[1] = 1.0;
00637 polygon[5].Shift[0] = 0.0;
00638 polygon[5].Shift[1] = 0.0;
00639 polygon[5].Rotate = 0.0;
00640 polygon[5].Vertex[0] = vertex[2];
00641 polygon[5].Vertex[1] = vertex[3];
00642 polygon[5].Vertex[2] = vertex[19];
00643 polygon[5].Texture = texture[2].TexID;
00644 polygon[5].Vertex[0].u = 0.0;
00645 polygon[5].Vertex[0].v = 0.0;
00646 polygon[5].Vertex[1].u = 1.0;
00647 polygon[5].Vertex[1].v = 0.0;
00648 polygon[5].Vertex[2].u = 1.0;
00649 polygon[5].Vertex[2].v = 1.0;
00650
00651 polygon[6].Scale[0] = 4.0;
00652 polygon[6].Scale[1] = 1.0;
00653 polygon[6].Shift[0] = 0.0;
00654 polygon[6].Shift[1] = 0.0;
00655 polygon[6].Rotate = 0.0;
00656 polygon[6].Vertex[0] = vertex[3];
00657 polygon[6].Vertex[1] = vertex[20];
00658 polygon[6].Vertex[2] = vertex[19];
00659 polygon[6].Texture = texture[2].TexID;
00660 polygon[6].Vertex[0].u = 0.0;
00661 polygon[6].Vertex[0].v = 0.0;
00662 polygon[6].Vertex[1].u = 1.0;
00663 polygon[6].Vertex[1].v = 1.0;
00664 polygon[6].Vertex[2].u = 0.0;
00665 polygon[6].Vertex[2].v = 1.0;
00666
00667 polygon[7].Scale[0] = 4.0;
00668 polygon[7].Scale[1] = 1.0;
00669 polygon[7].Shift[0] = 0.0;
00670 polygon[7].Shift[1] = 0.0;
00671 polygon[7].Rotate = 0.0;
00672 polygon[7].Vertex[0] = vertex[3];
00673 polygon[7].Vertex[1] = vertex[4];
00674 polygon[7].Vertex[2] = vertex[20];
00675 polygon[7].Texture = texture[2].TexID;
00676 polygon[7].Vertex[0].u = 0.0;
00677 polygon[7].Vertex[0].v = 0.0;
00678 polygon[7].Vertex[1].u = 1.0;
00679 polygon[7].Vertex[1].v = 0.0;
00680 polygon[7].Vertex[2].u = 1.0;
00681 polygon[7].Vertex[2].v = 1.0;
00682
00683 polygon[8].Scale[0] = 2.0;
00684 polygon[8].Scale[1] = 1.0;
00685 polygon[8].Shift[0] = 0.0;
00686 polygon[8].Shift[1] = 0.0;
00687 polygon[8].Rotate = 0.0;
00688 polygon[8].Vertex[0] = vertex[4];
00689 polygon[8].Vertex[1] = vertex[21];
00690 polygon[8].Vertex[2] = vertex[20];
00691 polygon[8].Texture = texture[2].TexID;
00692 polygon[8].Vertex[0].u = 0.0;
00693 polygon[8].Vertex[0].v = 0.0;
00694 polygon[8].Vertex[1].u = 1.0;
00695 polygon[8].Vertex[1].v = 1.0;
00696 polygon[8].Vertex[2].u = 0.0;
00697 polygon[8].Vertex[2].v = 1.0;
00698
00699 polygon[9].Scale[0] = 2.0;
00700 polygon[9].Scale[1] = 1.0;
00701 polygon[9].Shift[0] = 0.0;
00702 polygon[9].Shift[1] = 0.0;
00703 polygon[9].Rotate = 0.0;
00704 polygon[9].Vertex[0] = vertex[4];
00705 polygon[9].Vertex[1] = vertex[5];
00706 polygon[9].Vertex[2] = vertex[21];
00707 polygon[9].Texture = texture[2].TexID;
00708 polygon[9].Vertex[0].u = 0.0;
00709 polygon[9].Vertex[0].v = 0.0;
00710 polygon[9].Vertex[1].u = 1.0;
00711 polygon[9].Vertex[1].v = 0.0;
00712 polygon[9].Vertex[2].u = 1.0;
00713 polygon[9].Vertex[2].v = 1.0;
00714
00715 polygon[10].Scale[0] = 2.0;
00716 polygon[10].Scale[1] = 1.0;
00717 polygon[10].Shift[0] = 0.0;
00718 polygon[10].Shift[1] = 0.0;
00719 polygon[10].Rotate = 0.0;
00720 polygon[10].Vertex[0] = vertex[5];
00721 polygon[10].Vertex[1] = vertex[22];
00722 polygon[10].Vertex[2] = vertex[21];
00723 polygon[10].Texture = texture[2].TexID;
00724 polygon[10].Vertex[0].u = 0.0;
00725 polygon[10].Vertex[0].v = 0.0;
00726 polygon[10].Vertex[1].u = 1.0;
00727 polygon[10].Vertex[1].v = 1.0;
00728 polygon[10].Vertex[2].u = 0.0;
00729 polygon[10].Vertex[2].v = 1.0;
00730
00731 polygon[11].Scale[0] = 2.0;
00732 polygon[11].Scale[1] = 1.0;
00733 polygon[11].Shift[0] = 0.0;
00734 polygon[11].Shift[1] = 0.0;
00735 polygon[11].Rotate = 0.0;
00736 polygon[11].Vertex[0] = vertex[5];
00737 polygon[11].Vertex[1] = vertex[6];
00738 polygon[11].Vertex[2] = vertex[22];
00739 polygon[11].Texture = texture[2].TexID;
00740 polygon[11].Vertex[0].u = 0.0;
00741 polygon[11].Vertex[0].v = 0.0;
00742 polygon[11].Vertex[1].u = 1.0;
00743 polygon[11].Vertex[1].v = 0.0;
00744 polygon[11].Vertex[2].u = 1.0;
00745 polygon[11].Vertex[2].v = 1.0;
00746
00747 polygon[12].Scale[0] = 2.0;
00748 polygon[12].Scale[1] = 1.0;
00749 polygon[12].Shift[0] = 0.0;
00750 polygon[12].Shift[1] = 0.0;
00751 polygon[12].Rotate = 0.0;
00752 polygon[12].Vertex[0] = vertex[6];
00753 polygon[12].Vertex[1] = vertex[23];
00754 polygon[12].Vertex[2] = vertex[22];
00755 polygon[12].Texture = texture[2].TexID;
00756 polygon[12].Vertex[0].u = 0.0;
00757 polygon[12].Vertex[0].v = 0.0;
00758 polygon[12].Vertex[1].u = 1.0;
00759 polygon[12].Vertex[1].v = 1.0;
00760 polygon[12].Vertex[2].u = 0.0;
00761 polygon[12].Vertex[2].v = 1.0;
00762
00763 polygon[13].Scale[0] = 2.0;
00764 polygon[13].Scale[1] = 1.0;
00765 polygon[13].Shift[0] = 0.0;
00766 polygon[13].Shift[1] = 0.0;
00767 polygon[13].Rotate = 0.0;
00768 polygon[13].Vertex[0] = vertex[6];
00769 polygon[13].Vertex[1] = vertex[7];
00770 polygon[13].Vertex[2] = vertex[23];
00771 polygon[13].Texture = texture[2].TexID;
00772 polygon[13].Vertex[0].u = 0.0;
00773 polygon[13].Vertex[0].v = 0.0;
00774 polygon[13].Vertex[1].u = 1.0;
00775 polygon[13].Vertex[1].v = 0.0;
00776 polygon[13].Vertex[2].u = 1.0;
00777 polygon[13].Vertex[2].v = 1.0;
00778
00779 polygon[14].Scale[0] = 2.0;
00780 polygon[14].Scale[1] = 1.0;
00781 polygon[14].Shift[0] = 0.0;
00782 polygon[14].Shift[1] = 0.0;
00783 polygon[14].Rotate = 0.0;
00784 polygon[14].Vertex[0] = vertex[7];
00785 polygon[14].Vertex[1] = vertex[24];
00786 polygon[14].Vertex[2] = vertex[23];
00787 polygon[14].Texture = texture[2].TexID;
00788 polygon[14].Vertex[0].u = 0.0;
00789 polygon[14].Vertex[0].v = 0.0;
00790 polygon[14].Vertex[1].u = 1.0;
00791 polygon[14].Vertex[1].v = 1.0;
00792 polygon[14].Vertex[2].u = 0.0;
00793 polygon[14].Vertex[2].v = 1.0;
00794
00795 polygon[15].Scale[0] = 2.0;
00796 polygon[15].Scale[1] = 1.0;
00797 polygon[15].Shift[0] = 0.0;
00798 polygon[15].Shift[1] = 0.0;
00799 polygon[15].Rotate = 0.0;
00800 polygon[15].Vertex[0] = vertex[7];
00801 polygon[15].Vertex[1] = vertex[8];
00802 polygon[15].Vertex[2] = vertex[24];
00803 polygon[15].Texture = texture[2].TexID;
00804 polygon[15].Vertex[0].u = 0.0;
00805 polygon[15].Vertex[0].v = 0.0;
00806 polygon[15].Vertex[1].u = 1.0;
00807 polygon[15].Vertex[1].v = 0.0;
00808 polygon[15].Vertex[2].u = 1.0;
00809 polygon[15].Vertex[2].v = 1.0;
00810
00811 polygon[16].Scale[0] = 2.0;
00812 polygon[16].Scale[1] = 1.0;
00813 polygon[16].Shift[0] = 0.0;
00814 polygon[16].Shift[1] = 0.0;
00815 polygon[16].Rotate = 0.0;
00816 polygon[16].Vertex[0] = vertex[8];
00817 polygon[16].Vertex[1] = vertex[25];
00818 polygon[16].Vertex[2] = vertex[24];
00819 polygon[16].Texture = texture[2].TexID;
00820 polygon[16].Vertex[0].u = 0.0;
00821 polygon[16].Vertex[0].v = 0.0;
00822 polygon[16].Vertex[1].u = 1.0;
00823 polygon[16].Vertex[1].v = 1.0;
00824 polygon[16].Vertex[2].u = 0.0;
00825 polygon[16].Vertex[2].v = 1.0;
00826
00827 polygon[17].Scale[0] = 2.0;
00828 polygon[17].Scale[1] = 1.0;
00829 polygon[17].Shift[0] = 0.0;
00830 polygon[17].Shift[1] = 0.0;
00831 polygon[17].Rotate = 0.0;
00832 polygon[17].Vertex[0] = vertex[8];
00833 polygon[17].Vertex[1] = vertex[9];
00834 polygon[17].Vertex[2] = vertex[25];
00835 polygon[17].Texture = texture[2].TexID;
00836 polygon[17].Vertex[0].u = 0.0;
00837 polygon[17].Vertex[0].v = 0.0;
00838 polygon[17].Vertex[1].u = 1.0;
00839 polygon[17].Vertex[1].v = 0.0;
00840 polygon[17].Vertex[2].u = 1.0;
00841 polygon[17].Vertex[2].v = 1.0;
00842
00843 polygon[18].Scale[0] = 2.0;
00844 polygon[18].Scale[1] = 1.0;
00845 polygon[18].Shift[0] = 0.0;
00846 polygon[18].Shift[1] = 20.0;
00847 polygon[18].Rotate = 0.0;
00848 polygon[18].Vertex[0] = vertex[9];
00849 polygon[18].Vertex[1] = vertex[26];
00850 polygon[18].Vertex[2] = vertex[25];
00851 polygon[18].Texture = texture[2].TexID;
00852 polygon[18].Vertex[0].u = 0.0;
00853 polygon[18].Vertex[0].v = 0.0;
00854 polygon[18].Vertex[1].u = 1.0;
00855 polygon[18].Vertex[1].v = 1.0;
00856 polygon[18].Vertex[2].u = 0.0;
00857 polygon[18].Vertex[2].v = 1.0;
00858
00859 polygon[19].Scale[0] = 2.0;
00860 polygon[19].Scale[1] = 1.0;
00861 polygon[19].Shift[0] = 0.0;
00862 polygon[19].Shift[1] = 20.0;
00863 polygon[19].Rotate = 0.0;
00864 polygon[19].Vertex[0] = vertex[9];
00865 polygon[19].Vertex[1] = vertex[10];
00866 polygon[19].Vertex[2] = vertex[26];
00867 polygon[19].Texture = texture[2].TexID;
00868 polygon[19].Vertex[0].u = 0.0;
00869 polygon[19].Vertex[0].v = 0.0;
00870 polygon[19].Vertex[1].u = 1.0;
00871 polygon[19].Vertex[1].v = 0.0;
00872 polygon[19].Vertex[2].u = 1.0;
00873 polygon[19].Vertex[2].v = 1.0;
00874
00875 polygon[20].Scale[0] = 2.0;
00876 polygon[20].Scale[1] = 1.0;
00877 polygon[20].Shift[0] = 0.0;
00878 polygon[20].Shift[1] = 0.0;
00879 polygon[20].Rotate = 0.0;
00880 polygon[20].Vertex[0] = vertex[10];
00881 polygon[20].Vertex[1] = vertex[27];
00882 polygon[20].Vertex[2] = vertex[26];
00883 polygon[20].Texture = texture[2].TexID;
00884 polygon[20].Vertex[0].u = 0.0;
00885 polygon[20].Vertex[0].v = 0.0;
00886 polygon[20].Vertex[1].u = 1.0;
00887 polygon[20].Vertex[1].v = 1.0;
00888 polygon[20].Vertex[2].u = 0.0;
00889 polygon[20].Vertex[2].v = 1.0;
00890
00891 polygon[21].Scale[0] = 2.0;
00892 polygon[21].Scale[1] = 1.0;
00893 polygon[21].Shift[0] = 0.0;
00894 polygon[21].Shift[1] = 0.0;
00895 polygon[21].Rotate = 0.0;
00896 polygon[21].Vertex[0] = vertex[10];
00897 polygon[21].Vertex[1] = vertex[11];
00898 polygon[21].Vertex[2] = vertex[27];
00899 polygon[21].Texture = texture[2].TexID;
00900 polygon[21].Vertex[0].u = 0.0;
00901 polygon[21].Vertex[0].v = 0.0;
00902 polygon[21].Vertex[1].u = 1.0;
00903 polygon[21].Vertex[1].v = 0.0;
00904 polygon[21].Vertex[2].u = 1.0;
00905 polygon[21].Vertex[2].v = 1.0;
00906
00907 polygon[22].Scale[0] = 2.0;
00908 polygon[22].Scale[1] = 1.0;
00909 polygon[22].Shift[0] = 0.0;
00910 polygon[22].Shift[1] = 0.0;
00911 polygon[22].Rotate = 0.0;
00912 polygon[22].Vertex[0] = vertex[11];
00913 polygon[22].Vertex[1] = vertex[28];
00914 polygon[22].Vertex[2] = vertex[27];
00915 polygon[22].Texture = texture[2].TexID;
00916 polygon[22].Vertex[0].u = 0.0;
00917 polygon[22].Vertex[0].v = 0.0;
00918 polygon[22].Vertex[1].u = 1.0;
00919 polygon[22].Vertex[1].v = 1.0;
00920 polygon[22].Vertex[2].u = 0.0;
00921 polygon[22].Vertex[2].v = 1.0;
00922
00923 polygon[23].Scale[0] = 2.0;
00924 polygon[23].Scale[1] = 1.0;
00925 polygon[23].Shift[0] = 0.0;
00926 polygon[23].Shift[1] = 0.0;
00927 polygon[23].Rotate = 0.0;
00928 polygon[23].Vertex[0] = vertex[11];
00929 polygon[23].Vertex[1] = vertex[12];
00930 polygon[23].Vertex[2] = vertex[28];
00931 polygon[23].Texture = texture[2].TexID;
00932 polygon[23].Vertex[0].u = 0.0;
00933 polygon[23].Vertex[0].v = 0.0;
00934 polygon[23].Vertex[1].u = 1.0;
00935 polygon[23].Vertex[1].v = 0.0;
00936 polygon[23].Vertex[2].u = 1.0;
00937 polygon[23].Vertex[2].v = 1.0;
00938
00939
00940 polygon[24].Scale[0] = 2.0;
00941 polygon[24].Scale[1] = 1.0;
00942 polygon[24].Shift[0] = 0.0;
00943 polygon[24].Shift[1] = 0.0;
00944 polygon[24].Rotate = 0.0;
00945 polygon[24].Vertex[0] = vertex[12];
00946 polygon[24].Vertex[1] = vertex[29];
00947 polygon[24].Vertex[2] = vertex[28];
00948 polygon[24].Texture = texture[2].TexID;
00949 polygon[24].Vertex[0].u = 0.0;
00950 polygon[24].Vertex[0].v = 0.0;
00951 polygon[24].Vertex[1].u = 1.0;
00952 polygon[24].Vertex[1].v = 1.0;
00953 polygon[24].Vertex[2].u = 0.0;
00954 polygon[24].Vertex[2].v = 1.0;
00955
00956 polygon[25].Scale[0] = 2.0;
00957 polygon[25].Scale[1] = 1.0;
00958 polygon[25].Shift[0] = 0.0;
00959 polygon[25].Shift[1] = 0.0;
00960 polygon[25].Rotate = 0.0;
00961 polygon[25].Vertex[0] = vertex[12];
00962 polygon[25].Vertex[1] = vertex[13];
00963 polygon[25].Vertex[2] = vertex[29];
00964 polygon[25].Texture = texture[2].TexID;
00965 polygon[25].Vertex[0].u = 0.0;
00966 polygon[25].Vertex[0].v = 0.0;
00967 polygon[25].Vertex[1].u = 1.0;
00968 polygon[25].Vertex[1].v = 0.0;
00969 polygon[25].Vertex[2].u = 1.0;
00970 polygon[25].Vertex[2].v = 1.0;
00971
00972 polygon[26].Scale[0] = 1.0;
00973 polygon[26].Scale[1] = 1.0;
00974 polygon[26].Shift[0] = 0.0;
00975 polygon[26].Shift[1] = 0.0;
00976 polygon[26].Rotate = 0.0;
00977 polygon[26].Vertex[0] = vertex[13];
00978 polygon[26].Vertex[1] = vertex[30];
00979 polygon[26].Vertex[2] = vertex[29];
00980 polygon[26].Texture = texture[2].TexID;
00981 polygon[26].Vertex[0].u = 0.0;
00982 polygon[26].Vertex[0].v = 0.0;
00983 polygon[26].Vertex[1].u = 1.0;
00984 polygon[26].Vertex[1].v = 1.0;
00985 polygon[26].Vertex[2].u = 0.0;
00986 polygon[26].Vertex[2].v = 1.0;
00987
00988 polygon[27].Scale[0] = 1.0;
00989 polygon[27].Scale[1] = 1.0;
00990 polygon[27].Shift[0] = 0.0;
00991 polygon[27].Shift[1] = 0.0;
00992 polygon[27].Rotate = 0.0;
00993 polygon[27].Vertex[0] = vertex[13];
00994 polygon[27].Vertex[1] = vertex[14];
00995 polygon[27].Vertex[2] = vertex[30];
00996 polygon[27].Texture = texture[2].TexID;
00997 polygon[27].Vertex[0].u = 0.0;
00998 polygon[27].Vertex[0].v = 0.0;
00999 polygon[27].Vertex[1].u = 1.0;
01000 polygon[27].Vertex[1].v = 0.0;
01001 polygon[27].Vertex[2].u = 1.0;
01002 polygon[27].Vertex[2].v = 1.0;
01003
01004 polygon[28].Scale[0] = 6.0;
01005 polygon[28].Scale[1] = 1.0;
01006 polygon[28].Shift[0] = 0.0;
01007 polygon[28].Shift[1] = 0.0;
01008 polygon[28].Rotate = 0.0;
01009 polygon[28].Vertex[0] = vertex[14];
01010 polygon[28].Vertex[1] = vertex[31];
01011 polygon[28].Vertex[2] = vertex[30];
01012 polygon[28].Texture = texture[2].TexID;
01013 polygon[28].Vertex[0].u = 0.0;
01014 polygon[28].Vertex[0].v = 0.0;
01015 polygon[28].Vertex[1].u = 1.0;
01016 polygon[28].Vertex[1].v = 1.0;
01017 polygon[28].Vertex[2].u = 0.0;
01018 polygon[28].Vertex[2].v = 1.0;
01019
01020 polygon[29].Scale[0] = 6.0;
01021 polygon[29].Scale[1] = 1.0;
01022 polygon[29].Shift[0] = 0.0;
01023 polygon[29].Shift[1] = 0.0;
01024 polygon[29].Rotate = 0.0;
01025 polygon[29].Vertex[0] = vertex[14];
01026 polygon[29].Vertex[1] = vertex[15];
01027 polygon[29].Vertex[2] = vertex[31];
01028 polygon[29].Texture = texture[2].TexID;
01029 polygon[29].Vertex[0].u = 0.0;
01030 polygon[29].Vertex[0].v = 0.0;
01031 polygon[29].Vertex[1].u = 1.0;
01032 polygon[29].Vertex[1].v = 0.0;
01033 polygon[29].Vertex[2].u = 1.0;
01034 polygon[29].Vertex[2].v = 1.0;
01035
01036 polygon[30].Scale[0] = 5.0;
01037 polygon[30].Scale[1] = 1.0;
01038 polygon[30].Shift[0] = 0.0;
01039 polygon[30].Shift[1] = 0.0;
01040 polygon[30].Rotate = 0.0;
01041 polygon[30].Vertex[0] = vertex[15];
01042 polygon[30].Vertex[1] = vertex[16];
01043 polygon[30].Vertex[2] = vertex[31];
01044 polygon[30].Texture = texture[2].TexID;
01045 polygon[30].Vertex[0].u = 0.0;
01046 polygon[30].Vertex[0].v = 0.0;
01047 polygon[30].Vertex[1].u = 1.0;
01048 polygon[30].Vertex[1].v = 1.0;
01049 polygon[30].Vertex[2].u = 0.0;
01050 polygon[30].Vertex[2].v = 1.0;
01051
01052 polygon[31].Scale[0] = 5.0;
01053 polygon[31].Scale[1] = 1.0;
01054 polygon[31].Shift[0] = 0.0;
01055 polygon[31].Shift[1] = 0.0;
01056 polygon[31].Rotate = 0.0;
01057 polygon[31].Vertex[0] = vertex[15];
01058 polygon[31].Vertex[1] = vertex[0];
01059 polygon[31].Vertex[2] = vertex[16];
01060 polygon[31].Texture = texture[2].TexID;
01061 polygon[31].Vertex[0].u = 0.0;
01062 polygon[31].Vertex[0].v = 0.0;
01063 polygon[31].Vertex[1].u = 1.0;
01064 polygon[31].Vertex[1].v = 0.0;
01065 polygon[31].Vertex[2].u = 1.0;
01066 polygon[31].Vertex[2].v = 1.0;
01067
01068 polygon[32].Scale[0] = 5.0;
01069 polygon[32].Scale[1] = 5.0;
01070 polygon[32].Shift[0] = 0.0;
01071 polygon[32].Shift[1] = 0.0;
01072 polygon[32].Rotate = 0.0;
01073 polygon[32].Vertex[0] = vertex[15];
01074 polygon[32].Vertex[1] = vertex[1];
01075 polygon[32].Vertex[2] = vertex[0];
01076 polygon[32].Texture = texture[0].TexID;
01077 polygon[32].Vertex[0].u = 0.0;
01078 polygon[32].Vertex[0].v = 0.0;
01079 polygon[32].Vertex[1].u = 1.0;
01080 polygon[32].Vertex[1].v = 1.0;
01081 polygon[32].Vertex[2].u = 0.0;
01082 polygon[32].Vertex[2].v = 1.0;
01083
01084 polygon[33].Scale[0] = 5.0;
01085 polygon[33].Scale[1] = 5.0;
01086 polygon[33].Shift[0] = 0.0;
01087 polygon[33].Shift[1] = 0.0;
01088 polygon[33].Rotate = 0.0;
01089 polygon[33].Vertex[0] = vertex[15];
01090 polygon[33].Vertex[1] = vertex[14];
01091 polygon[33].Vertex[2] = vertex[1];
01092 polygon[33].Texture = texture[0].TexID;
01093 polygon[33].Vertex[0].u = 0.0;
01094 polygon[33].Vertex[0].v = 0.0;
01095 polygon[33].Vertex[1].u = 1.0;
01096 polygon[33].Vertex[1].v = 0.0;
01097 polygon[33].Vertex[2].u = 1.0;
01098 polygon[33].Vertex[2].v = 1.0;
01099
01100 polygon[34].Scale[0] = 5.0;
01101 polygon[34].Scale[1] = 5.0;
01102 polygon[34].Shift[0] = 0.0;
01103 polygon[34].Shift[1] = 0.0;
01104 polygon[34].Rotate = 0.0;
01105 polygon[34].Vertex[0] = vertex[13];
01106 polygon[34].Vertex[1] = vertex[3];
01107 polygon[34].Vertex[2] = vertex[2];
01108 polygon[34].Texture = texture[0].TexID;
01109 polygon[34].Vertex[0].u = 0.0;
01110 polygon[34].Vertex[0].v = 0.0;
01111 polygon[34].Vertex[1].u = 1.0;
01112 polygon[34].Vertex[1].v = 1.0;
01113 polygon[34].Vertex[2].u = 0.0;
01114 polygon[34].Vertex[2].v = 1.0;
01115
01116 polygon[35].Scale[0] = 5.0;
01117 polygon[35].Scale[1] = 5.0;
01118 polygon[35].Shift[0] = 0.0;
01119 polygon[35].Shift[1] = 0.0;
01120 polygon[35].Rotate = 0.0;
01121 polygon[35].Vertex[0] = vertex[13];
01122 polygon[35].Vertex[1] = vertex[4];
01123 polygon[35].Vertex[2] = vertex[3];
01124 polygon[35].Texture = texture[0].TexID;
01125 polygon[35].Vertex[0].u = 0.0;
01126 polygon[35].Vertex[0].v = 0.0;
01127 polygon[35].Vertex[1].u = 1.0;
01128 polygon[35].Vertex[1].v = 0.0;
01129 polygon[35].Vertex[2].u = 1.0;
01130 polygon[35].Vertex[2].v = 1.0;
01131
01132 polygon[36].Scale[0] = 1.0;
01133 polygon[36].Scale[1] = 2.0;
01134 polygon[36].Shift[0] = 0.0;
01135 polygon[36].Shift[1] = 0.0;
01136 polygon[36].Rotate = 0.0;
01137 polygon[36].Vertex[0] = vertex[11];
01138 polygon[36].Vertex[1] = vertex[5];
01139 polygon[36].Vertex[2] = vertex[12];
01140 polygon[36].Texture = texture[0].TexID;
01141 polygon[36].Vertex[0].u = 0.0;
01142 polygon[36].Vertex[0].v = 0.0;
01143 polygon[36].Vertex[1].u = 1.0;
01144 polygon[36].Vertex[1].v = 1.0;
01145 polygon[36].Vertex[2].u = 0.0;
01146 polygon[36].Vertex[2].v = 1.0;
01147
01148 polygon[37].Scale[0] = 1.0;
01149 polygon[37].Scale[1] = 2.0;
01150 polygon[37].Shift[0] = 0.0;
01151 polygon[37].Shift[1] = 0.0;
01152 polygon[37].Rotate = 0.0;
01153 polygon[37].Vertex[0] = vertex[11];
01154 polygon[37].Vertex[1] = vertex[6];
01155 polygon[37].Vertex[2] = vertex[5];
01156 polygon[37].Texture = texture[0].TexID;
01157 polygon[37].Vertex[0].u = 0.0;
01158 polygon[37].Vertex[0].v = 0.0;
01159 polygon[37].Vertex[1].u = 1.0;
01160 polygon[37].Vertex[1].v = 0.0;
01161 polygon[37].Vertex[2].u = 1.0;
01162 polygon[37].Vertex[2].v = 1.0;
01163
01164 polygon[38].Scale[0] = 5.0;
01165 polygon[38].Scale[1] = 5.0;
01166 polygon[38].Shift[0] = 0.0;
01167 polygon[38].Shift[1] = 0.0;
01168 polygon[38].Rotate = 0.0;
01169 polygon[38].Vertex[0] = vertex[9];
01170 polygon[38].Vertex[1] = vertex[7];
01171 polygon[38].Vertex[2] = vertex[10];
01172 polygon[38].Texture = texture[0].TexID;
01173 polygon[38].Vertex[0].u = 0.0;
01174 polygon[38].Vertex[0].v = 0.0;
01175 polygon[38].Vertex[1].u = 1.0;
01176 polygon[38].Vertex[1].v = 1.0;
01177 polygon[38].Vertex[2].u = 0.0;
01178 polygon[38].Vertex[2].v = 1.0;
01179
01180 polygon[39].Scale[0] = 5.0;
01181 polygon[39].Scale[1] = 5.0;
01182 polygon[39].Shift[0] = 0.0;
01183 polygon[39].Shift[1] = 0.0;
01184 polygon[39].Rotate = 0.0;
01185 polygon[39].Vertex[0] = vertex[9];
01186 polygon[39].Vertex[1] = vertex[8];
01187 polygon[39].Vertex[2] = vertex[7];
01188 polygon[39].Texture = texture[0].TexID;
01189 polygon[39].Vertex[0].u = 0.0;
01190 polygon[39].Vertex[0].v = 0.0;
01191 polygon[39].Vertex[1].u = 1.0;
01192 polygon[39].Vertex[1].v = 0.0;
01193 polygon[39].Vertex[2].u = 1.0;
01194 polygon[39].Vertex[2].v = 1.0;
01195
01196 polygon[40].Scale[0] = 5.0;
01197 polygon[40].Scale[1] = 1.0;
01198 polygon[40].Shift[0] = 0.0;
01199 polygon[40].Shift[1] = 0.0;
01200 polygon[40].Rotate = 0.0;
01201 polygon[40].Vertex[0] = vertex[18];
01202 polygon[40].Vertex[1] = vertex[16];
01203 polygon[40].Vertex[2] = vertex[17];
01204 polygon[40].Texture = texture[1].TexID;
01205 polygon[40].Vertex[0].u = 0.0;
01206 polygon[40].Vertex[0].v = 0.0;
01207 polygon[40].Vertex[1].u = 1.0;
01208 polygon[40].Vertex[1].v = 1.0;
01209 polygon[40].Vertex[2].u = 0.0;
01210 polygon[40].Vertex[2].v = 1.0;
01211
01212 polygon[41].Scale[0] = 5.0;
01213 polygon[41].Scale[1] = 1.0;
01214 polygon[41].Shift[0] = 0.0;
01215 polygon[41].Shift[1] = 0.0;
01216 polygon[41].Rotate = 0.0;
01217 polygon[41].Vertex[0] = vertex[18];
01218 polygon[41].Vertex[1] = vertex[34];
01219 polygon[41].Vertex[2] = vertex[16];
01220 polygon[41].Texture = texture[1].TexID;
01221 polygon[41].Vertex[0].u = 0.0;
01222 polygon[41].Vertex[0].v = 0.0;
01223 polygon[41].Vertex[1].u = 1.0;
01224 polygon[41].Vertex[1].v = 0.0;
01225 polygon[41].Vertex[2].u = 1.0;
01226 polygon[41].Vertex[2].v = 1.0;
01227
01228 polygon[42].Scale[0] = 3.0;
01229 polygon[42].Scale[1] = 2.0;
01230 polygon[42].Shift[0] = 0.0;
01231 polygon[42].Shift[1] = 0.0;
01232 polygon[42].Rotate = 0.0;
01233 polygon[42].Vertex[0] = vertex[36];
01234 polygon[42].Vertex[1] = vertex[18];
01235 polygon[42].Vertex[2] = vertex[19];
01236 polygon[42].Texture = texture[3].TexID;
01237 polygon[42].Vertex[0].u = 0.0;
01238 polygon[42].Vertex[0].v = 0.0;
01239 polygon[42].Vertex[1].u = 1.0;
01240 polygon[42].Vertex[1].v = 1.0;
01241 polygon[42].Vertex[2].u = 0.0;
01242 polygon[42].Vertex[2].v = 1.0;
01243
01244 polygon[43].Scale[0] = 3.0;
01245 polygon[43].Scale[1] = 2.0;
01246 polygon[43].Shift[0] = 0.0;
01247 polygon[43].Shift[1] = 0.0;
01248 polygon[43].Rotate = 0.0;
01249 polygon[43].Vertex[0] = vertex[36];
01250 polygon[43].Vertex[1] = vertex[35];
01251 polygon[43].Vertex[2] = vertex[18];
01252 polygon[43].Texture = texture[3].TexID;
01253 polygon[43].Vertex[0].u = 0.0;
01254 polygon[43].Vertex[0].v = 0.0;
01255 polygon[43].Vertex[1].u = 1.0;
01256 polygon[43].Vertex[1].v = 0.0;
01257 polygon[43].Vertex[2].u = 1.0;
01258 polygon[43].Vertex[2].v = 1.0;
01259
01260 polygon[44].Scale[0] = 1.0;
01261 polygon[44].Scale[1] = 2.0;
01262 polygon[44].Shift[0] = 0.0;
01263 polygon[44].Shift[1] = 0.0;
01264 polygon[44].Rotate = 0.0;
01265 polygon[44].Vertex[0] = vertex[22];
01266 polygon[44].Vertex[1] = vertex[28];
01267 polygon[44].Vertex[2] = vertex[21];
01268 polygon[44].Texture = texture[1].TexID;
01269 polygon[44].Vertex[0].u = 0.0;
01270 polygon[44].Vertex[0].v = 0.0;
01271 polygon[44].Vertex[1].u = 1.0;
01272 polygon[44].Vertex[1].v = 1.0;
01273 polygon[44].Vertex[2].u = 0.0;
01274 polygon[44].Vertex[2].v = 1.0;
01275
01276 polygon[45].Scale[0] = 1.0;
01277 polygon[45].Scale[1] = 2.0;
01278 polygon[45].Shift[0] = 0.0;
01279 polygon[45].Shift[1] = 0.0;
01280 polygon[45].Rotate = 0.0;
01281 polygon[45].Vertex[0] = vertex[22];
01282 polygon[45].Vertex[1] = vertex[27];
01283 polygon[45].Vertex[2] = vertex[28];
01284 polygon[45].Texture = texture[1].TexID;
01285 polygon[45].Vertex[0].u = 0.0;
01286 polygon[45].Vertex[0].v = 0.0;
01287 polygon[45].Vertex[1].u = 1.0;
01288 polygon[45].Vertex[1].v = 0.0;
01289 polygon[45].Vertex[2].u = 1.0;
01290 polygon[45].Vertex[2].v = 1.0;
01291
01292 polygon[46].Scale[0] = 5.0;
01293 polygon[46].Scale[1] = 5.0;
01294 polygon[46].Shift[0] = 0.0;
01295 polygon[46].Shift[1] = 0.0;
01296 polygon[46].Rotate = 0.0;
01297 polygon[46].Vertex[0] = vertex[24];
01298 polygon[46].Vertex[1] = vertex[26];
01299 polygon[46].Vertex[2] = vertex[23];
01300 polygon[46].Texture = texture[1].TexID;
01301 polygon[46].Vertex[0].u = 0.0;
01302 polygon[46].Vertex[0].v = 0.0;
01303 polygon[46].Vertex[1].u = 1.0;
01304 polygon[46].Vertex[1].v = 1.0;
01305 polygon[46].Vertex[2].u = 0.0;
01306 polygon[46].Vertex[2].v = 1.0;
01307
01308 polygon[47].Scale[0] = 5.0;
01309 polygon[47].Scale[1] = 5.0;
01310 polygon[47].Shift[0] = 0.0;
01311 polygon[47].Shift[1] = 0.0;
01312 polygon[47].Rotate = 0.0;
01313 polygon[47].Vertex[0] = vertex[24];
01314 polygon[47].Vertex[1] = vertex[25];
01315 polygon[47].Vertex[2] = vertex[26];
01316 polygon[47].Texture = texture[1].TexID;
01317 polygon[47].Vertex[0].u = 0.0;
01318 polygon[47].Vertex[0].v = 0.0;
01319 polygon[47].Vertex[1].u = 1.0;
01320 polygon[47].Vertex[1].v = 0.0;
01321 polygon[47].Vertex[2].u = 1.0;
01322 polygon[47].Vertex[2].v = 1.0;
01323
01324 polygon[48].Scale[0] = 3.0;
01325 polygon[48].Scale[1] = 2.0;
01326 polygon[48].Shift[0] = 0.0;
01327 polygon[48].Shift[1] = 0.0;
01328 polygon[48].Rotate = 0.0;
01329 polygon[48].Vertex[0] = vertex[20];
01330 polygon[48].Vertex[1] = vertex[35];
01331 polygon[48].Vertex[2] = vertex[36];
01332 polygon[48].Texture = texture[3].TexID;
01333 polygon[48].Vertex[0].u = 0.0;
01334 polygon[48].Vertex[0].v = 0.0;
01335 polygon[48].Vertex[1].u = 1.0;
01336 polygon[48].Vertex[1].v = 1.0;
01337 polygon[48].Vertex[2].u = 0.0;
01338 polygon[48].Vertex[2].v = 1.0;
01339
01340 polygon[49].Scale[0] = 3.0;
01341 polygon[49].Scale[1] = 2.0;
01342 polygon[49].Shift[0] = 0.0;
01343 polygon[49].Shift[1] = 0.0;
01344 polygon[49].Rotate = 0.0;
01345 polygon[49].Vertex[0] = vertex[20];
01346 polygon[49].Vertex[1] = vertex[29];
01347 polygon[49].Vertex[2] = vertex[35];
01348 polygon[49].Texture = texture[3].TexID;
01349 polygon[49].Vertex[0].u = 0.0;
01350 polygon[49].Vertex[0].v = 0.0;
01351 polygon[49].Vertex[1].u = 1.0;
01352 polygon[49].Vertex[1].v = 0.0;
01353 polygon[49].Vertex[2].u = 1.0;
01354 polygon[49].Vertex[2].v = 1.0;
01355
01356 polygon[50].Scale[0] = 5.0;
01357 polygon[50].Scale[1] = 5.0;
01358 polygon[50].Shift[0] = 0.0;
01359 polygon[50].Shift[1] = 0.0;
01360 polygon[50].Rotate = 0.0;
01361 polygon[50].Vertex[0] = vertex[30];
01362 polygon[50].Vertex[1] = vertex[32];
01363 polygon[50].Vertex[2] = vertex[29];
01364 polygon[50].Texture = texture[1].TexID;
01365 polygon[50].Vertex[0].u = 0.0;
01366 polygon[50].Vertex[0].v = 0.0;
01367 polygon[50].Vertex[1].u = 1.0;
01368 polygon[50].Vertex[1].v = 1.0;
01369 polygon[50].Vertex[2].u = 0.0;
01370 polygon[50].Vertex[2].v = 1.0;
01371
01372 polygon[51].Scale[0] = 5.0;
01373 polygon[51].Scale[1] = 5.0;
01374 polygon[51].Shift[0] = 0.0;
01375 polygon[51].Shift[1] = 0.0;
01376 polygon[51].Rotate = 0.0;
01377 polygon[51].Vertex[0] = vertex[30];
01378 polygon[51].Vertex[1] = vertex[31];
01379 polygon[51].Vertex[2] = vertex[32];
01380 polygon[51].Texture = texture[1].TexID;
01381 polygon[51].Vertex[0].u = 0.0;
01382 polygon[51].Vertex[0].v = 0.0;
01383 polygon[51].Vertex[1].u = 1.0;
01384 polygon[51].Vertex[1].v = 0.0;
01385 polygon[51].Vertex[2].u = 1.0;
01386 polygon[51].Vertex[2].v = 1.0;
01387
01388 polygon[52].Scale[0] = 3.0;
01389 polygon[52].Scale[1] = 2.0;
01390 polygon[52].Shift[0] = 0.0;
01391 polygon[52].Shift[1] = 0.0;
01392 polygon[52].Rotate = 0.0;
01393 polygon[52].Vertex[0] = vertex[29];
01394 polygon[52].Vertex[1] = vertex[33];
01395 polygon[52].Vertex[2] = vertex[35];
01396 polygon[52].Texture = texture[3].TexID;
01397 polygon[52].Vertex[0].u = 0.0;
01398 polygon[52].Vertex[0].v = 0.0;
01399 polygon[52].Vertex[1].u = 1.0;
01400 polygon[52].Vertex[1].v = 1.0;
01401 polygon[52].Vertex[2].u = 0.0;
01402 polygon[52].Vertex[2].v = 1.0;
01403
01404 polygon[53].Scale[0] = 3.0;
01405 polygon[53].Scale[1] = 2.0;
01406 polygon[53].Shift[0] = 0.0;
01407 polygon[53].Shift[1] = 0.0;
01408 polygon[53].Rotate = 0.0;
01409 polygon[53].Vertex[0] = vertex[29];
01410 polygon[53].Vertex[1] = vertex[32];
01411 polygon[53].Vertex[2] = vertex[33];
01412 polygon[53].Texture = texture[3].TexID;
01413 polygon[53].Vertex[0].u = 0.0;
01414 polygon[53].Vertex[0].v = 0.0;
01415 polygon[53].Vertex[1].u = 1.0;
01416 polygon[53].Vertex[1].v = 0.0;
01417 polygon[53].Vertex[2].u = 1.0;
01418 polygon[53].Vertex[2].v = 1.0;
01419
01420 polygon[54].Scale[0] = 3.0;
01421 polygon[54].Scale[1] = 2.0;
01422 polygon[54].Shift[0] = 0.0;
01423 polygon[54].Shift[1] = 0.0;
01424 polygon[54].Rotate = 0.0;
01425 polygon[54].Vertex[0] = vertex[35];
01426 polygon[54].Vertex[1] = vertex[34];
01427 polygon[54].Vertex[2] = vertex[18];
01428 polygon[54].Texture = texture[3].TexID;
01429 polygon[54].Vertex[0].u = 0.0;
01430 polygon[54].Vertex[0].v = 0.0;
01431 polygon[54].Vertex[1].u = 1.0;
01432 polygon[54].Vertex[1].v = 1.0;
01433 polygon[54].Vertex[2].u = 0.0;
01434 polygon[54].Vertex[2].v = 1.0;
01435
01436 polygon[55].Scale[0] = 3.0;
01437 polygon[55].Scale[1] = 2.0;
01438 polygon[55].Shift[0] = 0.0;
01439 polygon[55].Shift[1] = 0.0;
01440 polygon[55].Rotate = 0.0;
01441 polygon[55].Vertex[0] = vertex[35];
01442 polygon[55].Vertex[1] = vertex[33];
01443 polygon[55].Vertex[2] = vertex[34];
01444 polygon[55].Texture = texture[3].TexID;
01445 polygon[55].Vertex[0].u = 0.0;
01446 polygon[55].Vertex[0].v = 0.0;
01447 polygon[55].Vertex[1].u = 1.0;
01448 polygon[55].Vertex[1].v = 0.0;
01449 polygon[55].Vertex[2].u = 1.0;
01450 polygon[55].Vertex[2].v = 1.0;
01451
01452 polygon[56].Scale[0] = 4.0;
01453 polygon[56].Scale[1] = 3.0;
01454 polygon[56].Shift[0] = 0.0;
01455 polygon[56].Shift[1] = 0.0;
01456 polygon[56].Rotate = 0.0;
01457 polygon[56].Vertex[0] = vertex[32];
01458 polygon[56].Vertex[1] = vertex[34];
01459 polygon[56].Vertex[2] = vertex[33];
01460 polygon[56].Texture = texture[2].TexID;
01461 polygon[56].Vertex[0].u = 0.0;
01462 polygon[56].Vertex[0].v = 0.0;
01463 polygon[56].Vertex[1].u = 1.0;
01464 polygon[56].Vertex[1].v = 0.0;
01465 polygon[56].Vertex[2].u = 0.5;
01466 polygon[56].Vertex[2].v = 0.5;
01467
01468 polygon[57].Scale[0] = 4.0;
01469 polygon[57].Scale[1] = 3.0;
01470 polygon[57].Shift[0] = 0.0;
01471 polygon[57].Shift[1] = 0.0;
01472 polygon[57].Rotate = 0;
01473 polygon[57].Vertex[0] = vertex[19];
01474 polygon[57].Vertex[1] = vertex[20];
01475 polygon[57].Vertex[2] = vertex[36];
01476 polygon[57].Texture = texture[2].TexID;
01477 polygon[57].Vertex[0].u = 0.0;
01478 polygon[57].Vertex[0].v = 0.0;
01479 polygon[57].Vertex[1].u = 1.0;
01480 polygon[57].Vertex[1].v = 0.0;
01481 polygon[57].Vertex[2].u = 0.5;
01482 polygon[57].Vertex[2].v = 0.5;
01483
01484 for (int loop = 0; loop < numWorldPolygons; loop++)
01485 polygon[loop].SetNormal();
01486 }
01487
01488 void SetGLProperties()
01489 {
01490 glCullFace(GL_BACK);
01491 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
01492 glClearDepth(1.0);
01493 glDepthFunc(GL_LESS);
01494 glEnable(GL_DEPTH_TEST);
01495 glShadeModel(GL_SMOOTH);
01496 glEnable(GL_NORMALIZE);
01497 glEnable(GL_CULL_FACE);
01498 }
01499
01500 void SetGLProjection(int Width, int Height)
01501 {
01502 if (Height==0)
01503 Height=1;
01504 glViewport(0, 0, Width, Height);
01505 glMatrixMode(GL_PROJECTION);
01506 glLoadIdentity();
01507 gluPerspective(45.0,(float)Width/(float)Height, 0.8, 500.0);
01508 }
01509
01510 void SetGLView(int Width, int Height)
01511 {
01512 SetGLProjection(Width, Height);
01513 glMatrixMode(GL_MODELVIEW);
01514 glLoadIdentity();
01515 }
01516
01517 void SetGLMaterial()
01518 {
01519 float mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
01520 float mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
01521 float mat_specular[] = { 0.9, 0.9, 0.9, 1.0 };
01522 float mat_emission[] = { 0.0, 0.0, 0.0, 1.0 };
01523 float mat_shininess[] = { 80.0 };
01524
01525 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01526 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
01527 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01528 glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
01529 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
01530 }
01531
01532 int SetGLTexture(TEXTURE* texture)
01533 {
01534 glEnable(GL_TEXTURE_2D);
01535
01536 sprintf(texture[0].TexName, "%s", "floor.tga");
01537 if (!texture[0].LoadTGA())
01538 {
01539 MessageBox(NULL,"Failed to load floor image","Error",MB_OK|MB_ICONERROR);
01540 return FALSE;
01541 }
01542 sprintf(texture[1].TexName, "%s", "roof.tga");
01543 if (!texture[1].LoadTGA())
01544 {
01545 MessageBox(NULL,"Failed to load roof image","Error",MB_OK|MB_ICONERROR);
01546 return FALSE;
01547 }
01548 sprintf(texture[2].TexName, "%s", "wall.tga");
01549 if (!texture[2].LoadTGA())
01550 {
01551 MessageBox(NULL,"Failed to load wall image","Error",MB_OK|MB_ICONERROR);
01552 return FALSE;
01553 }
01554 sprintf(texture[3].TexName, "%s", "tile.tga");
01555 if (!texture[3].LoadTGA())
01556 {
01557 MessageBox(NULL,"Failed to load tile image","Error",MB_OK|MB_ICONERROR);
01558 return FALSE;
01559 }
01560 sprintf(texture[4].TexName, "%s", "burndecal.tga");
01561 if (!texture[4].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01562 {
01563 MessageBox(NULL,"Failed to load burn decal image","Error",MB_OK|MB_ICONERROR);
01564 return FALSE;
01565 }
01566 sprintf(texture[5].TexName, "%s", "muzzleflash.tga");
01567 if (!texture[5].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01568 {
01569 MessageBox(NULL,"Failed to load muzzle flash image","Error",MB_OK|MB_ICONERROR);
01570 return FALSE;
01571 }
01572
01573 sprintf(texture[6].TexName, "%s", "impactflash.tga");
01574 if (!texture[6].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01575 {
01576 MessageBox(NULL,"Failed to load impact flash image","Error",MB_OK|MB_ICONERROR);
01577 return FALSE;
01578 }
01579
01580 sprintf(texture[7].TexName, "%s", "bulletdecal.tga");
01581 if (!texture[7].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01582 {
01583 MessageBox(NULL,"Failed to load bullet decal image","Error",MB_OK|MB_ICONERROR);
01584 return FALSE;
01585 }
01586
01587 sprintf(texture[8].TexName, "%s", "particle1.tga");
01588 if (!texture[8].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01589 {
01590 MessageBox(NULL,"Failed to load particle1 image","Error",MB_OK|MB_ICONERROR);
01591 return FALSE;
01592 }
01593
01594 sprintf(texture[9].TexName, "%s", "particle2.tga");
01595 if (!texture[9].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01596 {
01597 MessageBox(NULL,"Failed to load particle2 image","Error",MB_OK|MB_ICONERROR);
01598 return FALSE;
01599 }
01600
01601 sprintf(texture[10].TexName, "%s", "wood_planks.tga");
01602 if (!texture[10].LoadTGA(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, GL_CLAMP, GL_CLAMP, 1))
01603 {
01604 MessageBox(NULL,"Failed to load wood_planks image","Error",MB_OK|MB_ICONERROR);
01605 return FALSE;
01606 }
01607
01608 return TRUE;
01609 }
01610
01611 void DrawMyText()
01612 {
01613 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) ;
01614 glDisable(GL_LIGHTING);
01615 glColor3f(0.0, 1.0, 0.0);
01616 glEnable(GL_BLEND);
01617 glDisable(GL_DEPTH_TEST);
01618 glPushMatrix();
01619 glLoadIdentity();
01620 glFontBegin(&myFont);
01621 char text[256];
01622
01623 glFontTextOut("Tutorial #20 (CSG)", -52, 40, -100);
01624
01625 sprintf(text, "FPS = %d", fps);
01626 glFontTextOut(text, -52, 38, -100);
01627
01628 sprintf(text, "%s", "Press M to change camera mode");
01629 glFontTextOut(text, -52, 34, -100);
01630
01631 sprintf(text, "%s", "Press C to toggle face culling");
01632 glFontTextOut(text, -52, 30, -100);
01633
01634 sprintf(text, "%s", "Press T to toggle texturing");
01635 glFontTextOut(text, -52, 26, -100);
01636
01637 sprintf(text, "%s", "Press R to reset brushes");
01638 glFontTextOut(text, -52, 22, -100);
01639
01640 sprintf(text, "%s", "Press A for CSG Addition");
01641 glFontTextOut(text, -52, 18, -100);
01642
01643 glFontEnd();
01644 glPopMatrix();
01645 glEnable(GL_DEPTH_TEST);
01646 glDisable(GL_BLEND);
01647 glEnable(GL_LIGHTING);
01648 }
01649
01650 void DrawGrid()
01651 {
01652 glDisable(GL_TEXTURE_2D);
01653 glDisable(GL_LIGHTING);
01654 glPushMatrix();
01655 glTranslatef(0,-2.0,0);
01656 glColor3f(0.0f,1.0f,0.0f);
01657
01658 float Line = -10;
01659 int Grid;
01660 glBegin(GL_LINES);
01661 for(Grid = 0; Grid <= 20; Grid += 1)
01662 {
01663 glVertex3f(Line + Grid, 0, -10);
01664 glVertex3f(Line + Grid, 0, 10);
01665 glVertex3f(-10, 0, Line + Grid);
01666 glVertex3f(10, 0, Line + Grid);
01667 }
01668 glEnd();
01669 glPopMatrix();
01670 glEnable(GL_TEXTURE_2D);
01671 glEnable(GL_LIGHTING);
01672 }
01673
01674 void DrawWorld(BSP_node* root)
01675 {
01676 float mat_ambient[] = { 0.8, 0.8, 0.8, 1.0 };
01677 float mat_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
01678 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01679 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01680
01681 glPushMatrix();
01682
01683 glDisable (GL_DEPTH_TEST);
01684 RenderBSP(root);
01685 glEnable (GL_DEPTH_TEST);
01686
01687 glPopMatrix();
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716 }
01717
01718 void DrawGreenSphere()
01719 {
01720 float mat_ambient[] = { 0.2, 1.0, 0.1, 1.0 };
01721 float mat_diffuse[] = { 0.2, 1.0, 0.1, 1.0 };
01722 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01723 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01724
01725 glPushMatrix();
01726 glLoadIdentity();
01727 glTranslatef(-2.0, -2.0, -8.0);
01728 GLUquadricObj * sphere = gluNewQuadric();
01729 gluQuadricOrientation(sphere, GLU_OUTSIDE);
01730 gluSphere(sphere,0.3,20,20);
01731 glPopMatrix();
01732
01733 }
01734
01735 void DrawSphere()
01736 {
01737 float mat_ambient[] = { 0.8, 0.5, 0.1, 1.0 };
01738 float mat_diffuse[] = { 0.8, 0.5, 0.1, 1.0 };
01739 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01740 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01741
01742 glDisable(GL_TEXTURE_2D);
01743 glPushMatrix();
01744 glTranslatef(-3.0f,-1.0f,-8.0f);
01745 GLUquadricObj * sphere = gluNewQuadric();
01746 gluQuadricOrientation(sphere, GLU_OUTSIDE);
01747 gluSphere(sphere, 1.0, 50, 50);
01748 glPopMatrix();
01749 glEnable(GL_TEXTURE_2D);
01750 }
01751
01752 void DrawCone()
01753 {
01754 float mat_ambient[] = { 0.1, 0.5, 1.0, 1.0 };
01755 float mat_diffuse[] = { 0.1, 0.5, 1.0, 1.0 };
01756 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01757 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01758
01759 glDisable(GL_TEXTURE_2D);
01760 glDisable(GL_CULL_FACE);
01761 glPushMatrix();
01762 glTranslatef(3.0f,-2.0f,-8.0f);
01763 glRotatef(-90,1,0,0);
01764 GLUquadricObj * cylinder = gluNewQuadric();
01765 gluQuadricOrientation(cylinder, GLU_OUTSIDE);
01766 gluCylinder(cylinder,1.0,0.0,2.0,20,20);
01767 glPopMatrix();
01768 glEnable(GL_CULL_FACE);
01769 glEnable(GL_TEXTURE_2D);
01770 }
01771
01772 float GetTimePassed(float& lasttime, int average, float* lastmultiplier)
01773 {
01774 float timeoffset;
01775 float currenttime;
01776
01777
01778
01779
01780 if (lasttime == 0)
01781 lasttime = (float)GetTickCount();
01782
01783 currenttime = (float)GetTickCount();
01784
01785 timeoffset = currenttime - lasttime;
01786
01787 if (timeoffset < 8.333333)
01788 {
01789 timeoffset = 8.333333;
01790 currenttime = lasttime + timeoffset;
01791 }
01792
01793 lasttime = currenttime;
01794
01795 multiplier = timeoffset / 1000;
01796 for (int loop = 0; loop < average - 1; loop++)
01797 {
01798 lastmultiplier[loop] = lastmultiplier[loop + 1];
01799 }
01800 lastmultiplier[average - 1] = multiplier;
01801 for (int loop = 0; loop < average - 1; loop++)
01802 multiplier += lastmultiplier[loop];
01803 multiplier /= (float)average;
01804 if (multiplier)
01805 fps = (int)(1.0 / multiplier);
01806 return multiplier;
01807 }
01808
01809 bool CheckClipPlanes(CAMERA Camera, VECTOR Vect)
01810 {
01811 float ProjectionMatrix[16];
01812 float ModelViewMatrix[16];
01813 float A, B, C, Distance;
01814 int Counter = 0;
01815 glGetFloatv(GL_PROJECTION_MATRIX, ProjectionMatrix);
01816 glGetFloatv(GL_MODELVIEW_MATRIX, ModelViewMatrix);
01817
01818 MultMatrix(ProjectionMatrix, ModelViewMatrix);
01819
01820
01821 A = ProjectionMatrix[0] - ProjectionMatrix[3];
01822 B = ProjectionMatrix[4] - ProjectionMatrix[7];
01823 C = ProjectionMatrix[8] - ProjectionMatrix[11];
01824
01825 Distance = -1 * (A * (-Camera.Position.x + Vect.x) + B * (-Camera.Position.y + Vect.y) + C * (-Camera.Position.z + Vect.z));
01826 if (Distance > 0)
01827 Counter++;
01828
01829
01830 A = ProjectionMatrix[0] + ProjectionMatrix[3];
01831 B = ProjectionMatrix[4] + ProjectionMatrix[7];
01832 C = ProjectionMatrix[8] + ProjectionMatrix[11];
01833
01834 Distance = A * (-Camera.Position.x + Vect.x) + B * (-Camera.Position.y + Vect.y) + C * (-Camera.Position.z + Vect.z);
01835 if (Distance > 0)
01836 Counter++;
01837
01838
01839 A = ProjectionMatrix[1] - ProjectionMatrix[3];
01840 B = ProjectionMatrix[5] - ProjectionMatrix[7];
01841 C = ProjectionMatrix[9] - ProjectionMatrix[11];
01842
01843 Distance = -1 * (A * (-Camera.Position.x + Vect.x) + B * (-Camera.Position.y + Vect.y) + C * (-Camera.Position.z + Vect.z));
01844 if (Distance > 0)
01845 Counter++;
01846
01847
01848 A = ProjectionMatrix[1] + ProjectionMatrix[3];
01849 B = ProjectionMatrix[5] + ProjectionMatrix[7];
01850 C = ProjectionMatrix[9] + ProjectionMatrix[11];
01851
01852 Distance = A * (-Camera.Position.x + Vect.x) + B * (-Camera.Position.y + Vect.y) + C * (-Camera.Position.z + Vect.z);
01853 if (Distance > 0)
01854 Counter++;
01855
01856
01857 A = ProjectionMatrix[2] - ProjectionMatrix[3];
01858 B = ProjectionMatrix[6] - ProjectionMatrix[7];
01859 C = ProjectionMatrix[10] - ProjectionMatrix[11];
01860
01861 Distance = A * (-Camera.Position.x + Vect.x) + B * (-Camera.Position.y + Vect.y) + C * (-Camera.Position.z + Vect.z);
01862 if (Distance > 0)
01863 Counter++;
01864
01865
01866 VECTOR Vect2;
01867 Vect2.x = Vect.x - Camera.Position.x;
01868 Vect2.y = Vect.y - Camera.Position.y;
01869 Vect2.z = Vect.z - Camera.Position.z;
01870 if (MagnitudeVector(Vect2) < 2000000)
01871 Counter++;
01872
01873 if (Counter == 6)
01874 return 1;
01875 else
01876 return 0;
01877 }
01878
01879
01880 void DrawHalo(TEXTURE* texture, LIGHT* light, CAMERA* camera)
01881 {
01882 float halfwidth = 2;
01883 float halfheight = 2;
01884
01885 MATRIX mat;
01886 glGetFloatv(GL_MODELVIEW_MATRIX, mat.Element);
01887
01888 VECTOR right;
01889 right.x = mat.Element[0];
01890 right.y = mat.Element[4];
01891 right.z = mat.Element[8];
01892 right.Normalize();
01893 right.x *= halfwidth;
01894 right.y *= halfwidth;
01895 right.z *= halfwidth;
01896
01897 VECTOR up;
01898 up.x = mat.Element[1];
01899 up.y = mat.Element[5];
01900 up.z = mat.Element[9];
01901 up.Normalize();
01902 up.x *= halfheight;
01903 up.y *= halfheight;
01904 up.z *= halfheight;
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919 float mat_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
01920 float mat_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
01921 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01922 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01923 glEnable(GL_BLEND);
01924 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
01925 glEnable(GL_ALPHA_TEST);
01926 glAlphaFunc(GL_GREATER, 0);
01927 glDisable(GL_LIGHTING);
01928 glColor4f(1.0, 1.0, 1.0, 1.0);
01929 glBindTexture(GL_TEXTURE_2D, texture[1].TexID);
01930 glPopMatrix();
01931 glBegin(GL_QUADS);
01932 glTexCoord2f(0.0f, 0.0f); glVertex3f(light[currentLight].Position.x + (-right.x - up.x), light[currentLight].Position.y + (-right.y - up.y), light[currentLight].Position.z + (-right.z - up.z));
01933 glTexCoord2f(1.0f, 0.0f); glVertex3f(light[currentLight].Position.x + (right.x - up.x), light[currentLight].Position.y + (right.y - up.y), light[currentLight].Position.z + (right.z - up.z));
01934 glTexCoord2f(1.0f, 1.0f); glVertex3f(light[currentLight].Position.x + (right.x + up.x), light[currentLight].Position.y + (right.y + up.y), light[currentLight].Position.z + (right.z + up.z));
01935 glTexCoord2f(0.0f, 1.0f); glVertex3f(light[currentLight].Position.x + (up.x - right.x), light[currentLight].Position.y + (up.y - right.y), light[currentLight].Position.z + (up.z - right.z));
01936 glEnd();
01937 glPopMatrix();
01938 glEnable(GL_LIGHTING);
01939 glDisable(GL_ALPHA);
01940 glDisable(GL_BLEND);
01941 }
01942
01943
01944 void DrawFire(TEXTURE* texture, LIGHT* light, CAMERA* camera)
01945 {
01946 float halfwidth = 1.0;
01947 float halfheight = 2.0;
01948 VECTOR FirePosition(3.0, -2.0 + halfheight, -8.0);
01949
01950 VECTOR A;
01951 A.x = (camera[currentCamera].Position.x - FirePosition.x);
01952 A.y = (camera[currentCamera].Position.y - FirePosition.y);
01953 A.z = (camera[currentCamera].Position.z - FirePosition.z);
01954 A.Normalize();
01955
01956 VECTOR B;
01957 B.x = (0);
01958 B.y = (1);
01959 B.z = (0);
01960 B.Normalize();
01961
01962 VECTOR C = CrossVector(A, B);
01963 C.Normalize();
01964
01965
01966 VECTOR right;
01967 right.x = -C.x * halfwidth;
01968 right.y = -C.y * halfwidth;
01969 right.z = -C.z * halfwidth;
01970
01971 VECTOR up;
01972 up.x = 0;
01973 up.y = 1 * halfheight;
01974 up.z = 0;
01975
01976
01977 float mat_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
01978 float mat_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
01979 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
01980 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
01981 glEnable(GL_BLEND);
01982 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
01983 glEnable(GL_ALPHA_TEST);
01984 glAlphaFunc(GL_GREATER, 0);
01985 glDisable(GL_LIGHTING);
01986 glColor4f(1.0, 1.0, 1.0, 1.0);
01987 glBindTexture(GL_TEXTURE_2D, texture[2].TexID);
01988 glPopMatrix();
01989 glBegin(GL_QUADS);
01990 glTexCoord2f(0.0f, 0.0f); glVertex3f(FirePosition.x + (-right.x - up.x), FirePosition.y + (-right.y - up.y), FirePosition.z + (-right.z - up.z));
01991 glTexCoord2f(1.0f, 0.0f); glVertex3f(FirePosition.x + (right.x - up.x), FirePosition.y + (right.y - up.y), FirePosition.z + (right.z - up.z));
01992 glTexCoord2f(1.0f, 1.0f); glVertex3f(FirePosition.x + (right.x + up.x), FirePosition.y + (right.y + up.y), FirePosition.z + (right.z + up.z));
01993 glTexCoord2f(0.0f, 1.0f); glVertex3f(FirePosition.x + (up.x - right.x), FirePosition.y + (up.y - right.y), FirePosition.z + (up.z - right.z));
01994 glEnd();
01995 glPopMatrix();
01996 glEnable(GL_LIGHTING);
01997 glDisable(GL_ALPHA);
01998 glDisable(GL_BLEND);
01999 }
02000
02001 void DrawBillboards(TEXTURE* texture, LIGHT* light, CAMERA* camera)
02002 {
02003 DrawHalo(texture, light, camera);
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032 }