00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <QtOpenGL>
00033 #define BYTE unsigned char
00034
00035 namespace Enki
00036 {
00037
00038
00039
00040
00041
00042 static BYTE face_indicies[70][9] = {
00043
00044 {45,28,47 ,0,0,0 ,0,1,2 }, {44,28,45 ,0,0,0 ,3,1,0 }, {44,30,28 ,0,0,0 ,3,4,1 },
00045 {41,30,44 ,0,0,0 ,5,4,3 }, {41,18,30 ,0,0,0 ,5,6,4 }, {39,18,41 ,0,0,0 ,7,6,5 },
00046 {18,39,20 ,0,0,0 ,6,7,8 }, {37,20,39 ,0,0,0 ,9,8,7 }, {37,11,20 ,0,0,0 ,9,10,8 },
00047 {35,11,37 ,0,0,0 ,11,10,9 }, {35,13,11 ,0,0,0 ,11,12,10 }, {13,35,7 ,0,0,0 ,12,11,13 },
00048 {33,7,35 ,0,0,0 ,14,13,11 }, {32,7,33 ,0,0,0 ,15,13,14 }, {7,32,9 ,0,0,0 ,13,15,16 },
00049 {24,9,32 ,0,0,0 ,17,16,15 }, {9,24,2 ,0,0,0 ,16,17,18 }, {2,24,3 ,0,0,0 ,18,17,19 },
00050 {24,22,3 ,0,0,0 ,17,20,19 }, {3,22,0 ,0,0,0 ,19,20,21 }, {16,0,22 ,0,0,0 ,22,21,20 },
00051 {14,0,16 ,0,0,0 ,23,21,22 }, {4,3,5 ,1,2,3 ,24,25,26 }, {4,2,3 ,1,4,2 ,24,27,25 },
00052 {10,2,4 ,5,4,1 ,28,27,24 }, {10,9,2 ,5,6,4 ,28,29,27 }, {8,9,10 ,7,6,5 ,30,29,28 },
00053 {8,7,9 ,7,8,6 ,30,31,29 }, {6,7,8 ,9,8,7 ,32,31,30 }, {6,13,7 ,9,10,8 ,32,33,31 },
00054 {12,13,6 ,11,10,9 ,34,33,32 }, {12,11,13 ,11,12,10 ,34,35,33 },
00055 {21,11,12 ,13,12,11 ,36,35,34 }, {21,20,11 ,13,14,12 ,36,37,35 },
00056 {19,20,21 ,15,14,13 ,38,37,36 }, {19,18,20 ,15,16,14 ,38,39,37 },
00057 {31,18,19 ,17,16,15 ,40,39,38 }, {31,30,18 ,17,18,16 ,40,41,39 },
00058 {29,30,31 ,19,18,17 ,42,43,44 }, {29,28,30 ,19,20,18 ,42,45,43 },
00059 {27,28,29 ,21,20,19 ,46,45,42 }, {27,47,28 ,21,22,20 ,46,47,45 },
00060 {46,47,27 ,23,22,21 ,48,47,46 }, {46,45,47 ,23,24,22 ,48,49,47 },
00061 {43,45,46 ,25,24,23 ,50,49,48 }, {43,44,45 ,25,26,24 ,50,51,49 },
00062 {42,44,43 ,27,26,25 ,52,51,50 }, {42,41,44 ,27,28,26 ,52,53,51 },
00063 {40,41,42 ,29,28,27 ,54,53,52 }, {40,39,41 ,29,30,28 ,54,55,53 },
00064 {38,39,40 ,31,30,29 ,56,55,54 }, {38,37,39 ,31,32,30 ,56,57,55 },
00065 {36,37,38 ,33,32,31 ,58,57,56 }, {36,35,37 ,33,34,32 ,58,59,57 },
00066 {34,35,36 ,35,34,33 ,60,59,58 }, {34,33,35 ,35,36,34 ,60,61,59 },
00067 {26,33,34 ,37,36,35 ,62,61,60 }, {26,32,33 ,37,38,36 ,62,63,61 },
00068 {25,32,26 ,39,38,37 ,64,63,62 }, {25,24,32 ,39,40,38 ,64,65,63 },
00069 {23,24,25 ,41,40,39 ,66,65,64 }, {23,22,24 ,41,42,40 ,66,67,65 },
00070 {17,22,23 ,43,42,41 ,68,67,66 }, {17,16,22 ,43,44,42 ,68,69,67 },
00071 {15,16,17 ,45,44,43 ,70,69,68 }, {15,14,16 ,45,46,44 ,70,71,69 },
00072 {1,14,15 ,47,46,45 ,72,71,70 }, {1,0,14 ,47,48,46 ,72,73,71 },
00073 {5,0,1 ,3,48,47 ,26,73,72 }, {5,3,0 ,3,2,48 ,26,25,73 }
00074 };
00075 static GLfloat vertices [48][3] = {
00076 {0.0150897f,0.0150897f,0.0835f},{0.0146159f,0.0146159f,0.07475f},{0.0055232f,0.0206129f,0.0835f},
00077 {0.01067f,0.018481f,0.0835f},{0.00534979f,0.0199657f,0.07475f},{0.010335f,0.0179007f,0.07475f},
00078 {-0.010335f,0.0179007f,0.07475f},{-0.0055232f,0.0206129f,0.0835f},{-0.00534979f,0.0199657f,0.07475f},
00079 {0.0f,0.02134f,0.0835f},{0.0f,0.02067f,0.07475f},{-0.0150897f,0.0150897f,0.0835f},
00080 {-0.0146159f,0.0146159f,0.07475f},{-0.01067f,0.018481f,0.0835f},{0.018481f,0.01067f,0.0835f},
00081 {0.0179007f,0.010335f,0.07475f},{0.0206129f,0.0055232f,0.0835f},{0.0199657f,0.00534979f,0.07475f},
00082 {-0.0206129f,0.0055232f,0.0835f},{-0.0199657f,0.00534979f,0.07475f},{-0.018481f,0.01067f,0.0835f},
00083 {-0.0179007f,0.010335f,0.07475f},{0.02134f,0.0f,0.0835f},{0.02067f,0.0f,0.07475f},
00084 {0.0206129f,-0.0055232f,0.0835f},{0.0199657f,-0.00534979f,0.07475f},{0.0179007f,-0.010335f,0.07475f},
00085 {-0.0179007f,-0.010335f,0.07475f},{-0.0206129f,-0.0055232f,0.0835f},{-0.0199657f,-0.00534979f,0.07475f},
00086 {-0.02134f,0.0f,0.0835f},{-0.02067f,0.0f,0.07475f},{0.018481f,-0.01067f,0.0835f},
00087 {0.0150897f,-0.0150897f,0.0835f},{0.0146159f,-0.0146159f,0.07475f},{0.01067f,-0.018481f,0.0835f},
00088 {0.010335f,-0.0179007f,0.07475f},{0.0055232f,-0.0206129f,0.0835f},{0.00534979f,-0.0199657f,0.07475f},
00089 {0.0f,-0.02134f,0.0835f},{0.0f,-0.02067f,0.07475f},{-0.0055232f,-0.0206129f,0.0835f},
00090 {-0.00534979f,-0.0199657f,0.07475f},{-0.010335f,-0.0179007f,0.07475f},{-0.01067f,-0.018481f,0.0835f},
00091 {-0.0150897f,-0.0150897f,0.0835f},{-0.0146159f,-0.0146159f,0.07475f},{-0.018481f,-0.01067f,0.0835f}
00092 };
00093 static GLfloat normals [49][3] = {
00094 {0.0f,0.0f,1.0f},{0.300042f,0.950872f,-0.0762748f},{0.460207f,0.884529f,-0.0762749f},
00095 {0.535922f,0.840815f,-0.076275f},{0.215592f,0.9735f,-0.0762748f},{0.0437144f,0.996128f,-0.0762749f},
00096 {-0.0437142f,0.996128f,-0.0762749f},{-0.215592f,0.9735f,-0.0762748f},{-0.300042f,0.950872f,-0.0762748f},
00097 {-0.460206f,0.884529f,-0.0762749f},{-0.535922f,0.840815f,-0.076275f},{-0.673458f,0.73528f,-0.076275f},
00098 {-0.73528f,0.673458f,-0.076275f},{-0.840815f,0.535922f,-0.076275f},{-0.884529f,0.460207f,-0.0762749f},
00099 {-0.950872f,0.300042f,-0.0762748f},{-0.9735f,0.215592f,-0.0762748f},{-0.996128f,0.0437144f,-0.0762749f},
00100 {-0.996128f,-0.0437142f,-0.0762749f},{-0.9735f,-0.215592f,-0.0762748f},{-0.950872f,-0.300042f,-0.0762748f},
00101 {-0.884529f,-0.460206f,-0.0762749f},{-0.840815f,-0.535922f,-0.076275f},{-0.73528f,-0.673458f,-0.076275f},
00102 {-0.673458f,-0.73528f,-0.076275f},{-0.535922f,-0.840815f,-0.076275f},{-0.460207f,-0.884529f,-0.0762749f},
00103 {-0.300042f,-0.950872f,-0.0762748f},{-0.215592f,-0.9735f,-0.0762748f},{-0.0437144f,-0.996128f,-0.0762749f},
00104 {0.0437142f,-0.996128f,-0.0762749f},{0.215592f,-0.9735f,-0.0762748f},{0.300042f,-0.950872f,-0.0762748f},
00105 {0.460206f,-0.884529f,-0.0762749f},{0.535922f,-0.840815f,-0.076275f},{0.673458f,-0.73528f,-0.076275f},
00106 {0.73528f,-0.673458f,-0.076275f},{0.840815f,-0.535922f,-0.076275f},{0.884529f,-0.460207f,-0.0762749f},
00107 {0.950872f,-0.300042f,-0.0762748f},{0.9735f,-0.215592f,-0.0762748f},{0.996128f,-0.0437144f,-0.0762749f},
00108 {0.996128f,0.0437142f,-0.0762749f},{0.9735f,0.215592f,-0.0762748f},{0.950872f,0.300042f,-0.0762748f},
00109 {0.884529f,0.460206f,-0.0762749f},{0.840815f,0.535922f,-0.076275f},{0.73528f,0.673458f,-0.076275f},
00110 {0.673458f,0.73528f,-0.076275f}
00111 };
00112 static GLfloat textures [74][2] = {
00113 {0.447027f,0.0199667f},{0.437806f,0.0359386f},{0.441365f,0.0273456f},
00114 {0.454406f,0.0143046f},{0.436592f,0.0451599f},{0.462999f,0.0107452f},
00115 {0.437806f,0.0543814f},{0.47222f,0.00953126f},{0.441365f,0.0629743f},
00116 {0.481442f,0.0107452f},{0.447027f,0.0703533f},{0.490035f,0.0143046f},
00117 {0.454406f,0.0760153f},{0.462999f,0.0795746f},{0.497414f,0.0199667f},
00118 {0.503076f,0.0273456f},{0.47222f,0.0807887f},{0.506635f,0.0359386f},
00119 {0.481442f,0.0795746f},{0.490035f,0.0760153f},{0.507849f,0.0451599f},
00120 {0.497414f,0.0703533f},{0.506635f,0.0543814f},{0.503076f,0.0629743f},
00121 {0.624689f,0.194494f},{0.613751f,0.226675f},{0.613751f,0.194494f},
00122 {0.624689f,0.226675f},{0.635626f,0.194494f},{0.635626f,0.226675f},
00123 {0.646564f,0.194494f},{0.646564f,0.226675f},{0.657502f,0.194494f},
00124 {0.657502f,0.226675f},{0.66844f,0.194494f},{0.66844f,0.226675f},
00125 {0.679377f,0.194494f},{0.679377f,0.226675f},{0.690315f,0.194494f},
00126 {0.690315f,0.226675f},{0.701253f,0.194494f},{0.701253f,0.226675f},
00127 {0.449685f,0.194494f},{0.438747f,0.226563f},{0.438747f,0.194494f},
00128 {0.449685f,0.226675f},{0.460623f,0.194494f},{0.460623f,0.226675f},
00129 {0.47156f,0.194494f},{0.47156f,0.226675f},{0.482498f,0.194494f},
00130 {0.482498f,0.226675f},{0.493436f,0.194494f},{0.493436f,0.226675f},
00131 {0.504374f,0.194494f},{0.504374f,0.226675f},{0.515311f,0.194494f},
00132 {0.515311f,0.226675f},{0.526249f,0.194494f},{0.526249f,0.226675f},
00133 {0.537187f,0.194494f},{0.537187f,0.226675f},{0.548125f,0.194494f},
00134 {0.548125f,0.226675f},{0.559062f,0.194494f},{0.559062f,0.226675f},
00135 {0.57f,0.194494f},{0.57f,0.226675f},{0.580938f,0.194494f},
00136 {0.580938f,0.226675f},{0.591875f,0.194494f},{0.591875f,0.226675f},
00137 {0.602813f,0.194494f},{0.602813f,0.226675f}
00138 };
00139 GLint GenFeederCharge1()
00140 {
00141 int i;
00142 int j;
00143
00144 GLint lid=glGenLists(1);
00145 glNewList(lid, GL_COMPILE);
00146
00147 glBegin (GL_TRIANGLES);
00148 for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++)
00149 {
00150 for(j=0;j<3;j++)
00151 {
00152 int vi=face_indicies[i][j];
00153 int ni=face_indicies[i][j+3];
00154 int ti=face_indicies[i][j+6];
00155
00156
00157
00158
00159
00160 glNormal3f (normals[ni][1],-normals[ni][0],normals[ni][2]);
00161 glTexCoord2f(textures[ti][0],textures[ti][1]);
00162 glVertex3f (100.f*vertices[vi][1],-100.f*vertices[vi][0],100.f*vertices[vi][2]);
00163 }
00164 }
00165 glEnd ();
00166
00167 glEndList();
00168 return lid;
00169 };
00170 }