#include "ModelManager.h" #include void InitModel(VModel * m) { m->PrimitiveType = GL_POINTS; m->NumberOfVertices = 0; m->Vertices = NULL; m->WireFrame = false; m->Color[0] = m->Color[1] = m->Color[2] = m->Color[3] = 1.0; } void CleanUpModel(VModel * m) { m->Vertices = NULL; m->NumberOfVertices = 0; } Boolean AllocateVertices(VModel * m, int numberOfVertices) { m->Vertices = (Vector *) NewPtrClear(sizeof(Vector) * numberOfVertices); if (m->Vertices == NULL) return 0; m->NumberOfVertices = numberOfVertices; return 1; } void DrawModel(VModel * m) { int wVertex; if(!m->WireFrame) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonOffset(1.0, 1.0); glColor4f(0.0, 0.0, 0.0, m->Color[3]); glBegin(m->PrimitiveType); for (wVertex = 0; wVertex < m->NumberOfVertices; wVertex++) { glVertex3f(m->Vertices[wVertex].x, m->Vertices[wVertex].y, m->Vertices[wVertex].z); } glEnd(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } glColor4f(m->Color[0], m->Color[1], m->Color[2], m->Color[3]); glBegin(m->PrimitiveType); for (wVertex = 0; wVertex < m->NumberOfVertices; wVertex++) { glVertex3f(m->Vertices[wVertex].x, m->Vertices[wVertex].y, m->Vertices[wVertex].z); } glEnd(); } void BuildCrossHairModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = 1; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 12; return; } if (AllocateVertices(m, 12)) { m->Vertices[0].x = -0.1; m->Vertices[0].y = 0.1; m->Vertices[0].z = -1.6; m->Vertices[1].x = 0.1; m->Vertices[1].y = 0.1; m->Vertices[1].z = -1.6; m->Vertices[2].x = 0.1; m->Vertices[2].y = -0.1; m->Vertices[2].z = -1.6; m->Vertices[3].x = -0.1; m->Vertices[3].y = -0.1; m->Vertices[3].z = -1.6; m->Vertices[4].x = 0.0; m->Vertices[4].y = 0.2; m->Vertices[4].z = -1.6; m->Vertices[5].x = 0.0; m->Vertices[5].y = 0.2; m->Vertices[5].z = -1.6; m->Vertices[6].x = 0.0; m->Vertices[6].y = -0.2; m->Vertices[6].z = -1.6; m->Vertices[7].x = 0.0; m->Vertices[7].y = -0.2; m->Vertices[7].z = -1.6; m->Vertices[8].x = -0.2; m->Vertices[8].y = 0.0; m->Vertices[8].z = -1.6; m->Vertices[9].x = -0.2; m->Vertices[9].y = 0.0; m->Vertices[9].z = -1.6; m->Vertices[10].x = 0.2; m->Vertices[10].y = 0.0; m->Vertices[10].z = -1.6; m->Vertices[11].x = 0.2; m->Vertices[11].y = 0.0; m->Vertices[11].z = -1.6; myVertices = m->Vertices; } } void BuildBulletModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 12; return; } if (AllocateVertices(m, 12)) { m->Vertices[0].x = -0.1; m->Vertices[0].y = 0.1; m->Vertices[0].z = 0.0; m->Vertices[1].x = -0.1; m->Vertices[1].y = -0.1; m->Vertices[1].z = 0.0; m->Vertices[2].x = 0.1; m->Vertices[2].y = -0.1; m->Vertices[2].z = 0.0; m->Vertices[3].x = 0.1; m->Vertices[3].y = 0.1; m->Vertices[3].z = 0.0; m->Vertices[4].x = 0.0; m->Vertices[4].y = 0.1; m->Vertices[4].z = -0.1; m->Vertices[5].x = 0.0; m->Vertices[5].y = -0.1; m->Vertices[5].z = -0.1; m->Vertices[6].x = 0.0; m->Vertices[6].y = -0.1; m->Vertices[6].z = 0.1; m->Vertices[7].x = 0.0; m->Vertices[7].y = 0.1; m->Vertices[7].z = 0.1; m->Vertices[8].x = -0.1; m->Vertices[8].y = 0.0; m->Vertices[8].z = -0.1; m->Vertices[9].x = -0.1; m->Vertices[9].y = 0.0; m->Vertices[9].z = 0.1; m->Vertices[10].x = 0.1; m->Vertices[10].y = 0.0; m->Vertices[10].z = 0.1; m->Vertices[11].x = 0.1; m->Vertices[11].y = 0.0; m->Vertices[11].z = -0.1; myVertices = m->Vertices; } } void BuildTargetModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 0.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 12; return; } if (AllocateVertices(m, 12)) { m->Vertices[0].x = -0.5; m->Vertices[0].y = 0.5; m->Vertices[0].z = 0.0; m->Vertices[1].x = -0.5; m->Vertices[1].y = -0.5; m->Vertices[1].z = 0.0; m->Vertices[2].x = 0.5; m->Vertices[2].y = -0.5; m->Vertices[2].z = 0.0; m->Vertices[3].x = 0.5; m->Vertices[3].y = 0.5; m->Vertices[3].z = 0.0; m->Vertices[4].x = 0.0; m->Vertices[4].y = 0.5; m->Vertices[4].z = -0.5; m->Vertices[5].x = 0.0; m->Vertices[5].y = -0.5; m->Vertices[5].z = -0.5; m->Vertices[6].x = 0.0; m->Vertices[6].y = -0.5; m->Vertices[6].z = 0.5; m->Vertices[7].x = 0.0; m->Vertices[7].y = 0.5; m->Vertices[7].z = 0.5; m->Vertices[8].x = -0.5; m->Vertices[8].y = 0.0; m->Vertices[8].z = -0.5; m->Vertices[9].x = -0.5; m->Vertices[9].y = 0.0; m->Vertices[9].z = 0.5; m->Vertices[10].x = 0.5; m->Vertices[10].y = 0.0; m->Vertices[10].z = 0.5; m->Vertices[11].x = 0.5; m->Vertices[11].y = 0.0; m->Vertices[11].z = -0.5; myVertices = m->Vertices; } } void BuildRocketModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 76; return; } if (AllocateVertices(m, 76)) { int surface; for (surface = 0; surface < 8; surface++) { m->Vertices[(surface * 4)].x = (cos(((pi * 2) / 8) * surface) / 50.0); m->Vertices[(surface * 4)].y = (sin(((pi * 2) / 8) * surface) / 50.0); m->Vertices[(surface * 4)].z = -0.2; m->Vertices[(surface * 4) + 1].x = (cos(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[(surface * 4) + 1].y = (sin(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[(surface * 4) + 1].z = -0.2; m->Vertices[(surface * 4) + 2].x = (cos(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[(surface * 4) + 2].y = (sin(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[(surface * 4) + 2].z = 0.14; m->Vertices[(surface * 4) + 3].x = (cos(((pi * 2) / 8) * surface) / 50.0); m->Vertices[(surface * 4) + 3].y = (sin(((pi * 2) / 8) * surface) / 50.0); m->Vertices[(surface * 4) + 3].z = 0.14; } for (surface = 0; surface < 3; surface++) { m->Vertices[32 + (surface * 4)].x = (cos(((pi * 2) / 3) * surface) / 50.0); m->Vertices[32 + (surface * 4)].y = (sin(((pi * 2) / 3) * surface) / 50.0); m->Vertices[32 + (surface * 4)].z = -0.10; m->Vertices[32 + (surface * 4) + 1].x = (cos(((pi * 2) / 3) * surface) / 10.0); m->Vertices[32 + (surface * 4) + 1].y = (sin(((pi * 2) / 3) * surface) / 10.0); m->Vertices[32 + (surface * 4) + 1].z = -0.15; m->Vertices[32 + (surface * 4) + 2].x = (cos(((pi * 2) / 3) * surface) / 10.0); m->Vertices[32 + (surface * 4) + 2].y = (sin(((pi * 2) / 3) * surface) / 10.0); m->Vertices[32 + (surface * 4) + 2].z = -0.25; m->Vertices[32 + (surface * 4) + 3].x = (cos(((pi * 2) / 3) * surface) / 50.0); m->Vertices[32 + (surface * 4) + 3].y = (sin(((pi * 2) / 3) * surface) / 50.0); m->Vertices[32 + (surface * 4) + 3].z = -0.2; } /* Kind of a pain to specify these triangles as quads... We need a way to switch primitive type in the middle of the vertex list, methinks. */ for (surface = 0; surface < 8; surface++) { m->Vertices[44 + (surface * 4)].x = (cos(((pi * 2) / 8) * surface) / 50.0); m->Vertices[44 + (surface * 4)].y = (sin(((pi * 2) / 8) * surface) / 50.0); m->Vertices[44 + (surface * 4)].z = 0.14; m->Vertices[44 + (surface * 4) + 1].x = (cos(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[44 + (surface * 4) + 1].y = (sin(((pi * 2) / 8) * (surface + 1)) / 50.0); m->Vertices[44 + (surface * 4) + 1].z = 0.14; m->Vertices[44 + (surface * 4) + 2].x = 0.0; m->Vertices[44 + (surface * 4) + 2].y = 0.0; m->Vertices[44 + (surface * 4) + 2].z = 0.2; m->Vertices[44 + (surface * 4) + 3] = m->Vertices[44 + (surface * 4) + 2]; } myVertices = m->Vertices; } } void BuildExplosionModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_TRIANGLES; m->WireFrame = false; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 6; return; } if (AllocateVertices(m, 6)) { /* Triangle #1 */ m->Vertices[0].x = 0.0; m->Vertices[0].y = 0.0; m->Vertices[0].z = 0.3; m->Vertices[1].x = 0.3; m->Vertices[1].y = 0.1; m->Vertices[1].z = -0.2; m->Vertices[2].x = 0.3; m->Vertices[2].y = -0.1; m->Vertices[2].z = -0.1; /* Triangle #2 */ m->Vertices[3].x = 0.0; m->Vertices[3].y = 0.0; m->Vertices[3].z = 0.4; m->Vertices[4].x = -0.3; m->Vertices[4].y = 0.1; m->Vertices[4].z = 0.1; m->Vertices[5].x = -0.3; m->Vertices[5].y = -0.1; m->Vertices[5].z = -0.2; /*m->Vertices[3].x = -0.2; m->Vertices[3].y = 0.1; m->Vertices[3].z = 0.1;*/ myVertices = m->Vertices; } } void BuildEnemyModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 20; return; } if (AllocateVertices(m, 20)) { m->Vertices[0].x = -0.5; m->Vertices[0].y = 0.5; m->Vertices[0].z = -0.5; m->Vertices[1].x = 0.5; m->Vertices[1].y = 0.5; m->Vertices[1].z = -0.5; m->Vertices[2].x = 0.5; m->Vertices[2].y = -0.5; m->Vertices[2].z = -0.5; m->Vertices[3].x = -0.5; m->Vertices[3].y = -0.5; m->Vertices[3].z = -0.5; m->Vertices[4].x = -0.5; m->Vertices[4].y = 0.5; m->Vertices[4].z = -0.5; m->Vertices[5].x = 0; m->Vertices[5].y = 0; m->Vertices[5].z = 0.5; m->Vertices[6].x = 0; m->Vertices[6].y = 0; m->Vertices[6].z = 0.5; m->Vertices[7].x = -0.5; m->Vertices[7].y = -0.5; m->Vertices[7].z = -0.5; m->Vertices[8].x = 0.5; m->Vertices[8].y = 0.5; m->Vertices[8].z = -0.5; m->Vertices[9].x = 0; m->Vertices[9].y = 0; m->Vertices[9].z = 0.5; m->Vertices[10].x = 0; m->Vertices[10].y = 0; m->Vertices[10].z = 0.5; m->Vertices[11].x = 0.5; m->Vertices[11].y = -0.5; m->Vertices[11].z = -0.5; m->Vertices[12].x = -0.5; m->Vertices[12].y = 0.5; m->Vertices[12].z = -0.5; m->Vertices[13].x = 0; m->Vertices[13].y = 0; m->Vertices[13].z = 0.5; m->Vertices[14].x = 0; m->Vertices[14].y = 0; m->Vertices[14].z = 0.5; m->Vertices[15].x = 0.5; m->Vertices[15].y = 0.5; m->Vertices[15].z = -0.5; m->Vertices[16].x = -0.5; m->Vertices[16].y = -0.5; m->Vertices[16].z = -0.5; m->Vertices[17].x = 0; m->Vertices[17].y = 0; m->Vertices[17].z = 0.5; m->Vertices[18].x = 0; m->Vertices[18].y = 0; m->Vertices[18].z = 0.5; m->Vertices[19].x = 0.5; m->Vertices[19].y = -0.5; m->Vertices[19].z = -0.5; myVertices = m->Vertices; } } void BuildGrassModel(VModel * m) { static Vector * myVertices = NULL; float xOffset, yOffset, zOffset; int wBladeX, wBladeZ; m->PrimitiveType = GL_LINES; m->WireFrame = 1; m->Color[0] = 0.0; m->Color[1] = 1.0; m->Color[2] = 0.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 12800; return; } if (AllocateVertices(m, 12800)) { for (wBladeZ = 0; wBladeZ < 73; wBladeZ++) { for (wBladeX = 0; wBladeX < 73; wBladeX++) { xOffset = (((Random() % 40) * 0.02) - 0.01); zOffset = (((Random() % 40) * 0.02) - 0.01); yOffset = (((Random() % 40) * 0.005) - 0.0002); m->Vertices[(wBladeZ * 160) + (wBladeX * 2)].x = (((wBladeX - 40) * 0.60) + xOffset); m->Vertices[(wBladeZ * 160) + (wBladeX * 2)].z = (((wBladeZ - 40) * 0.60) + zOffset); m->Vertices[(wBladeZ * 160) + (wBladeX * 2)].y = 0.0; m->Vertices[(wBladeZ * 160) + ((wBladeX * 2) + 1)].x = (((wBladeX - 40) * 0.60) + xOffset); m->Vertices[(wBladeZ * 160) + ((wBladeX * 2) + 1)].z = (((wBladeZ - 40) * 0.60) + zOffset); m->Vertices[(wBladeZ * 160) + ((wBladeX * 2) + 1)].y = (0.15 + yOffset); } } myVertices = m->Vertices; } } void BuildTrailModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_TRIANGLES; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 0.0; m->Color[2] = 0.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 12; return; } if (AllocateVertices(m, 12)) { /* Pre-computed vertices for perfect tetrahedron */ m->Vertices[0].x = 0.0; m->Vertices[0].y = 0.027974350452423097507237; m->Vertices[0].z = 0.0; m->Vertices[1].x = -0.017320506572723388949431; m->Vertices[1].y = 0.0; m->Vertices[1].z = 0.01; m->Vertices[2].x = 0.017320506572723388949431; m->Vertices[2].y = 0.0; m->Vertices[2].z = 0.01; m->Vertices[3].x = 0.0; m->Vertices[3].y = 0.027974350452423097507237; m->Vertices[3].z = 0.0; m->Vertices[4].x = 0.0; m->Vertices[4].y = 0.0; m->Vertices[4].z = -0.02; m->Vertices[5].x = -0.017320506572723388949431; m->Vertices[5].y = 0.0; m->Vertices[5].z = 0.01; m->Vertices[6].x = 0.0; m->Vertices[6].y = 0.027974350452423097507237; m->Vertices[6].z = 0.0; m->Vertices[7].x = 0.017320506572723388949431; m->Vertices[7].y = 0.0; m->Vertices[7].z = 0.01; m->Vertices[8].x = 0.0; m->Vertices[8].y = 0.0; m->Vertices[8].z = -0.02; m->Vertices[9].x = 0.0; m->Vertices[9].y = 0.0; m->Vertices[9].z = -0.02; m->Vertices[10].x = 0.017320506572723388949431; m->Vertices[10].y = 0.0; m->Vertices[10].z = 0.01; m->Vertices[11].x = -0.017320506572723388949431; m->Vertices[11].y = 0.0; m->Vertices[11].z = 0.01; myVertices = m->Vertices; } } void BuildCockpitModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = 0; m->Color[0] = 0.5; m->Color[1] = 0.2; m->Color[2] = 0.0; m->Color[3] = 0.6; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 24; return; } if (AllocateVertices(m, 24)) { m->Vertices[0].x = -1.0; m->Vertices[0].y = 2.0; m->Vertices[0].z = -1.6; m->Vertices[1].x = -0.4; m->Vertices[1].y = 0.9; m->Vertices[1].z = -1.6; m->Vertices[2].x = 0.4; m->Vertices[2].y = 0.9; m->Vertices[2].z = -1.6; m->Vertices[3].x = 1.0; m->Vertices[3].y = 2.0; m->Vertices[3].z = -1.6; m->Vertices[4].x = -2.0; m->Vertices[4].y = 2.0; m->Vertices[4].z = -1.6; m->Vertices[5].x = -2.0; m->Vertices[5].y = 0.7; m->Vertices[5].z = -1.6; m->Vertices[6].x = -0.4; m->Vertices[6].y = 0.9; m->Vertices[6].z = -1.6; m->Vertices[7].x = -1.0; m->Vertices[7].y = 2.0; m->Vertices[7].z = -1.6; m->Vertices[8].x = 1.0; m->Vertices[8].y = 2.0; m->Vertices[8].z = -1.6; m->Vertices[9].x = 0.4; m->Vertices[9].y = 0.9; m->Vertices[9].z = -1.6; m->Vertices[10].x = 2.0; m->Vertices[10].y = 0.7; m->Vertices[10].z = -1.6; m->Vertices[11].x = 2.0; m->Vertices[11].y = 2.0; m->Vertices[11].z = -1.6; m->Vertices[12].x = -1.0; m->Vertices[12].y = -0.7; m->Vertices[12].z = -1.6; m->Vertices[13].x = -0.4; m->Vertices[13].y = -2.0; m->Vertices[13].z = -1.6; m->Vertices[14].x = 0.4; m->Vertices[14].y = -2.0; m->Vertices[14].z = -1.6; m->Vertices[15].x = 1.0; m->Vertices[15].y = -0.7; m->Vertices[15].z = -1.6; m->Vertices[16].x = -2.0; m->Vertices[16].y = -0.9; m->Vertices[16].z = -1.6; m->Vertices[17].x = -2.0; m->Vertices[17].y = -2.0; m->Vertices[17].z = -1.6; m->Vertices[18].x = -0.4; m->Vertices[18].y = -2.0; m->Vertices[18].z = -1.6; m->Vertices[19].x = -1.0; m->Vertices[19].y = -0.7; m->Vertices[19].z = -1.6; m->Vertices[20].x = 1.0; m->Vertices[20].y = -0.7; m->Vertices[20].z = -1.6; m->Vertices[21].x = 0.4; m->Vertices[21].y = -2.0; m->Vertices[21].z = -1.6; m->Vertices[22].x = 2.0; m->Vertices[22].y = -2.0; m->Vertices[22].z = -1.6; m->Vertices[23].x = 2.0; m->Vertices[23].y = -0.9; m->Vertices[23].z = -1.6; myVertices = m->Vertices; } } void BuildRocketPowerupModel(VModel * m) { BuildRocketModel(m); m->Color[0] = 0.5; m->Color[1] = 0.5; m->Color[2] = 1.0; m->Color[3] = 1.0; } void BuildHealthPowerupModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 4; return; } if (AllocateVertices(m, 4)) { m->Vertices[0].x = -0.25; m->Vertices[0].y = 0.25; m->Vertices[0].z = 0.0; m->Vertices[1].x = -0.25; m->Vertices[1].y = -0.25; m->Vertices[1].z = 0.0; m->Vertices[2].x = 0.25; m->Vertices[2].y = -0.25; m->Vertices[2].z = 0.0; m->Vertices[3].x = 0.25; m->Vertices[3].y = 0.25; m->Vertices[3].z = 0.0; myVertices = m->Vertices; } } void BuildWallsModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 1.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 16; return; } if(AllocateVertices(m, 16)) { m->Vertices[0].x = -24; m->Vertices[0].y = 0; m->Vertices[0].z = 24; m->Vertices[1].x = -24; m->Vertices[1].y = 48; m->Vertices[1].z = 24; m->Vertices[2].x = 24; m->Vertices[2].y = 48; m->Vertices[2].z = 24; m->Vertices[3].x = 24; m->Vertices[3].y = 0; m->Vertices[3].z = 24; m->Vertices[4].x = -24; m->Vertices[4].y = 0; m->Vertices[4].z = 24; m->Vertices[5].x = -24; m->Vertices[5].y = 48; m->Vertices[5].z = 24; m->Vertices[6].x = -24; m->Vertices[6].y = 48; m->Vertices[6].z = -24; m->Vertices[7].x = -24; m->Vertices[7].y = 0; m->Vertices[7].z = -24; m->Vertices[8].x = -24; m->Vertices[8].y = 0; m->Vertices[8].z = -24; m->Vertices[9].x = -24; m->Vertices[9].y = 48; m->Vertices[9].z = -24; m->Vertices[10].x = 24; m->Vertices[10].y = 48; m->Vertices[10].z = -24; m->Vertices[11].x = 24; m->Vertices[11].y = 0; m->Vertices[11].z = -24; m->Vertices[12].x = 24; m->Vertices[12].y = 0; m->Vertices[12].z = 24; m->Vertices[13].x = 24; m->Vertices[13].y = 48; m->Vertices[13].z = 24; m->Vertices[14].x = 24; m->Vertices[14].y = 48; m->Vertices[14].z = -24; m->Vertices[15].x = 24; m->Vertices[15].y = 0; m->Vertices[15].z = -24; myVertices = m->Vertices; } } void BuildBackWallModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 1.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 4; return; } if(AllocateVertices(m, 4)) { m->Vertices[0].x = -20; m->Vertices[0].y = 0; m->Vertices[0].z = 20; m->Vertices[1].x = 20; m->Vertices[1].y = 0; m->Vertices[1].z = 20; m->Vertices[2].x = 20; m->Vertices[2].y = 40; m->Vertices[2].z = 20; m->Vertices[3].x = -20; m->Vertices[3].y = 40; m->Vertices[3].z = 20; } } void BuildFrontWallModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 1.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 4; return; } if(AllocateVertices(m, 4)) { m->Vertices[0].x = -20; m->Vertices[0].y = 0; m->Vertices[0].z = -20; m->Vertices[1].x = 20; m->Vertices[1].y = 0; m->Vertices[1].z = -20; m->Vertices[2].x = 20; m->Vertices[2].y = 40; m->Vertices[2].z = -20; m->Vertices[3].x = -20; m->Vertices[3].y = 40; m->Vertices[3].z = -20; } } void BuildLeftWallModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 1.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 4; return; } if(AllocateVertices(m, 4)) { m->Vertices[0].x = -20; m->Vertices[0].y = 0; m->Vertices[0].z = -20; m->Vertices[1].x = -20; m->Vertices[1].y = 40; m->Vertices[1].z = -20; m->Vertices[2].x = -20; m->Vertices[2].y = 40; m->Vertices[2].z = 20; m->Vertices[3].x = -20; m->Vertices[3].y = 0; m->Vertices[3].z = 20; } } void BuildRightWallModel(VModel * m) { static Vector * myVertices = NULL; m->PrimitiveType = GL_QUADS; m->WireFrame = false; m->Color[0] = 1.0; m->Color[1] = 1.0; m->Color[2] = 1.0; m->Color[3] = 1.0; if (myVertices != NULL) { m->Vertices = myVertices; m->NumberOfVertices = 4; return; } if(AllocateVertices(m, 4)) { m->Vertices[0].x = 20; m->Vertices[0].y = 0; m->Vertices[0].z = -20; m->Vertices[1].x = 20; m->Vertices[1].y = 40; m->Vertices[1].z = -20; m->Vertices[2].x = 20; m->Vertices[2].y = 40; m->Vertices[2].z = 20; m->Vertices[3].x = 20; m->Vertices[3].y = 0; m->Vertices[3].z = 20; } }