From 91af759d165ac4d40b4748dfedaedd1cd5331168 Mon Sep 17 00:00:00 2001 From: lorien420 Date: Wed, 19 Jul 2006 01:55:06 +0000 Subject: [PATCH] Object loading patch --- COPYRIGHT | 3 +- src/DrawBlocks.cxx | 1 - src/Game.h | 3 + src/Makefile.am | 2 +- src/OBJModel.cxx | 385 ++++++++++++ src/OBJModel.h | 56 ++ src/Primitives.cxx | 71 +++ src/Primitives.h | 92 +++ src/obj_block.cxx | 1644 ++++------------------------------------------------ 9 files changed, 732 insertions(+), 1525 deletions(-) create mode 100644 src/OBJModel.cxx create mode 100644 src/OBJModel.h create mode 100644 src/Primitives.cxx create mode 100644 src/Primitives.h rewrite src/obj_block.cxx (94%) diff --git a/COPYRIGHT b/COPYRIGHT index b7494bd..36dd25f 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,5 +1,5 @@ Crack Attack! -Copyright (C) 2000-2005 by the following: +Copyright (C) 2000-2006 by the following: If you have contributed to Crack Attack!, then you deserve to be on this list. Contact me at and I'll add you. @@ -9,3 +9,4 @@ Kevin Webb Stephan Beyer Dennis Lubert Wolfgang Klier +Bjørn Lindeijer diff --git a/src/DrawBlocks.cxx b/src/DrawBlocks.cxx index ce193a8..8b3b474 100644 --- a/src/DrawBlocks.cxx +++ b/src/DrawBlocks.cxx @@ -28,7 +28,6 @@ #include #include -// FIXME: may actually need GL/glext.h #include "glext.h" using namespace std; diff --git a/src/Game.h b/src/Game.h index db6ea30..9a6b6f7 100644 --- a/src/Game.h +++ b/src/Game.h @@ -85,6 +85,7 @@ using namespace std; # define GC_BINARY_LOCATION BINARY_DIRECTORY GC_DD GC_BINARY #else # define GC_DATA_DIRECTORY(x) ".." GC_DD "data" GC_DD x +# define GC_MODEL_DIRECTORY(x) GC_DATA_DIRECTORY("models" GC_DD x) # define GC_LOCAL_DATA_DIRECTORY ".." GC_DD "localdata" GC_DD # define GC_BINARY_LOCATION GC_BINARY #endif @@ -93,7 +94,9 @@ using namespace std; # undef GC_BINARY_LOCATION # include "prefix.h" # define GC_DATA_DIRECTORY_INTER br_strcat(DATADIR, GC_DD GC_BINARY GC_DD) +# define GC_MODEL_DIRECTORY_INTER br_strcat(DATADIR, GC_DATA_DIRECTORY_INTER GC_DD "models" GC_DD) # define GC_DATA_DIRECTORY(x) br_strcat(GC_DATA_DIRECTORY_INTER, x) +# define GC_MODEL_DIRECTORY(x) br_strcat(GC_MODEL_DIRECTORY_INTER, x) # define GC_BINARY_LOCATION br_strcat(BINDIR, GC_DD GC_BINARY) #endif #define GC_GARBAGE_TEX_FILE_NAME_BASE "garbage_flavor" diff --git a/src/Makefile.am b/src/Makefile.am index 9b5d014..f340b98 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ audio_sources = Music.cxx Sound.cxx else audio_sources = endif -crack_attack_SOURCES = ActionRecorder.cxx Attack.cxx Block.cxx BlockManager.cxx CelebrationManager.cxx Clock.cxx ComboManager.cxx ComboTabulator.cxx Communicator.cxx ComputerPlayer.cxx ComputerPlayerAI.cxx Controller.cxx CountDownManager.cxx Creep.cxx Displayer.cxx Game.cxx Garbage.cxx GarbageFlavorImage.cxx GarbageGenerator.cxx GarbageManager.cxx GarbageQueue.cxx Grid.cxx LevelLights.cxx LightManager.cxx LoseBar.cxx MessageManager.cxx MetaState.cxx Random.cxx Sine.cxx Score.cxx ScoreRecordManager.cxx Swapper.cxx SparkleManager.cxx Spring.cxx SignManager.cxx String.cxx TextureLoader.cxx WinRecord.cxx X.cxx DrawBlocks.cxx DrawGarbage.cxx DrawCandy.cxx DrawScoreRecord.cxx DrawSwapper.cxx DrawExternalCandy.cxx DrawLevelLights.cxx DrawCountDown.cxx DrawMessages.cxx DrawWinRecord.cxx obj_block.cxx obj_garbage.cxx obj_garbage_thin_middle.cxx obj_garbage_thin_cap.cxx obj_garbage_thick_corner.cxx obj_garbage_thick_edge.cxx obj_garbage_thick_middle.cxx obj_garbage_small.cxx obj_sparkle.cxx obj_sign.cxx obj_swapper.cxx obj_external_candy.cxx obj_level_lights.cxx obj_messages.cxx obj_clock.cxx obj_name.cxx obj_score_record.cxx ActionRecorder.h Attack.h Block.h BlockManager.h CelebrationManager.h Clock.h ComboManager.h ComboTabulator.h Communicator.h ComputerPlayer.h ComputerPlayerAI.h Controller.h CountDownManager.h Creep.h Displayer.h Game.h Garbage.h GarbageFlavorImage.h GarbageGenerator.h GarbageManager.h GarbageQueue.h Grid.h LevelLights.h LightManager.h LoseBar.h MessageManager.h MetaState.h Random.h Sine.h Score.h ScoreRecordManager.h Swapper.h SparkleManager.h Spring.h SignManager.h String.h TextureLoader.h WinRecord.h X.h Mode.h prefix.h prefix.c $(audio_sources) +crack_attack_SOURCES = ActionRecorder.cxx Attack.cxx Block.cxx BlockManager.cxx CelebrationManager.cxx Clock.cxx ComboManager.cxx ComboTabulator.cxx Communicator.cxx ComputerPlayer.cxx ComputerPlayerAI.cxx Controller.cxx CountDownManager.cxx Creep.cxx Displayer.cxx Game.cxx Garbage.cxx GarbageFlavorImage.cxx GarbageGenerator.cxx GarbageManager.cxx GarbageQueue.cxx Grid.cxx LevelLights.cxx LightManager.cxx LoseBar.cxx MessageManager.cxx MetaState.cxx OBJModel.cxx Primitives.cxx Random.cxx Sine.cxx Score.cxx ScoreRecordManager.cxx Swapper.cxx SparkleManager.cxx Spring.cxx SignManager.cxx String.cxx TextureLoader.cxx WinRecord.cxx X.cxx DrawBlocks.cxx DrawGarbage.cxx DrawCandy.cxx DrawScoreRecord.cxx DrawSwapper.cxx DrawExternalCandy.cxx DrawLevelLights.cxx DrawCountDown.cxx DrawMessages.cxx DrawWinRecord.cxx obj_block.cxx obj_garbage.cxx obj_garbage_thin_middle.cxx obj_garbage_thin_cap.cxx obj_garbage_thick_corner.cxx obj_garbage_thick_edge.cxx obj_garbage_thick_middle.cxx obj_garbage_small.cxx obj_sparkle.cxx obj_sign.cxx obj_swapper.cxx obj_external_candy.cxx obj_level_lights.cxx obj_messages.cxx obj_clock.cxx obj_name.cxx obj_score_record.cxx ActionRecorder.h Attack.h Block.h BlockManager.h CelebrationManager.h Clock.h ComboManager.h ComboTabulator.h Communicator.h ComputerPlayer.h ComputerPlayerAI.h Controller.h CountDownManager.h Creep.h Displayer.h Game.h Garbage.h GarbageFlavorImage.h GarbageGenerator.h GarbageManager.h GarbageQueue.h Grid.h LevelLights.h LightManager.h LoseBar.h MessageManager.h MetaState.h OBJModel.h Primitives.h Random.h Sine.h Score.h ScoreRecordManager.h Swapper.h SparkleManager.h Spring.h SignManager.h String.h TextureLoader.h WinRecord.h X.h Mode.h prefix.h prefix.c $(audio_sources) # prefix sources compiled whether we use them or not diff --git a/src/OBJModel.cxx b/src/OBJModel.cxx new file mode 100644 index 0000000..dcd7c80 --- /dev/null +++ b/src/OBJModel.cxx @@ -0,0 +1,385 @@ +/* + * Copyright (C) 2006 Bjørn Lindeijer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: OBJModel.cxx,v 1.1 2006/07/19 01:56:21 lorien420 Exp $ + */ + +#include +#include +#include +#include + +#include "OBJModel.h" + +using namespace std; + +static void stripNewline(char *str) +{ + // Remove newline from the string (either \r,\n or \r\n) + int len = strlen(str); + if (str[len - 2] == '\r') str[len - 2] = '\0'; + else str[len - 1] = '\0'; +} + +static string stripFilename(const string& path) +{ + // Strip the filename portion from the given path + int pos = path.rfind("/"); + return path.substr(0, pos + 1); +} + +static GLuint loadImage(const string& filename) +{ + if (true) { + cerr << "Error loading image " << filename << std::endl; + return 0; + } else { + GLuint tid; + + glGenTextures(1, &tid); + glBindTexture(GL_TEXTURE_2D, tid); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + return tid; + } +} + +OBJModel::OBJModel(const string &filename) +{ + load(filename); +} + +OBJModel::~OBJModel() +{ + // FIXME: Delete created materials +} + + +void OBJModel::render() +{ + // TODO: Could be optimized by using vertex arrays + + vector::iterator fi; + vector::iterator vi; + int v, vt, vn, vc; + Material *activeMaterial = 0; + + // Draw all faces + for (fi = faces.begin(); fi != faces.end(); fi++) { + // Check if we need to set new material properties + if (fi->material && fi->material != activeMaterial) { + glMaterialf(GL_FRONT,GL_SHININESS,fi->material->shininess); + glMaterialfv(GL_FRONT,GL_AMBIENT,fi->material->ambient); + glMaterialfv(GL_FRONT,GL_DIFFUSE,fi->material->diffuse); + glMaterialfv(GL_FRONT,GL_SPECULAR,fi->material->specular); + if (fi->material->textureId > 0) { + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, fi->material->textureId); + } + else { + glDisable(GL_TEXTURE_2D); + } + activeMaterial = fi->material; + } + glBegin(GL_POLYGON); + for (vi = fi->vertices.begin(); vi != fi->vertices.end(); vi++) { + v = vi->v - 1; + vt = vi->vt - 1; + vn = vi->vn - 1; + vc = vi->vc - 1; + + if (vt >= 0) { + glTexCoord3f( + vertexTextures[vt].u, + vertexTextures[vt].v, + vertexTextures[vt].w); + } + if (vc >= 0) { + glColor3f( + vertexColors[vc].r, + vertexColors[vc].g, + vertexColors[vc].b); + } + + glNormal3f( + vertexNormals[vn].i, + vertexNormals[vn].j, + vertexNormals[vn].k); + + glVertex4f( + vertices[v].x, + vertices[v].y, + vertices[v].z, + vertices[v].w); + } + glEnd(); + } + + //SGNode::render(); +} + + +void OBJModel::load(const string &filename) +{ + vertices.clear(); + vertexTextures.clear(); + vertexNormals.clear(); + vertexColors.clear(); + faces.clear(); + + FILE* file = fopen(filename.c_str(), "r"); + char str[256]; + + if (!file) { + cerr << "Error while opening " << filename << "!\n"; + return; + } + + // By default no material is used + Material *activeMaterial = 0; + + while (!feof(file)) { + str[0] = '\0'; + fgets(str, 256, file); + + switch (str[0]) { + case 'v': + switch (str[1]) { + case ' ': // Plain vertex ("v x y z w") + { + Vertex v; + sscanf(str, "v %f %f %f %f", + &(v.x), &(v.y), &(v.z), &(v.w)); + vertices.push_back(v); + //cout << "vt " << (v.x * 0.5) << " " << (v.y * 0.5) << " " << (v.z * 0.5) << endl; + } + break; + case 't': // Texture vertex ("vt u v w") + { + VertexTexture vt; + sscanf(str, "vt %f %f %f", &(vt.u), &(vt.v), &(vt.w)); + vertexTextures.push_back(vt); + } + break; + case 'n': // Vertex Normal ("vn i j k") + { + VertexNormal vn; + sscanf(str, "vn %f %f %f", &(vn.i), &(vn.j), &(vn.k)); + vertexNormals.push_back(vn); + } + break; + case 'c': // Vertex Color ("vc r g b a") - not standard OBJ + { + VertexColor vc; + sscanf(str, "vc %f %f %f %f", + &(vc.r), &(vc.g), &(vc.b), &(vc.a)); + vertexColors.push_back(vc); + } + break; + default: break; + } + break; + case 'f': // Face ("f v/vt/vn v/vt/vn v/vt/vn") + { + char* vstr; + char texlessfaces; + Face f; + f.material = activeMaterial; + + vstr = strtok(&str[2], " "); // skip "f " + for (; vstr; vstr = strtok(NULL," ")) { + FaceVertex fv; + + // Check if a//c or a/b/c + sscanf(vstr,"%*d%*c%c", &texlessfaces); + if (texlessfaces != '/') { + sscanf(vstr, "%d/%d/%d", &(fv.v), &(fv.vt), &(fv.vn)); + } else { + sscanf(vstr, "%d//%d", &(fv.v), &(fv.vn)); + } + + f.vertices.push_back(fv); + } + + // Add the face to the object if there are at least 3 vertices + if (f.vertices.size() >= 3) { + faces.push_back(f); + //cout << "f"; + //vector::iterator vi; + //for (vi = f.vertices.begin(); vi != f.vertices.end(); vi++) { + // cout << " " << vi->v << "/" << vi->v << "/" << vi->vn; + //} + //cout << endl; + } + } + break; + case 'o': // Object name ("o name") + { + stripNewline(str); + name = string(&str[2]); + } + break; + case 'u': // ("usemtl name") + if (strncmp(str, "usemtl ", 7) == 0) { + stripNewline(str); + string matName = string(&str[7]); + if (materials.count(matName) > 0) { + activeMaterial = materials[matName]; + } + } + break; + case 'm': // ("mtllib file1 file2 ...") + if (strncmp(str, "mtllib ", 7) == 0) { + // Read material libraries + string path = stripFilename(filename); + char* vstr; + + vstr = strtok(&str[7], " \r\n"); // skip "mtllib " + for (; vstr; vstr = strtok(NULL," \r\n")) { + loadMTL(path + string(vstr)); + } + } + break; + case 's': // ("shadow_obj file") + if (strncmp(str, "shadow_obj ", 11) == 0) { + stripNewline(str); + shadowObj = string(&str[11]); + } + break; + default: + // Nothing recognized, ignore. + break; + } + } + + cout << "Loaded model " << name << " (" << faces.size() << " faces)\n"; +} + + +void OBJModel::loadMTL(const string &filename) +{ + FILE* file = fopen(filename.c_str(), "r"); + if (!file) { + cerr << "Error while opening " << filename << "!\n"; + return; + } + + char str[256]; + Material* mat = 0; + + while (!feof(file)) { + str[0] = '\0'; + fgets(str, 256, file); + + switch (str[0]) { + case 'n': // ("newmtl name") + if (strncmp(str, "newmtl ", 7) == 0) { + // TODO: Check if same name already exists + stripNewline(str); + string matName = string(&str[7]); + if (materials.count(matName) == 0) { + mat = new Material(); + mat->name = matName; + materials[matName] = mat; + } else { + mat = materials[matName]; + } + } + } + + if (!mat) continue; + + switch (str[0]) { + case 'K': + switch (str[1]) { + case 'a': // ("Ka r g b") + // Ambient + sscanf(str, "Ka %f %f %f", + &mat->ambient[0], &mat->ambient[1], &mat->ambient[2]); + break; + case 'd': // ("Kd r g b") + // Diffuse + sscanf(str, "Kd %f %f %f", + &mat->diffuse[0], &mat->diffuse[1], &mat->diffuse[2]); + break; + case 's': // ("Ks r g b") + // Specular + sscanf(str, "Ks %f %f %f", + &mat->specular[0],&mat->specular[1],&mat->specular[2]); + break; + default: break; + } + case 'i': // ("illum i") + // Illumination model (0, 1 or 2) + if (strncmp(str, "illum ", 6)) { + sscanf(str, "illum %d", &mat->illuminationModel); + } + else if (strncmp(str, "d ", 2)) { + sscanf(str, "d %d", &mat->illuminationModel); + } + break; + case 'T': + if (str[1] == 'r') { + // ("Tr transparency") + sscanf(str, "Tr %f", &mat->transparency); + } + mat->ambient[3] = mat->transparency; + mat->specular[3] = mat->transparency; + mat->diffuse[3] = mat->transparency; + break; + case 'd': // ("d transparency") + sscanf(str, "d %f", &mat->transparency); + mat->ambient[3] = mat->transparency; + mat->specular[3] = mat->transparency; + mat->diffuse[3] = mat->transparency; + break; + case 'N': + if (str[1] == 's') { + // ("Ns shininess") + sscanf(str, "Ns %f", &mat->shininess); + } + break; + case 'm': + if (strncmp(str, "map_K", 5) == 0) { + switch (str[5]) { + case 'd': // ("map_Kd filename") - Diffuse map + { + stripNewline(&str[7]); + string imageFile = + stripFilename(filename) + string(&str[7]); + mat->textureId = loadImage(imageFile); + break; + } + case 'a': // ("map_Ka filename") - Ambient map + break; + case 's': // ("map_Ks filename") - Specular map + break; + } + } + else if (strncmp(str, "map_Bump ", 9) == 0) { + // ("map_Bump filename") - Bump map + } + else if (strncmp(str, "map_d ", 6) == 0) { + // ("map_d filename") - Opacity map + } + break; + default: + // Nothing recognized, ignore. + break; + } + } +} diff --git a/src/OBJModel.h b/src/OBJModel.h new file mode 100644 index 0000000..0ee58e2 --- /dev/null +++ b/src/OBJModel.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2006 Bjørn Lindeijer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: OBJModel.h,v 1.1 2006/07/19 01:56:21 lorien420 Exp $ + */ + +#ifndef OBJMODEL_H +#define OBJMODEL_H + +#include +#include +#include +#include "Primitives.h" + +/** + * A class for loading and rendering OBJ files. + */ +class OBJModel +{ + public: + OBJModel() { }; + OBJModel(const std::string& filename); + virtual ~OBJModel(); + + virtual void render(); + virtual void load(const std::string& filename); + + private: + virtual void loadMTL(const std::string& filename); + + std::string name; + std::string shadowObj; + std::vector vertices; + std::vector vertexTextures; + std::vector vertexNormals; + std::vector vertexColors; + std::vector faces; + std::map materials; +}; + + +#endif diff --git a/src/Primitives.cxx b/src/Primitives.cxx new file mode 100644 index 0000000..7a01edc --- /dev/null +++ b/src/Primitives.cxx @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2006 Bjørn Lindeijer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: Primitives.cxx,v 1.1 2006/07/19 01:56:21 lorien420 Exp $ + */ + +#include "Primitives.h" + + +Vector::Vector() +{ + x = y = z = 0.0f; +} + +Vertex::Vertex() +{ + x = y = z = 0.0f; + w = 1.0f; +} + +VertexTexture::VertexTexture() +{ + u = v = w = 0.0f; +} + +VertexNormal::VertexNormal() +{ + i = j = k = 0.0f; +} + +VertexColor::VertexColor() +{ + r = g = b = a = 1.0f; +} + +Material::Material() +{ + name = "untitled"; + int i; + for (i = 0; i < 3; i++) { + ambient[i] = 0.2f; + specular[i] = 0.0f; + diffuse[i] = 0.8f; + } + ambient[3] = 1.0f; + specular[3] = 1.0f; + diffuse[3] = 1.0f; + illuminationModel = 1; + transparency = 0.0f; + shininess = 0.0f; + textureId = 0; +} + +FaceVertex::FaceVertex() +{ + v = vn = vt = vc = -1; +} diff --git a/src/Primitives.h b/src/Primitives.h new file mode 100644 index 0000000..418bc6e --- /dev/null +++ b/src/Primitives.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2006 Bjørn Lindeijer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: Primitives.h,v 1.1 2006/07/19 01:56:21 lorien420 Exp $ + */ + +#ifndef PRIMITIVES_H +#define PRIMITIVES_H + +#include +#include +#include + +enum Direction { + None, + Left, + Right, + Up, + Down +}; + +struct Vector +{ + Vector(); + float x, y, z; +}; + +struct Vertex +{ + Vertex(); + float x, y, z, w; +}; + +struct VertexTexture +{ + VertexTexture(); + float u, v, w; +}; + +struct VertexNormal +{ + VertexNormal(); + float i, j, k; +}; + +struct VertexColor +{ + VertexColor(); + float r, g, b, a; +}; + +struct FaceVertex +{ + FaceVertex(); + int v, vn, vt, vc; +}; + +struct Material +{ + Material(); + float ambient[4]; + float specular[4]; + float diffuse[4]; + std::string name; + float transparency; + int illuminationModel; + float shininess; + GLuint textureId; +}; + +struct Face +{ + std::vector vertices; + Material *material; +}; + + +#endif diff --git a/src/obj_block.cxx b/src/obj_block.cxx dissimilarity index 94% index 023c6d9..4e55d32 100644 --- a/src/obj_block.cxx +++ b/src/obj_block.cxx @@ -1,1522 +1,122 @@ -/* - * block.cxx - * Daniel Nelson - 8/31/0 - * - * Copyright (C) 2000 Daniel Nelson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Daniel Nelson - aluminumangel.org - * 174 W. 18th Ave. - * Columbus, OH 43210 - * - * OpenGL code generated by AC3D plug-in - * Created by Wade Lutgen October 1999 - * - * Generates the block's two display lists. - */ - -#include - -#include "glext.h" - -#include - -using namespace std; - -#include "Game.h" -#include "Displayer.h" - -GLuint Displayer::block_list; -GLuint Displayer::small_block_list; -GLuint Displayer::special_block_list; - -GLuint Displayer::special_block_lightmap; - -void Displayer::generateBlockDisplayList ( ) -{ - glEnableClientState(GL_VERTEX_ARRAY); - if (!(MetaState::mode & CM_REALLY_LOW_GRAPHICS)) - glEnableClientState(GL_NORMAL_ARRAY); - - block_list = glGenLists(1); - glNewList(block_list, GL_COMPILE); - - GLfloat vertices_high[1512] = - { - -0.774253, -0.707686, -0.903997, - -0.774253, 0.707686, -0.903997, - -0.111631, 0.000000, -0.986824, - -0.800000, -0.800000, -0.800000, - -0.800000, 0.800000, -0.800000, - -0.774253, 0.707686, -0.903997, - -0.800000, -0.800000, -0.800000, - -0.774253, 0.707686, -0.903997, - -0.774253, -0.707686, -0.903997, - -0.800000, 0.800000, -0.800000, - 0.000000, 0.000000, -0.900000, - -0.111631, 0.000000, -0.986824, - -0.800000, 0.800000, -0.800000, - -0.111631, 0.000000, -0.986824, - -0.774253, 0.707686, -0.903997, - 0.000000, 0.000000, -0.900000, - -0.800000, -0.800000, -0.800000, - -0.774253, -0.707686, -0.903997, - 0.000000, 0.000000, -0.900000, - -0.774253, -0.707686, -0.903997, - -0.111631, 0.000000, -0.986824, - -0.707686, 0.774253, -0.903997, - 0.707686, 0.774253, -0.903997, - 0.000000, 0.111631, -0.986824, - -0.800000, 0.800000, -0.800000, - 0.800000, 0.800000, -0.800000, - 0.707686, 0.774253, -0.903997, - -0.800000, 0.800000, -0.800000, - 0.707686, 0.774253, -0.903997, - -0.707686, 0.774253, -0.903997, - 0.800000, 0.800000, -0.800000, - 0.000000, 0.000000, -0.900000, - 0.000000, 0.111631, -0.986824, - 0.800000, 0.800000, -0.800000, - 0.000000, 0.111631, -0.986824, - 0.707686, 0.774253, -0.903997, - 0.000000, 0.000000, -0.900000, - -0.800000, 0.800000, -0.800000, - -0.707686, 0.774253, -0.903997, - 0.000000, 0.000000, -0.900000, - -0.707686, 0.774253, -0.903997, - 0.000000, 0.111631, -0.986824, - 0.774253, 0.707686, -0.903997, - 0.774253, -0.707686, -0.903997, - 0.111631, 0.000000, -0.986824, - 0.800000, 0.800000, -0.800000, - 0.800000, -0.800000, -0.800000, - 0.774253, -0.707686, -0.903997, - 0.800000, 0.800000, -0.800000, - 0.774253, -0.707686, -0.903997, - 0.774253, 0.707686, -0.903997, - 0.800000, -0.800000, -0.800000, - 0.000000, 0.000000, -0.900000, - 0.111631, 0.000000, -0.986824, - 0.800000, -0.800000, -0.800000, - 0.111631, 0.000000, -0.986824, - 0.774253, -0.707686, -0.903997, - 0.000000, 0.000000, -0.900000, - 0.800000, 0.800000, -0.800000, - 0.774253, 0.707686, -0.903997, - 0.000000, 0.000000, -0.900000, - 0.774253, 0.707686, -0.903997, - 0.111631, 0.000000, -0.986824, - 0.707686, -0.774253, -0.903997, - -0.707686, -0.774253, -0.903997, - 0.000000, -0.111631, -0.986824, - 0.800000, -0.800000, -0.800000, - -0.800000, -0.800000, -0.800000, - -0.707686, -0.774253, -0.903997, - 0.800000, -0.800000, -0.800000, - -0.707686, -0.774253, -0.903997, - 0.707686, -0.774253, -0.903997, - -0.800000, -0.800000, -0.800000, - 0.000000, 0.000000, -0.900000, - 0.000000, -0.111631, -0.986824, - -0.800000, -0.800000, -0.800000, - 0.000000, -0.111631, -0.986824, - -0.707686, -0.774253, -0.903997, - 0.000000, 0.000000, -0.900000, - 0.800000, -0.800000, -0.800000, - 0.707686, -0.774253, -0.903997, - 0.000000, 0.000000, -0.900000, - 0.707686, -0.774253, -0.903997, - 0.000000, -0.111631, -0.986824, - 0.903997, 0.707686, 0.774253, - 0.903997, -0.707686, 0.774253, - 0.986824, 0.000000, 0.111631, - 0.800000, 0.800000, 0.800000, - 0.800000, -0.800000, 0.800000, - 0.903997, -0.707686, 0.774253, - 0.800000, 0.800000, 0.800000, - 0.903997, -0.707686, 0.774253, - 0.903997, 0.707686, 0.774253, - 0.800000, -0.800000, 0.800000, - 0.900000, 0.000000, 0.000000, - 0.986824, 0.000000, 0.111631, - 0.800000, -0.800000, 0.800000, - 0.986824, 0.000000, 0.111631, - 0.903997, -0.707686, 0.774253, - 0.900000, 0.000000, 0.000000, - 0.800000, 0.800000, 0.800000, - 0.903997, 0.707686, 0.774253, - 0.900000, 0.000000, 0.000000, - 0.903997, 0.707686, 0.774253, - 0.986824, 0.000000, 0.111631, - 0.903997, -0.774253, 0.707686, - 0.903997, -0.774253, -0.707686, - 0.986824, -0.111631, 0.000000, - 0.800000, -0.800000, 0.800000, - 0.800000, -0.800000, -0.800000, - 0.903997, -0.774253, -0.707686, - 0.800000, -0.800000, 0.800000, - 0.903997, -0.774253, -0.707686, - 0.903997, -0.774253, 0.707686, - 0.800000, -0.800000, -0.800000, - 0.900000, 0.000000, 0.000000, - 0.986824, -0.111631, 0.000000, - 0.800000, -0.800000, -0.800000, - 0.986824, -0.111631, 0.000000, - 0.903997, -0.774253, -0.707686, - 0.900000, 0.000000, 0.000000, - 0.800000, -0.800000, 0.800000, - 0.903997, -0.774253, 0.707686, - 0.900000, 0.000000, 0.000000, - 0.903997, -0.774253, 0.707686, - 0.986824, -0.111631, 0.000000, - 0.903997, -0.707686, -0.774253, - 0.903997, 0.707686, -0.774253, - 0.986824, 0.000000, -0.111631, - 0.800000, -0.800000, -0.800000, - 0.800000, 0.800000, -0.800000, - 0.903997, 0.707686, -0.774253, - 0.800000, -0.800000, -0.800000, - 0.903997, 0.707686, -0.774253, - 0.903997, -0.707686, -0.774253, - 0.800000, 0.800000, -0.800000, - 0.900000, 0.000000, 0.000000, - 0.986824, 0.000000, -0.111631, - 0.800000, 0.800000, -0.800000, - 0.986824, 0.000000, -0.111631, - 0.903997, 0.707686, -0.774253, - 0.900000, 0.000000, 0.000000, - 0.800000, -0.800000, -0.800000, - 0.903997, -0.707686, -0.774253, - 0.900000, 0.000000, 0.000000, - 0.903997, -0.707686, -0.774253, - 0.986824, 0.000000, -0.111631, - 0.903997, 0.774253, -0.707686, - 0.903997, 0.774253, 0.707686, - 0.986824, 0.111631, 0.000000, - 0.800000, 0.800000, -0.800000, - 0.800000, 0.800000, 0.800000, - 0.903997, 0.774253, 0.707686, - 0.800000, 0.800000, -0.800000, - 0.903997, 0.774253, 0.707686, - 0.903997, 0.774253, -0.707686, - 0.800000, 0.800000, 0.800000, - 0.900000, 0.000000, 0.000000, - 0.986824, 0.111631, 0.000000, - 0.800000, 0.800000, 0.800000, - 0.986824, 0.111631, 0.000000, - 0.903997, 0.774253, 0.707686, - 0.900000, 0.000000, 0.000000, - 0.800000, 0.800000, -0.800000, - 0.903997, 0.774253, -0.707686, - 0.900000, 0.000000, 0.000000, - 0.903997, 0.774253, -0.707686, - 0.986824, 0.111631, 0.000000, - 0.774253, -0.707686, 0.903997, - 0.774253, 0.707686, 0.903997, - 0.111631, 0.000000, 0.986824, - 0.800000, -0.800000, 0.800000, - 0.800000, 0.800000, 0.800000, - 0.774253, 0.707686, 0.903997, - 0.800000, -0.800000, 0.800000, - 0.774253, 0.707686, 0.903997, - 0.774253, -0.707686, 0.903997, - 0.800000, 0.800000, 0.800000, - 0.000000, 0.000000, 0.900000, - 0.111631, 0.000000, 0.986824, - 0.800000, 0.800000, 0.800000, - 0.111631, 0.000000, 0.986824, - 0.774253, 0.707686, 0.903997, - 0.000000, 0.000000, 0.900000, - 0.800000, -0.800000, 0.800000, - 0.774253, -0.707686, 0.903997, - 0.000000, 0.000000, 0.900000, - 0.774253, -0.707686, 0.903997, - 0.111631, 0.000000, 0.986824, - 0.707686, 0.774253, 0.903997, - -0.707686, 0.774253, 0.903997, - 0.000000, 0.111631, 0.986824, - 0.800000, 0.800000, 0.800000, - -0.800000, 0.800000, 0.800000, - -0.707686, 0.774253, 0.903997, - 0.800000, 0.800000, 0.800000, - -0.707686, 0.774253, 0.903997, - 0.707686, 0.774253, 0.903997, - -0.800000, 0.800000, 0.800000, - 0.000000, 0.000000, 0.900000, - 0.000000, 0.111631, 0.986824, - -0.800000, 0.800000, 0.800000, - 0.000000, 0.111631, 0.986824, - -0.707686, 0.774253, 0.903997, - 0.000000, 0.000000, 0.900000, - 0.800000, 0.800000, 0.800000, - 0.707686, 0.774253, 0.903997, - 0.000000, 0.000000, 0.900000, - 0.707686, 0.774253, 0.903997, - 0.000000, 0.111631, 0.986824, - -0.774253, 0.707686, 0.903997, - -0.774253, -0.707686, 0.903997, - -0.111631, 0.000000, 0.986824, - -0.800000, 0.800000, 0.800000, - -0.800000, -0.800000, 0.800000, - -0.774253, -0.707686, 0.903997, - -0.800000, 0.800000, 0.800000, - -0.774253, -0.707686, 0.903997, - -0.774253, 0.707686, 0.903997, - -0.800000, -0.800000, 0.800000, - 0.000000, 0.000000, 0.900000, - -0.111631, 0.000000, 0.986824, - -0.800000, -0.800000, 0.800000, - -0.111631, 0.000000, 0.986824, - -0.774253, -0.707686, 0.903997, - 0.000000, 0.000000, 0.900000, - -0.800000, 0.800000, 0.800000, - -0.774253, 0.707686, 0.903997, - 0.000000, 0.000000, 0.900000, - -0.774253, 0.707686, 0.903997, - -0.111631, 0.000000, 0.986824, - -0.707686, -0.774253, 0.903997, - 0.707686, -0.774253, 0.903997, - 0.000000, -0.111631, 0.986824, - -0.800000, -0.800000, 0.800000, - 0.800000, -0.800000, 0.800000, - 0.707686, -0.774253, 0.903997, - -0.800000, -0.800000, 0.800000, - 0.707686, -0.774253, 0.903997, - -0.707686, -0.774253, 0.903997, - 0.800000, -0.800000, 0.800000, - 0.000000, 0.000000, 0.900000, - 0.000000, -0.111631, 0.986824, - 0.800000, -0.800000, 0.800000, - 0.000000, -0.111631, 0.986824, - 0.707686, -0.774253, 0.903997, - 0.000000, 0.000000, 0.900000, - -0.800000, -0.800000, 0.800000, - -0.707686, -0.774253, 0.903997, - 0.000000, 0.000000, 0.900000, - -0.707686, -0.774253, 0.903997, - 0.000000, -0.111631, 0.986824, - -0.903997, -0.707686, 0.774253, - -0.903997, 0.707686, 0.774253, - -0.986824, 0.000000, 0.111631, - -0.800000, -0.800000, 0.800000, - -0.800000, 0.800000, 0.800000, - -0.903997, 0.707686, 0.774253, - -0.800000, -0.800000, 0.800000, - -0.903997, 0.707686, 0.774253, - -0.903997, -0.707686, 0.774253, - -0.800000, 0.800000, 0.800000, - -0.900000, 0.000000, 0.000000, - -0.986824, 0.000000, 0.111631, - -0.800000, 0.800000, 0.800000, - -0.986824, 0.000000, 0.111631, - -0.903997, 0.707686, 0.774253, - -0.900000, 0.000000, 0.000000, - -0.800000, -0.800000, 0.800000, - -0.903997, -0.707686, 0.774253, - -0.900000, 0.000000, 0.000000, - -0.903997, -0.707686, 0.774253, - -0.986824, 0.000000, 0.111631, - -0.903997, 0.774253, 0.707686, - -0.903997, 0.774253, -0.707686, - -0.986824, 0.111631, 0.000000, - -0.800000, 0.800000, 0.800000, - -0.800000, 0.800000, -0.800000, - -0.903997, 0.774253, -0.707686, - -0.800000, 0.800000, 0.800000, - -0.903997, 0.774253, -0.707686, - -0.903997, 0.774253, 0.707686, - -0.800000, 0.800000, -0.800000, - -0.900000, 0.000000, 0.000000, - -0.986824, 0.111631, 0.000000, - -0.800000, 0.800000, -0.800000, - -0.986824, 0.111631, 0.000000, - -0.903997, 0.774253, -0.707686, - -0.900000, 0.000000, 0.000000, - -0.800000, 0.800000, 0.800000, - -0.903997, 0.774253, 0.707686, - -0.900000, 0.000000, 0.000000, - -0.903997, 0.774253, 0.707686, - -0.986824, 0.111631, 0.000000, - -0.903997, 0.707686, -0.774253, - -0.903997, -0.707686, -0.774253, - -0.986824, 0.000000, -0.111631, - -0.800000, 0.800000, -0.800000, - -0.800000, -0.800000, -0.800000, - -0.903997, -0.707686, -0.774253, - -0.800000, 0.800000, -0.800000, - -0.903997, -0.707686, -0.774253, - -0.903997, 0.707686, -0.774253, - -0.800000, -0.800000, -0.800000, - -0.900000, 0.000000, 0.000000, - -0.986824, 0.000000, -0.111631, - -0.800000, -0.800000, -0.800000, - -0.986824, 0.000000, -0.111631, - -0.903997, -0.707686, -0.774253, - -0.900000, 0.000000, 0.000000, - -0.800000, 0.800000, -0.800000, - -0.903997, 0.707686, -0.774253, - -0.900000, 0.000000, 0.000000, - -0.903997, 0.707686, -0.774253, - -0.986824, 0.000000, -0.111631, - -0.903997, -0.774253, -0.707686, - -0.903997, -0.774253, 0.707686, - -0.986824, -0.111631, 0.000000, - -0.800000, -0.800000, -0.800000, - -0.800000, -0.800000, 0.800000, - -0.903997, -0.774253, 0.707686, - -0.800000, -0.800000, -0.800000, - -0.903997, -0.774253, 0.707686, - -0.903997, -0.774253, -0.707686, - -0.800000, -0.800000, 0.800000, - -0.900000, 0.000000, 0.000000, - -0.986824, -0.111631, 0.000000, - -0.800000, -0.800000, 0.800000, - -0.986824, -0.111631, 0.000000, - -0.903997, -0.774253, 0.707686, - -0.900000, 0.000000, 0.000000, - -0.800000, -0.800000, -0.800000, - -0.903997, -0.774253, -0.707686, - -0.900000, 0.000000, 0.000000, - -0.903997, -0.774253, -0.707686, - -0.986824, -0.111631, 0.000000, - -0.774253, 0.903997, -0.707686, - -0.774253, 0.903997, 0.707686, - -0.111631, 0.986824, 0.000000, - -0.800000, 0.800000, -0.800000, - -0.800000, 0.800000, 0.800000, - -0.774253, 0.903997, 0.707686, - -0.800000, 0.800000, -0.800000, - -0.774253, 0.903997, 0.707686, - -0.774253, 0.903997, -0.707686, - -0.800000, 0.800000, 0.800000, - 0.000000, 0.900000, 0.000000, - -0.111631, 0.986824, 0.000000, - -0.800000, 0.800000, 0.800000, - -0.111631, 0.986824, 0.000000, - -0.774253, 0.903997, 0.707686, - 0.000000, 0.900000, 0.000000, - -0.800000, 0.800000, -0.800000, - -0.774253, 0.903997, -0.707686, - 0.000000, 0.900000, 0.000000, - -0.774253, 0.903997, -0.707686, - -0.111631, 0.986824, 0.000000, - -0.707686, 0.903997, 0.774253, - 0.707686, 0.903997, 0.774253, - 0.000000, 0.986824, 0.111631, - -0.800000, 0.800000, 0.800000, - 0.800000, 0.800000, 0.800000, - 0.707686, 0.903997, 0.774253, - -0.800000, 0.800000, 0.800000, - 0.707686, 0.903997, 0.774253, - -0.707686, 0.903997, 0.774253, - 0.800000, 0.800000, 0.800000, - 0.000000, 0.900000, 0.000000, - 0.000000, 0.986824, 0.111631, - 0.800000, 0.800000, 0.800000, - 0.000000, 0.986824, 0.111631, - 0.707686, 0.903997, 0.774253, - 0.000000, 0.900000, 0.000000, - -0.800000, 0.800000, 0.800000, - -0.707686, 0.903997, 0.774253, - 0.000000, 0.900000, 0.000000, - -0.707686, 0.903997, 0.774253, - 0.000000, 0.986824, 0.111631, - 0.774253, 0.903997, 0.707686, - 0.774253, 0.903997, -0.707686, - 0.111631, 0.986824, 0.000000, - 0.800000, 0.800000, 0.800000, - 0.800000, 0.800000, -0.800000, - 0.774253, 0.903997, -0.707686, - 0.800000, 0.800000, 0.800000, - 0.774253, 0.903997, -0.707686, - 0.774253, 0.903997, 0.707686, - 0.800000, 0.800000, -0.800000, - 0.000000, 0.900000, 0.000000, - 0.111631, 0.986824, 0.000000, - 0.800000, 0.800000, -0.800000, - 0.111631, 0.986824, 0.000000, - 0.774253, 0.903997, -0.707686, - 0.000000, 0.900000, 0.000000, - 0.800000, 0.800000, 0.800000, - 0.774253, 0.903997, 0.707686, - 0.000000, 0.900000, 0.000000, - 0.774253, 0.903997, 0.707686, - 0.111631, 0.986824, 0.000000, - 0.707686, 0.903997, -0.774253, - -0.707686, 0.903997, -0.774253, - 0.000000, 0.986824, -0.111631, - 0.800000, 0.800000, -0.800000, - -0.800000, 0.800000, -0.800000, - -0.707686, 0.903997, -0.774253, - 0.800000, 0.800000, -0.800000, - -0.707686, 0.903997, -0.774253, - 0.707686, 0.903997, -0.774253, - -0.800000, 0.800000, -0.800000, - 0.000000, 0.900000, 0.000000, - 0.000000, 0.986824, -0.111631, - -0.800000, 0.800000, -0.800000, - 0.000000, 0.986824, -0.111631, - -0.707686, 0.903997, -0.774253, - 0.000000, 0.900000, 0.000000, - 0.800000, 0.800000, -0.800000, - 0.707686, 0.903997, -0.774253, - 0.000000, 0.900000, 0.000000, - 0.707686, 0.903997, -0.774253, - 0.000000, 0.986824, -0.111631, - -0.774253, -0.903997, 0.707686, - -0.774253, -0.903997, -0.707686, - -0.111631, -0.986824, 0.000000, - -0.800000, -0.800000, 0.800000, - -0.800000, -0.800000, -0.800000, - -0.774253, -0.903997, -0.707686, - -0.800000, -0.800000, 0.800000, - -0.774253, -0.903997, -0.707686, - -0.774253, -0.903997, 0.707686, - -0.800000, -0.800000, -0.800000, - 0.000000, -0.900000, 0.000000, - -0.111631, -0.986824, 0.000000, - -0.800000, -0.800000, -0.800000, - -0.111631, -0.986824, 0.000000, - -0.774253, -0.903997, -0.707686, - 0.000000, -0.900000, 0.000000, - -0.800000, -0.800000, 0.800000, - -0.774253, -0.903997, 0.707686, - 0.000000, -0.900000, 0.000000, - -0.774253, -0.903997, 0.707686, - -0.111631, -0.986824, 0.000000, - -0.707686, -0.903997, -0.774253, - 0.707686, -0.903997, -0.774253, - 0.000000, -0.986824, -0.111631, - -0.800000, -0.800000, -0.800000, - 0.800000, -0.800000, -0.800000, - 0.707686, -0.903997, -0.774253, - -0.800000, -0.800000, -0.800000, - 0.707686, -0.903997, -0.774253, - -0.707686, -0.903997, -0.774253, - 0.800000, -0.800000, -0.800000, - 0.000000, -0.900000, 0.000000, - 0.000000, -0.986824, -0.111631, - 0.800000, -0.800000, -0.800000, - 0.000000, -0.986824, -0.111631, - 0.707686, -0.903997, -0.774253, - 0.000000, -0.900000, 0.000000, - -0.800000, -0.800000, -0.800000, - -0.707686, -0.903997, -0.774253, - 0.000000, -0.900000, 0.000000, - -0.707686, -0.903997, -0.774253, - 0.000000, -0.986824, -0.111631, - 0.774253, -0.903997, -0.707686, - 0.774253, -0.903997, 0.707686, - 0.111631, -0.986824, 0.000000, - 0.800000, -0.800000, -0.800000, - 0.800000, -0.800000, 0.800000, - 0.774253, -0.903997, 0.707686, - 0.800000, -0.800000, -0.800000, - 0.774253, -0.903997, 0.707686, - 0.774253, -0.903997, -0.707686, - 0.800000, -0.800000, 0.800000, - 0.000000, -0.900000, 0.000000, - 0.111631, -0.986824, 0.000000, - 0.800000, -0.800000, 0.800000, - 0.111631, -0.986824, 0.000000, - 0.774253, -0.903997, 0.707686, - 0.000000, -0.900000, 0.000000, - 0.800000, -0.800000, -0.800000, - 0.774253, -0.903997, -0.707686, - 0.000000, -0.900000, 0.000000, - 0.774253, -0.903997, -0.707686, - 0.111631, -0.986824, 0.000000, - 0.707686, -0.903997, 0.774253, - -0.707686, -0.903997, 0.774253, - 0.000000, -0.986824, 0.111631, - 0.800000, -0.800000, 0.800000, - -0.800000, -0.800000, 0.800000, - -0.707686, -0.903997, 0.774253, - 0.800000, -0.800000, 0.800000, - -0.707686, -0.903997, 0.774253, - 0.707686, -0.903997, 0.774253, - -0.800000, -0.800000, 0.800000, - 0.000000, -0.900000, 0.000000, - 0.000000, -0.986824, 0.111631, - -0.800000, -0.800000, 0.800000, - 0.000000, -0.986824, 0.111631, - -0.707686, -0.903997, 0.774253, - 0.000000, -0.900000, 0.000000, - 0.800000, -0.800000, 0.800000, - 0.707686, -0.903997, 0.774253, - 0.000000, -0.900000, 0.000000, - 0.707686, -0.903997, 0.774253, - 0.000000, -0.986824, 0.111631, - }; - - GLfloat normals_high[1512] = - { - -0.261528, -0.355900, -0.897183, - -0.289940, 0.282913, -0.914273, - 0.428513, -0.035815, -0.902825, - -0.577350, -0.577350, -0.577350, - -0.577350, 0.577350, -0.577350, - -0.289940, 0.282913, -0.914273, - -0.577350, -0.577350, -0.577350, - -0.289940, 0.282913, -0.914273, - -0.261528, -0.355900, -0.897183, - -0.577350, 0.577350, -0.577350, - 0.000000, -0.000000, -1.000000, - 0.428513, -0.035815, -0.902825, - -0.577350, 0.577350, -0.577350, - 0.428513, -0.035815, -0.902825, - -0.289940, 0.282913, -0.914273, - 0.000000, -0.000000, -1.000000, - -0.577350, -0.577350, -0.577350, - -0.261528, -0.355900, -0.897183, - 0.000000, -0.000000, -1.000000, - -0.261528, -0.355900, -0.897183, - 0.428513, -0.035815, -0.902825, - -0.355900, 0.261528, -0.897183, - 0.282913, 0.289940, -0.914273, - -0.035815, -0.428513, -0.902825, - -0.577350, 0.577350, -0.577350, - 0.577350, 0.577350, -0.577350, - 0.282913, 0.289940, -0.914273, - -0.577350, 0.577350, -0.577350, - 0.282913, 0.289940, -0.914273, - -0.355900, 0.261528, -0.897183, - 0.577350, 0.577350, -0.577350, - 0.000000, -0.000000, -1.000000, - -0.035815, -0.428513, -0.902825, - 0.577350, 0.577350, -0.577350, - -0.035815, -0.428513, -0.902825, - 0.282913, 0.289940, -0.914273, - 0.000000, -0.000000, -1.000000, - -0.577350, 0.577350, -0.577350, - -0.355900, 0.261528, -0.897183, - 0.000000, -0.000000, -1.000000, - -0.355900, 0.261528, -0.897183, - -0.035815, -0.428513, -0.902825, - 0.261528, 0.355900, -0.897183, - 0.289940, -0.282913, -0.914273, - -0.428513, 0.035815, -0.902825, - 0.577350, 0.577350, -0.577350, - 0.577350, -0.577350, -0.577350, - 0.289940, -0.282913, -0.914273, - 0.577350, 0.577350, -0.577350, - 0.289940, -0.282913, -0.914273, - 0.261528, 0.355900, -0.897183, - 0.577350, -0.577350, -0.577350, - 0.000000, -0.000000, -1.000000, - -0.428513, 0.035815, -0.902825, - 0.577350, -0.577350, -0.577350, - -0.428513, 0.035815, -0.902825, - 0.289940, -0.282913, -0.914273, - 0.000000, -0.000000, -1.000000, - 0.577350, 0.577350, -0.577350, - 0.261528, 0.355900, -0.897183, - 0.000000, -0.000000, -1.000000, - 0.261528, 0.355900, -0.897183, - -0.428513, 0.035815, -0.902825, - 0.355900, -0.261528, -0.897183, - -0.282913, -0.289940, -0.914273, - 0.035815, 0.428513, -0.902825, - 0.577350, -0.577350, -0.577350, - -0.577350, -0.577350, -0.577350, - -0.282913, -0.289940, -0.914273, - 0.577350, -0.577350, -0.577350, - -0.282913, -0.289940, -0.914273, - 0.355900, -0.261528, -0.897183, - -0.577350, -0.577350, -0.577350, - 0.000000, -0.000000, -1.000000, - 0.035815, 0.428513, -0.902825, - -0.577350, -0.577350, -0.577350, - 0.035815, 0.428513, -0.902825, - -0.282913, -0.289940, -0.914273, - 0.000000, -0.000000, -1.000000, - 0.577350, -0.577350, -0.577350, - 0.355900, -0.261528, -0.897183, - 0.000000, -0.000000, -1.000000, - 0.355900, -0.261528, -0.897183, - 0.035815, 0.428513, -0.902825, - 0.897183, 0.355900, 0.261528, - 0.914273, -0.282913, 0.289940, - 0.902825, 0.035815, -0.428513, - 0.577350, 0.577350, 0.577350, - 0.577350, -0.577350, 0.577350, - 0.914273, -0.282913, 0.289940, - 0.577350, 0.577350, 0.577350, - 0.914273, -0.282913, 0.289940, - 0.897183, 0.355900, 0.261528, - 0.577350, -0.577350, 0.577350, - 1.000000, 0.000000, -0.000000, - 0.902825, 0.035815, -0.428513, - 0.577350, -0.577350, 0.577350, - 0.902825, 0.035815, -0.428513, - 0.914273, -0.282913, 0.289940, - 1.000000, 0.000000, -0.000000, - 0.577350, 0.577350, 0.577350, - 0.897183, 0.355900, 0.261528, - 1.000000, 0.000000, -0.000000, - 0.897183, 0.355900, 0.261528, - 0.902825, 0.035815, -0.428513, - 0.897183, -0.261528, 0.355900, - 0.914273, -0.289940, -0.282913, - 0.902825, 0.428513, 0.035815, - 0.577350, -0.577350, 0.577350, - 0.577350, -0.577350, -0.577350, - 0.914273, -0.289940, -0.282913, - 0.577350, -0.577350, 0.577350, - 0.914273, -0.289940, -0.282913, - 0.897183, -0.261528, 0.355900, - 0.577350, -0.577350, -0.577350, - 1.000000, 0.000000, -0.000000, - 0.902825, 0.428513, 0.035815, - 0.577350, -0.577350, -0.577350, - 0.902825, 0.428513, 0.035815, - 0.914273, -0.289940, -0.282913, - 1.000000, 0.000000, -0.000000, - 0.577350, -0.577350, 0.577350, - 0.897183, -0.261528, 0.355900, - 1.000000, 0.000000, -0.000000, - 0.897183, -0.261528, 0.355900, - 0.902825, 0.428513, 0.035815, - 0.897183, -0.355900, -0.261528, - 0.914273, 0.282913, -0.289940, - 0.902825, -0.035815, 0.428513, - 0.577350, -0.577350, -0.577350, - 0.577350, 0.577350, -0.577350, - 0.914273, 0.282913, -0.289940, - 0.577350, -0.577350, -0.577350, - 0.914273, 0.282913, -0.289940, - 0.897183, -0.355900, -0.261528, - 0.577350, 0.577350, -0.577350, - 1.000000, 0.000000, -0.000000, - 0.902825, -0.035815, 0.428513, - 0.577350, 0.577350, -0.577350, - 0.902825, -0.035815, 0.428513, - 0.914273, 0.282913, -0.289940, - 1.000000, 0.000000, -0.000000, - 0.577350, -0.577350, -0.577350, - 0.897183, -0.355900, -0.261528, - 1.000000, 0.000000, -0.000000, - 0.897183, -0.355900, -0.261528, - 0.902825, -0.035815, 0.428513, - 0.897183, 0.261528, -0.355900, - 0.914273, 0.289940, 0.282913, - 0.902825, -0.428513, -0.035815, - 0.577350, 0.577350, -0.577350, - 0.577350, 0.577350, 0.577350, - 0.914273, 0.289940, 0.282913, - 0.577350, 0.577350, -0.577350, - 0.914273, 0.289940, 0.282913, - 0.897183, 0.261528, -0.355900, - 0.577350, 0.577350, 0.577350, - 1.000000, 0.000000, -0.000000, - 0.902825, -0.428513, -0.035815, - 0.577350, 0.577350, 0.577350, - 0.902825, -0.428513, -0.035815, - 0.914273, 0.289940, 0.282913, - 1.000000, 0.000000, -0.000000, - 0.577350, 0.577350, -0.577350, - 0.897183, 0.261528, -0.355900, - 1.000000, 0.000000, -0.000000, - 0.897183, 0.261528, -0.355900, - 0.902825, -0.428513, -0.035815, - 0.261528, -0.355900, 0.897183, - 0.289940, 0.282913, 0.914273, - -0.428513, -0.035815, 0.902825, - 0.577350, -0.577350, 0.577350, - 0.577350, 0.577350, 0.577350, - 0.289940, 0.282913, 0.914273, - 0.577350, -0.577350, 0.577350, - 0.289940, 0.282913, 0.914273, - 0.261528, -0.355900, 0.897183, - 0.577350, 0.577350, 0.577350, - -0.000000, -0.000000, 1.000000, - -0.428513, -0.035815, 0.902825, - 0.577350, 0.577350, 0.577350, - -0.428513, -0.035815, 0.902825, - 0.289940, 0.282913, 0.914273, - -0.000000, -0.000000, 1.000000, - 0.577350, -0.577350, 0.577350, - 0.261528, -0.355900, 0.897183, - -0.000000, -0.000000, 1.000000, - 0.261528, -0.355900, 0.897183, - -0.428513, -0.035815, 0.902825, - 0.355900, 0.261528, 0.897183, - -0.282913, 0.289940, 0.914273, - 0.035815, -0.428513, 0.902825, - 0.577350, 0.577350, 0.577350, - -0.577350, 0.577350, 0.577350, - -0.282913, 0.289940, 0.914273, - 0.577350, 0.577350, 0.577350, - -0.282913, 0.289940, 0.914273, - 0.355900, 0.261528, 0.897183, - -0.577350, 0.577350, 0.577350, - -0.000000, -0.000000, 1.000000, - 0.035815, -0.428513, 0.902825, - -0.577350, 0.577350, 0.577350, - 0.035815, -0.428513, 0.902825, - -0.282913, 0.289940, 0.914273, - -0.000000, -0.000000, 1.000000, - 0.577350, 0.577350, 0.577350, - 0.355900, 0.261528, 0.897183, - -0.000000, -0.000000, 1.000000, - 0.355900, 0.261528, 0.897183, - 0.035815, -0.428513, 0.902825, - -0.261528, 0.355900, 0.897183, - -0.289940, -0.282913, 0.914273, - 0.428513, 0.035815, 0.902825, - -0.577350, 0.577350, 0.577350, - -0.577350, -0.577350, 0.577350, - -0.289940, -0.282913, 0.914273, - -0.577350, 0.577350, 0.577350, - -0.289940, -0.282913, 0.914273, - -0.261528, 0.355900, 0.897183, - -0.577350, -0.577350, 0.577350, - -0.000000, -0.000000, 1.000000, - 0.428513, 0.035815, 0.902825, - -0.577350, -0.577350, 0.577350, - 0.428513, 0.035815, 0.902825, - -0.289940, -0.282913, 0.914273, - -0.000000, -0.000000, 1.000000, - -0.577350, 0.577350, 0.577350, - -0.261528, 0.355900, 0.897183, - -0.000000, -0.000000, 1.000000, - -0.261528, 0.355900, 0.897183, - 0.428513, 0.035815, 0.902825, - -0.355900, -0.261528, 0.897183, - 0.282913, -0.289940, 0.914273, - -0.035815, 0.428513, 0.902825, - -0.577350, -0.577350, 0.577350, - 0.577350, -0.577350, 0.577350, - 0.282913, -0.289940, 0.914273, - -0.577350, -0.577350, 0.577350, - 0.282913, -0.289940, 0.914273, - -0.355900, -0.261528, 0.897183, - 0.577350, -0.577350, 0.577350, - -0.000000, -0.000000, 1.000000, - -0.035815, 0.428513, 0.902825, - 0.577350, -0.577350, 0.577350, - -0.035815, 0.428513, 0.902825, - 0.282913, -0.289940, 0.914273, - -0.000000, -0.000000, 1.000000, - -0.577350, -0.577350, 0.577350, - -0.355900, -0.261528, 0.897183, - -0.000000, -0.000000, 1.000000, - -0.355900, -0.261528, 0.897183, - -0.035815, 0.428513, 0.902825, - -0.897183, -0.355900, 0.261528, - -0.914273, 0.282913, 0.289940, - -0.902825, -0.035815, -0.428513, - -0.577350, -0.577350, 0.577350, - -0.577350, 0.577350, 0.577350, - -0.914273, 0.282913, 0.289940, - -0.577350, -0.577350, 0.577350, - -0.914273, 0.282913, 0.289940, - -0.897183, -0.355900, 0.261528, - -0.577350, 0.577350, 0.577350, - -1.000000, -0.000000, -0.000000, - -0.902825, -0.035815, -0.428513, - -0.577350, 0.577350, 0.577350, - -0.902825, -0.035815, -0.428513, - -0.914273, 0.282913, 0.289940, - -1.000000, -0.000000, -0.000000, - -0.577350, -0.577350, 0.577350, - -0.897183, -0.355900, 0.261528, - -1.000000, -0.000000, -0.000000, - -0.897183, -0.355900, 0.261528, - -0.902825, -0.035815, -0.428513, - -0.897183, 0.261528, 0.355900, - -0.914273, 0.289940, -0.282913, - -0.902825, -0.428513, 0.035815, - -0.577350, 0.577350, 0.577350, - -0.577350, 0.577350, -0.577350, - -0.914273, 0.289940, -0.282913, - -0.577350, 0.577350, 0.577350, - -0.914273, 0.289940, -0.282913, - -0.897183, 0.261528, 0.355900, - -0.577350, 0.577350, -0.577350, - -1.000000, -0.000000, -0.000000, - -0.902825, -0.428513, 0.035815, - -0.577350, 0.577350, -0.577350, - -0.902825, -0.428513, 0.035815, - -0.914273, 0.289940, -0.282913, - -1.000000, -0.000000, -0.000000, - -0.577350, 0.577350, 0.577350, - -0.897183, 0.261528, 0.355900, - -1.000000, -0.000000, -0.000000, - -0.897183, 0.261528, 0.355900, - -0.902825, -0.428513, 0.035815, - -0.897183, 0.355900, -0.261528, - -0.914273, -0.282913, -0.289940, - -0.902825, 0.035815, 0.428513, - -0.577350, 0.577350, -0.577350, - -0.577350, -0.577350, -0.577350, - -0.914273, -0.282913, -0.289940, - -0.577350, 0.577350, -0.577350, - -0.914273, -0.282913, -0.289940, - -0.897183, 0.355900, -0.261528, - -0.577350, -0.577350, -0.577350, - -1.000000, -0.000000, -0.000000, - -0.902825, 0.035815, 0.428513, - -0.577350, -0.577350, -0.577350, - -0.902825, 0.035815, 0.428513, - -0.914273, -0.282913, -0.289940, - -1.000000, -0.000000, -0.000000, - -0.577350, 0.577350, -0.577350, - -0.897183, 0.355900, -0.261528, - -1.000000, -0.000000, -0.000000, - -0.897183, 0.355900, -0.261528, - -0.902825, 0.035815, 0.428513, - -0.897183, -0.261528, -0.355900, - -0.914273, -0.289940, 0.282913, - -0.902825, 0.428513, -0.035815, - -0.577350, -0.577350, -0.577350, - -0.577350, -0.577350, 0.577350, - -0.914273, -0.289940, 0.282913, - -0.577350, -0.577350, -0.577350, - -0.914273, -0.289940, 0.282913, - -0.897183, -0.261528, -0.355900, - -0.577350, -0.577350, 0.577350, - -1.000000, -0.000000, -0.000000, - -0.902825, 0.428513, -0.035815, - -0.577350, -0.577350, 0.577350, - -0.902825, 0.428513, -0.035815, - -0.914273, -0.289940, 0.282913, - -1.000000, -0.000000, -0.000000, - -0.577350, -0.577350, -0.577350, - -0.897183, -0.261528, -0.355900, - -1.000000, -0.000000, -0.000000, - -0.897183, -0.261528, -0.355900, - -0.902825, 0.428513, -0.035815, - -0.261528, 0.897183, -0.355900, - -0.289940, 0.914273, 0.282913, - 0.428513, 0.902825, -0.035815, - -0.577350, 0.577350, -0.577350, - -0.577350, 0.577350, 0.577350, - -0.289940, 0.914273, 0.282913, - -0.577350, 0.577350, -0.577350, - -0.289940, 0.914273, 0.282913, - -0.261528, 0.897183, -0.355900, - -0.577350, 0.577350, 0.577350, - 0.000000, 1.000000, -0.000000, - 0.428513, 0.902825, -0.035815, - -0.577350, 0.577350, 0.577350, - 0.428513, 0.902825, -0.035815, - -0.289940, 0.914273, 0.282913, - 0.000000, 1.000000, -0.000000, - -0.577350, 0.577350, -0.577350, - -0.261528, 0.897183, -0.355900, - 0.000000, 1.000000, -0.000000, - -0.261528, 0.897183, -0.355900, - 0.428513, 0.902825, -0.035815, - -0.355900, 0.897183, 0.261528, - 0.282913, 0.914273, 0.289940, - -0.035815, 0.902825, -0.428513, - -0.577350, 0.577350, 0.577350, - 0.577350, 0.577350, 0.577350, - 0.282913, 0.914273, 0.289940, - -0.577350, 0.577350, 0.577350, - 0.282913, 0.914273, 0.289940, - -0.355900, 0.897183, 0.261528, - 0.577350, 0.577350, 0.577350, - 0.000000, 1.000000, -0.000000, - -0.035815, 0.902825, -0.428513, - 0.577350, 0.577350, 0.577350, - -0.035815, 0.902825, -0.428513, - 0.282913, 0.914273, 0.289940, - 0.000000, 1.000000, -0.000000, - -0.577350, 0.577350, 0.577350, - -0.355900, 0.897183, 0.261528, - 0.000000, 1.000000, -0.000000, - -0.355900, 0.897183, 0.261528, - -0.035815, 0.902825, -0.428513, - 0.261528, 0.897183, 0.355900, - 0.289940, 0.914273, -0.282913, - -0.428513, 0.902825, 0.035815, - 0.577350, 0.577350, 0.577350, - 0.577350, 0.577350, -0.577350, - 0.289940, 0.914273, -0.282913, - 0.577350, 0.577350, 0.577350, - 0.289940, 0.914273, -0.282913, - 0.261528, 0.897183, 0.355900, - 0.577350, 0.577350, -0.577350, - 0.000000, 1.000000, -0.000000, - -0.428513, 0.902825, 0.035815, - 0.577350, 0.577350, -0.577350, - -0.428513, 0.902825, 0.035815, - 0.289940, 0.914273, -0.282913, - 0.000000, 1.000000, -0.000000, - 0.577350, 0.577350, 0.577350, - 0.261528, 0.897183, 0.355900, - 0.000000, 1.000000, -0.000000, - 0.261528, 0.897183, 0.355900, - -0.428513, 0.902825, 0.035815, - 0.355900, 0.897183, -0.261528, - -0.282913, 0.914273, -0.289940, - 0.035815, 0.902825, 0.428513, - 0.577350, 0.577350, -0.577350, - -0.577350, 0.577350, -0.577350, - -0.282913, 0.914273, -0.289940, - 0.577350, 0.577350, -0.577350, - -0.282913, 0.914273, -0.289940, - 0.355900, 0.897183, -0.261528, - -0.577350, 0.577350, -0.577350, - 0.000000, 1.000000, -0.000000, - 0.035815, 0.902825, 0.428513, - -0.577350, 0.577350, -0.577350, - 0.035815, 0.902825, 0.428513, - -0.282913, 0.914273, -0.289940, - 0.000000, 1.000000, -0.000000, - 0.577350, 0.577350, -0.577350, - 0.355900, 0.897183, -0.261528, - 0.000000, 1.000000, -0.000000, - 0.355900, 0.897183, -0.261528, - 0.035815, 0.902825, 0.428513, - -0.261528, -0.897183, 0.355900, - -0.289940, -0.914273, -0.282913, - 0.428513, -0.902825, 0.035815, - -0.577350, -0.577350, 0.577350, - -0.577350, -0.577350, -0.577350, - -0.289940, -0.914273, -0.282913, - -0.577350, -0.577350, 0.577350, - -0.289940, -0.914273, -0.282913, - -0.261528, -0.897183, 0.355900, - -0.577350, -0.577350, -0.577350, - 0.000000, -1.000000, 0.000000, - 0.428513, -0.902825, 0.035815, - -0.577350, -0.577350, -0.577350, - 0.428513, -0.902825, 0.035815, - -0.289940, -0.914273, -0.282913, - 0.000000, -1.000000, 0.000000, - -0.577350, -0.577350, 0.577350, - -0.261528, -0.897183, 0.355900, - 0.000000, -1.000000, 0.000000, - -0.261528, -0.897183, 0.355900, - 0.428513, -0.902825, 0.035815, - -0.355900, -0.897183, -0.261528, - 0.282913, -0.914273, -0.289940, - -0.035815, -0.902825, 0.428513, - -0.577350, -0.577350, -0.577350, - 0.577350, -0.577350, -0.577350, - 0.282913, -0.914273, -0.289940, - -0.577350, -0.577350, -0.577350, - 0.282913, -0.914273, -0.289940, - -0.355900, -0.897183, -0.261528, - 0.577350, -0.577350, -0.577350, - 0.000000, -1.000000, 0.000000, - -0.035815, -0.902825, 0.428513, - 0.577350, -0.577350, -0.577350, - -0.035815, -0.902825, 0.428513, - 0.282913, -0.914273, -0.289940, - 0.000000, -1.000000, 0.000000, - -0.577350, -0.577350, -0.577350, - -0.355900, -0.897183, -0.261528, - 0.000000, -1.000000, 0.000000, - -0.355900, -0.897183, -0.261528, - -0.035815, -0.902825, 0.428513, - 0.261528, -0.897183, -0.355900, - 0.289940, -0.914273, 0.282913, - -0.428513, -0.902825, -0.035815, - 0.577350, -0.577350, -0.577350, - 0.577350, -0.577350, 0.577350, - 0.289940, -0.914273, 0.282913, - 0.577350, -0.577350, -0.577350, - 0.289940, -0.914273, 0.282913, - 0.261528, -0.897183, -0.355900, - 0.577350, -0.577350, 0.577350, - 0.000000, -1.000000, 0.000000, - -0.428513, -0.902825, -0.035815, - 0.577350, -0.577350, 0.577350, - -0.428513, -0.902825, -0.035815, - 0.289940, -0.914273, 0.282913, - 0.000000, -1.000000, 0.000000, - 0.577350, -0.577350, -0.577350, - 0.261528, -0.897183, -0.355900, - 0.000000, -1.000000, 0.000000, - 0.261528, -0.897183, -0.355900, - -0.428513, -0.902825, -0.035815, - 0.355900, -0.897183, 0.261528, - -0.282913, -0.914273, 0.289940, - 0.035815, -0.902825, -0.428513, - 0.577350, -0.577350, 0.577350, - -0.577350, -0.577350, 0.577350, - -0.282913, -0.914273, 0.289940, - 0.577350, -0.577350, 0.577350, - -0.282913, -0.914273, 0.289940, - 0.355900, -0.897183, 0.261528, - -0.577350, -0.577350, 0.577350, - 0.000000, -1.000000, 0.000000, - 0.035815, -0.902825, -0.428513, - -0.577350, -0.577350, 0.577350, - 0.035815, -0.902825, -0.428513, - -0.282913, -0.914273, 0.289940, - 0.000000, -1.000000, 0.000000, - 0.577350, -0.577350, 0.577350, - 0.355900, -0.897183, 0.261528, - 0.000000, -1.000000, 0.000000, - 0.355900, -0.897183, 0.261528, - 0.035815, -0.902825, -0.428513, - }; - -#if 1 - GLfloat vertices_low[216] = - { - -0.850000, -0.850000, -0.850000, - -0.850000, 0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - -0.850000, 0.850000, -0.850000, - 0.850000, 0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, 0.850000, -0.850000, - 0.850000, -0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, -0.850000, -0.850000, - -0.850000, -0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, 0.850000, 0.850000, - 0.850000, -0.850000, 0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - 0.850000, -0.850000, -0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, -0.850000, - 0.850000, 0.850000, -0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, 0.850000, -0.850000, - 0.850000, 0.850000, 0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - 0.850000, 0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - 0.850000, 0.850000, 0.850000, - -0.850000, 0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, 0.850000, 0.850000, - -0.850000, -0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, -0.850000, 0.850000, - 0.850000, -0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, -0.850000, 0.850000, - -0.850000, 0.850000, 0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, 0.850000, - -0.850000, 0.850000, -0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, -0.850000, - -0.850000, -0.850000, -0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, -0.850000, -0.850000, - -0.850000, -0.850000, 0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, -0.850000, - -0.850000, 0.850000, 0.850000, - 0.000000, 1.000000, -0.000000, - -0.850000, 0.850000, 0.850000, - 0.850000, 0.850000, 0.850000, - 0.000000, 1.000000, -0.000000, - 0.850000, 0.850000, 0.850000, - 0.850000, 0.850000, -0.850000, - 0.000000, 1.000000, -0.000000, - 0.850000, 0.850000, -0.850000, - -0.850000, 0.850000, -0.850000, - 0.000000, 1.000000, -0.000000, - -0.850000, -0.850000, 0.850000, - -0.850000, -0.850000, -0.850000, - 0.000000, -1.000000, -0.000000, - -0.850000, -0.850000, -0.850000, - 0.850000, -0.850000, -0.850000, - 0.000000, -1.000000, -0.000000, - 0.850000, -0.850000, -0.850000, - 0.850000, -0.850000, 0.850000, - 0.000000, -1.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - -0.850000, -0.850000, 0.850000, - 0.000000, -1.000000, -0.000000, - }; - - GLfloat normals_low[216] = - { - -0.242536, 0.000000, -0.970143, - -0.242536, 0.000000, -0.970143, - 0.000000, 0.000000, -1.000000, - 0.000000, 0.242536, -0.970143, - 0.000000, 0.242536, -0.970143, - 0.000000,0.000000,-1.000000, - 0.000000, 0.242536, -0.970143, - 0.242536, 0.000000, -0.970143, - 0.000000,0.000000,-1.000000, - 0.242536, 0.000000, -0.970143, - -0.000000, -0.242536, -0.970143, - 0.000000,0.000000, -1.000000, - 0.970142, 0.000000, 0.242536, - 0.970142, 0.000000, 0.242536, - 1.000000,0.000000,0.000000, - 0.970142, -0.242536, 0.000000, - 0.970142, -0.242536, 0.000000, - 1.000000, 0.000000, 0.000000, - 0.970142, 0.000000, -0.242536, - 0.970142, 0.000000, -0.242536, - 1.000000, 0.000000, 0.000000, - 0.970142, 0.242536, -0.000000, - 0.970142, 0.242536, -0.000000, - 1.000000, 0.000000, 0.000000, - 0.242536, -0.000000, 0.970143, - 0.242536, -0.000000, 0.970143, - 0.000000, 0.000000, 1.000000, - 0.000000, 0.242536, 0.970143, - 0.000000, 0.242536, 0.970143, - 0.000000, 0.000000, 1.000000, - -0.242536, 0.000000, 0.970143, - -0.242536, 0.000000, 0.970143, - 0.000000, 0.000000, 1.000000, - 0.000000, -0.242536, 0.970143, - 0.000000, -0.242536, 0.970143, - 0.000000, 0.000000, 1.000000, - -0.970142, 0.000000, 0.242536, - -0.970142, 0.000000, 0.242536, - -1.000000, 0.000000, 0.000000, - -0.970142, 0.242536, 0.000000, - -0.970142, 0.242536, 0.000000, - -1.000000, 0.000000, 0.000000, - -0.970142, -0.000000, -0.242536, - -0.970142, -0.000000, -0.242536, - -1.000000, 0.000000, 0.000000, - -0.970142, -0.242536, 0.000000, - -0.970142, -0.242536, 0.000000, - -1.000000, 0.000000, 0.000000, - -0.242536, 0.970142, 0.000000, - -0.242536, 0.970142, 0.000000, - 0.000000, 1.000000, 0.000000, - -0.000000, 0.970142, 0.242536, - -0.000000, 0.970142, 0.242536, - 0.000000, 1.000000, 0.000000, - 0.242536, 0.970142, 0.000000, - 0.242536, 0.970142, 0.000000, - 0.000000, 1.000000, 0.000000, - 0.000000, 0.970142, -0.242536, - 0.000000, 0.970142, -0.242536, - 0.000000, 1.000000, 0.000000, - -0.242536, -0.970142, -0.000000, - -0.242536, -0.970142, -0.000000, - 0.000000, -1.000000, 0.000000, - 0.000000, -0.970142, -0.242536, - 0.000000, -0.970142, -0.242536, - 0.000000, -1.000000, 0.000000, - 0.242536, -0.970142, 0.000000, - 0.242536, -0.970142, 0.000000, - 0.000000, -1.000000, 0.000000, - 0.000000, -0.970142, 0.242536, - 0.000000, -0.970142, 0.242536, - 0.000000, -1.000000, 0.000000, - }; -#else - - GLfloat vertices_low[216] = - { - -0.850000, -0.850000, -0.850000, - -0.850000, 0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - -0.850000, 0.850000, -0.850000, - 0.850000, 0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, 0.850000, -0.850000, - 0.850000, -0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, -0.850000, -0.850000, - -0.850000, -0.850000, -0.850000, - 0.000000, 0.000000, -1.000000, - 0.850000, 0.850000, 0.850000, - 0.850000, -0.850000, 0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - 0.850000, -0.850000, -0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, -0.850000, - 0.850000, 0.850000, -0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, 0.850000, -0.850000, - 0.850000, 0.850000, 0.850000, - 1.000000, 0.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - 0.850000, 0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - 0.850000, 0.850000, 0.850000, - -0.850000, 0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, 0.850000, 0.850000, - -0.850000, -0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, -0.850000, 0.850000, - 0.850000, -0.850000, 0.850000, - 0.000000, 0.000000, 1.000000, - -0.850000, -0.850000, 0.850000, - -0.850000, 0.850000, 0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, 0.850000, - -0.850000, 0.850000, -0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, -0.850000, - -0.850000, -0.850000, -0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, -0.850000, -0.850000, - -0.850000, -0.850000, 0.850000, - -1.000000, 0.000000, -0.000000, - -0.850000, 0.850000, -0.850000, - -0.850000, 0.850000, 0.850000, - 0.000000, 1.000000, -0.000000, - -0.850000, 0.850000, 0.850000, - 0.850000, 0.850000, 0.850000, - 0.000000, 1.000000, -0.000000, - 0.850000, 0.850000, 0.850000, - 0.850000, 0.850000, -0.850000, - 0.000000, 1.000000, -0.000000, - 0.850000, 0.850000, -0.850000, - -0.850000, 0.850000, -0.850000, - 0.000000, 1.000000, -0.000000, - -0.850000, -0.850000, 0.850000, - -0.850000, -0.850000, -0.850000, - 0.000000, -1.000000, -0.000000, - -0.850000, -0.850000, -0.850000, - 0.850000, -0.850000, -0.850000, - 0.000000, -1.000000, -0.000000, - 0.850000, -0.850000, -0.850000, - 0.850000, -0.850000, 0.850000, - 0.000000, -1.000000, -0.000000, - 0.850000, -0.850000, 0.850000, - -0.850000, -0.850000, 0.850000, - 0.000000, -1.000000, -0.000000, - }; - - GLfloat normals_low[216] = - { - -0.577350, -0.577350, -0.577350, - -0.577350, 0.577350, -0.577350, - 0.000000, 0.000000, -1.000000, - -0.577350, 0.577350, -0.577350, - 0.577350, 0.577350, -0.577350, - 0.000000, 0.000000, -1.000000, - 0.577350, 0.577350, -0.577350, - 0.577350, -0.577350, -0.577350, - 0.000000, 0.000000, -1.000000, - 0.577350, -0.577350, -0.577350, - -0.577350, -0.577350, -0.577350, - 0.000000, 0.000000, -1.000000, - 0.577350, 0.577350, 0.577350, - 0.577350, -0.577350, 0.577350, - 1.000000, 0.000000, 0.000000, - 0.577350, -0.577350, 0.577350, - 0.577350, -0.577350, -0.577350, - 1.000000, 0.000000, 0.000000, - 0.577350, -0.577350, -0.577350, - 0.577350, 0.577350, -0.577350, - 1.000000, 0.000000, 0.000000, - 0.577350, 0.577350, -0.577350, - 0.577350, 0.577350, 0.577350, - 1.000000, 0.000000, 0.000000, - 0.577350, -0.577350, 0.577350, - 0.577350, 0.577350, 0.577350, - 0.000000, 0.000000, 1.000000, - 0.577350, 0.577350, 0.577350, - -0.577350, 0.577350, 0.577350, - 0.000000, 0.000000, 1.000000, - -0.577350, 0.577350, 0.577350, - -0.577350, -0.577350, 0.577350, - 0.000000, 0.000000, 1.000000, - -0.577350, -0.577350, 0.577350, - 0.577350, -0.577350, 0.577350, - 0.000000, 0.000000, 1.000000, - -0.577350, -0.577350, 0.577350, - -0.577350, 0.577350, 0.577350, - -1.000000, 0.000000, 0.000000, - -0.577350, 0.577350, 0.577350, - -0.577350, 0.577350, -0.577350, - -1.000000, 0.000000, 0.000000, - -0.577350, 0.577350, -0.577350, - -0.577350, -0.577350, -0.577350, - -1.000000, 0.000000, 0.000000, - -0.577350, -0.577350, -0.577350, - -0.577350, -0.577350, 0.577350, - -1.000000, 0.000000, 0.000000, - -0.577350, 0.577350, -0.577350, - -0.577350, 0.577350, 0.577350, - 0.000000, 1.000000, 0.000000, - -0.577350, 0.577350, 0.577350, - 0.577350, 0.577350, 0.577350, - 0.000000, 1.000000, 0.000000, - 0.577350, 0.577350, 0.577350, - 0.577350, 0.577350, -0.577350, - 0.000000, 1.000000, 0.000000, - 0.577350, 0.577350, -0.577350, - -0.577350, 0.577350, -0.577350, - 0.000000, 1.000000, 0.000000, - -0.577350, -0.577350, 0.577350, - -0.577350, -0.577350, -0.577350, - 0.000000, -1.000000, 0.000000, - -0.577350, -0.577350, -0.577350, - 0.577350, -0.577350, -0.577350, - 0.000000, -1.000000, 0.000000, - 0.577350, -0.577350, -0.577350, - 0.577350, -0.577350, 0.577350, - 0.000000, -1.000000, 0.000000, - 0.577350, -0.577350, 0.577350, - -0.577350, -0.577350, 0.577350, - 0.000000, -1.000000, 0.000000, - }; -#endif - GLfloat vertices_rlow[36] = - { - -0.85f,-0.85f,1.0f, // bottom left - 0.85f,-0.85f,1.0f, // bottom right - 0.85f,0.85f,1.0f, // upper right - -0.85f,0.85f,1.0f, // upper left - -0.85f,-0.85f,1.0f, // bottom left - 0.85f,0.85f,1.0f, // upper right - - 0.85f,-0.85f,1.0f, // bottom right - -0.85f,-0.85f,1.0f, // bottom left - -0.85f,0.85f,1.0f, // upper left - 0.85f,0.85f,1.0f, // upper right - 0.85f,-0.85f,1.0f, // bottom right - -0.85f,0.85f,1.0f // upper left - }; - - GLfloat *vertices, *normals = NULL; - int n_vertices; - - if (MetaState::mode & CM_REALLY_LOW_GRAPHICS) { - vertices = vertices_rlow; - n_vertices = 12; - } else if (MetaState::mode & CM_LOW_GRAPHICS) { - vertices = vertices_low; - normals = normals_low; - n_vertices = 72; - } else { - vertices = vertices_high; - normals = normals_high; - n_vertices = 504; - } - - glVertexPointer(3, GL_FLOAT, 0, vertices); - if (!(MetaState::mode & CM_REALLY_LOW_GRAPHICS)) - glNormalPointer(GL_FLOAT, 0, normals); - - glDrawArrays(GL_TRIANGLES, 0, n_vertices); - - glEndList(); - - // Now let's make one for pulsing blocks - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - GLfloat *tex_coords = new GLfloat[3 * n_vertices]; - for (int n = 3 * n_vertices; n--; ) - tex_coords[n] = vertices[n] * 0.5f; - - special_block_list = glGenLists(1); - glNewList(special_block_list, GL_COMPILE); - - glTexCoordPointer(3, GL_FLOAT, 0, tex_coords); - glDrawArrays(GL_TRIANGLES, 0, n_vertices); - - glEndList(); - - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - - // Now let's make one at half that size and rotated - - float v[3]; - const GLfloat M[16] - = { 0.707107f, 0.5f, -0.5f, 0.0f, - 0.0f, 0.707107f, 0.707107f, 0.0f, - 0.707107f, -0.5f, 0.5f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; - - if (!(MetaState::mode & CM_REALLY_LOW_GRAPHICS)) { - for (int n = 3 * n_vertices; n -=3; ) { - v[0] = vertices[n + 0]; - v[1] = vertices[n + 1]; - v[2] = vertices[n + 2]; - - vertices[n + 0] = 0.5 * (M[0] * v[0] + M[4] * v[1] + M[8] * v[2]); - vertices[n + 1] = 0.5 * (M[1] * v[0] + M[5] * v[1] + M[9] * v[2]); - vertices[n + 2] = 0.5 * (M[2] * v[0] + M[6] * v[1] + M[10] * v[2]); - - v[0] = normals[n + 0]; - v[1] = normals[n + 1]; - v[2] = normals[n + 2]; - - normals[n + 0] = M[0] * v[0] + M[4] * v[1] + M[8] * v[2]; - normals[n + 1] = M[1] * v[0] + M[5] * v[1] + M[9] * v[2]; - normals[n + 2] = M[2] * v[0] + M[6] * v[1] + M[10] * v[2]; - } - } else { - for (int n = 0; n < 3 * n_vertices; ++n) { - vertices[n] *= 0.5; - } - } - - small_block_list = glGenLists(1); - glNewList(small_block_list, GL_COMPILE); - - glVertexPointer(3, GL_FLOAT, 0, vertices); - if (!(MetaState::mode & CM_REALLY_LOW_GRAPHICS)) - glNormalPointer(GL_FLOAT, 0, normals); - - glDrawArrays(GL_TRIANGLES, 0, n_vertices); - - glEndList(); - - glDisableClientState(GL_VERTEX_ARRAY); - if (!(MetaState::mode & CM_REALLY_LOW_GRAPHICS)) - glDisableClientState(GL_NORMAL_ARRAY); - - // Now we build the special color blocks' gleam texture. A texture value of - // 0.6f seems to cause the special color blocks to match their standard - // siblings, given the specials' double color values. - - GLubyte texture[32]; - for (int n = 32; n--; ) - texture[n] - = (GLubyte) (255.0f * (0.8f - 0.2f * cos((2.0f * PI / 32.0f) * n))); - - glGenTextures(1, &special_block_lightmap); - - glBindTexture(GL_TEXTURE_1D, special_block_lightmap); - - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - const GLubyte* renderer = glGetString(GL_RENDERER); - if (strstr((char*) renderer, "DRI 20020221 Voodoo3")) { - cerr << "**********\nWARNING:" - "disabling call to 1d texturing on DRI 20020221 Voodoo3 renderer " - "since it segfaults\n**********" << endl; - delete[] tex_coords; - return; - } - if (strstr((char*) renderer, "865G 20021115")) { - cerr << "**********\nWARNING:" - "disabling call to 1d texturing on 865G 20021115 renderer " - "since it segfaults\n**********" << endl; - delete[] tex_coords; - return; - } - - glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 32, GL_FALSE, GL_LUMINANCE, - GL_UNSIGNED_BYTE, texture); - delete[] tex_coords; -} +/* + * block.cxx + * Daniel Nelson - 8/31/0 + * + * Copyright (C) 2006 Bjørn Lindeijer + * Copyright (C) 2000 Daniel Nelson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Daniel Nelson - aluminumangel.org + * 174 W. 18th Ave. + * Columbus, OH 43210 + * + * Generates the block's two display lists. + */ + +#include + +#include "glext.h" + +#include + +#include "Game.h" +#include "Displayer.h" +#include "OBJModel.h" + +GLuint Displayer::block_list; +GLuint Displayer::small_block_list; +GLuint Displayer::special_block_list; + +GLuint Displayer::special_block_lightmap; + +void Displayer::generateBlockDisplayList ( ) +{ + OBJModel *block_model = NULL; + OBJModel *block_model_tex = NULL; + + if (MetaState::mode & CM_LOW_GRAPHICS) { + block_model = new OBJModel(GC_MODEL_DIRECTORY("crackattackcubemedres.obj")); + block_model_tex = new OBJModel(GC_MODEL_DIRECTORY("crackattackcubemedres_tex.obj")); + } else { + block_model = new OBJModel(GC_MODEL_DIRECTORY("crackattackcubehires.obj")); + block_model_tex = new OBJModel(GC_MODEL_DIRECTORY("crackattackcubehires_tex.obj")); + } + block_list = glGenLists(1); + glNewList(block_list, GL_COMPILE); + block_model->render(); + glEndList(); + + // Now let's make one for pulsing blocks (has texture coordinates) + + special_block_list = glGenLists(1); + glNewList(special_block_list, GL_COMPILE); + block_model_tex->render(); + glEndList(); + + delete block_model; + delete block_model_tex; + + // Now let's make one at half that size and rotated + + small_block_list = glGenLists(1); + glNewList(small_block_list, GL_COMPILE); + glPushMatrix(); + glRotatef(45.0f, 1.0f, 0.0f, 0.0f); + glRotatef(45.0f, 0.0f, 1.0f, 0.0f); + glScalef(0.5f, 0.5f, 0.5f); + glEnable(GL_NORMALIZE); + glCallList(block_list); + glDisable(GL_NORMALIZE); + glPopMatrix(); + glEndList(); + + // Now we build the special color blocks' gleam texture. A texture value of + // 0.6f seems to cause the special color blocks to match their standard + // siblings, given the specials' double color values. + + GLubyte texture[32]; + for (int n = 32; n--; ) + texture[n] + = (GLubyte) (255.0f * (0.8f - 0.2f * cos((2.0f * PI / 32.0f) * n))); + + glGenTextures(1, &special_block_lightmap); + + glBindTexture(GL_TEXTURE_1D, special_block_lightmap); + + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + const GLubyte* renderer = glGetString(GL_RENDERER); + if (strstr((char*) renderer, "DRI 20020221 Voodoo3")) { + cerr << "**********\nWARNING:" + "disabling call to 1d texturing on DRI 20020221 Voodoo3 renderer " + "since it segfaults\n**********" << endl; + delete[] tex_coords; + return; + } + if (strstr((char*) renderer, "865G 20021115")) { + cerr << "**********\nWARNING:" + "disabling call to 1d texturing on 865G 20021115 renderer " + "since it segfaults\n**********" << endl; + delete[] tex_coords; + return; + } + + glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 32, GL_FALSE, GL_LUMINANCE, + GL_UNSIGNED_BYTE, texture); + delete[] tex_coords; +} -- 2.11.4.GIT