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