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[48][9] = {
00043
00044 {2,24,1 ,0,1,2 ,0,1,2 }, {2,25,24 ,0,3,1 ,0,3,1 }, {3,25,2 ,4,3,0 ,4,3,0 },
00045 {3,26,25 ,4,5,3 ,4,5,3 }, {4,26,3 ,6,5,4 ,6,5,4 }, {4,27,26 ,6,7,5 ,6,7,5 },
00046 {5,27,4 ,8,7,6 ,8,7,6 }, {5,28,27 ,8,9,7 ,8,9,7 }, {6,28,5 ,10,9,8 ,10,9,8 },
00047 {6,29,28 ,10,11,9 ,10,11,9 }, {7,29,6 ,12,11,10 ,12,11,10 },
00048 {7,30,29 ,12,13,11 ,12,13,11 }, {8,30,7 ,14,13,12 ,14,13,12 },
00049 {8,31,30 ,14,15,13 ,14,15,13 }, {9,31,8 ,16,15,14 ,16,15,14 },
00050 {9,32,31 ,16,17,15 ,16,17,15 }, {10,32,9 ,18,17,16 ,18,17,16 },
00051 {10,33,32 ,18,19,17 ,18,19,17 }, {11,33,10 ,20,19,18 ,20,19,18 },
00052 {11,34,33 ,20,21,19 ,20,21,19 }, {12,34,11 ,22,21,20 ,22,21,20 },
00053 {12,35,34 ,22,23,21 ,22,23,21 }, {13,35,12 ,24,23,22 ,24,23,22 },
00054 {13,36,35 ,24,25,23 ,24,25,23 }, {14,36,13 ,26,25,24 ,26,25,24 },
00055 {14,37,36 ,26,27,25 ,26,27,25 }, {15,37,14 ,28,27,26 ,28,27,26 },
00056 {15,38,37 ,28,29,27 ,28,29,27 }, {16,38,15 ,30,29,28 ,30,29,28 },
00057 {16,39,38 ,30,31,29 ,30,31,29 }, {17,39,16 ,32,31,30 ,32,31,30 },
00058 {17,40,39 ,32,33,31 ,32,33,31 }, {18,40,17 ,34,33,32 ,34,33,32 },
00059 {18,41,40 ,34,35,33 ,34,35,33 }, {19,41,18 ,36,35,34 ,36,35,34 },
00060 {19,42,41 ,36,37,35 ,36,37,35 }, {20,42,19 ,38,37,36 ,38,37,36 },
00061 {20,43,42 ,38,39,37 ,38,39,37 }, {21,43,20 ,40,39,38 ,40,41,42 },
00062 {21,44,43 ,40,41,39 ,40,43,41 }, {22,44,21 ,42,41,40 ,44,43,40 },
00063 {22,45,44 ,42,43,41 ,44,45,43 }, {23,45,22 ,44,43,42 ,46,45,44 },
00064 {23,46,45 ,44,45,43 ,46,47,45 }, {0,46,23 ,46,45,44 ,48,47,46 },
00065 {0,47,46 ,46,47,45 ,48,49,47 }, {1,47,0 ,2,47,46 ,2,49,48 },
00066 {1,24,47 ,2,1,47 ,2,1,49 }
00067 };
00068 static GLfloat vertices [48][3] = {
00069 {-0.0225f,-0.0389711f,0.00525f},{-0.0116469f,-0.0434667f,0.00525f},{0.0f,-0.045f,0.00525f},
00070 {0.0116469f,-0.0434667f,0.00525f},{0.0225f,-0.0389711f,0.00525f},{0.0318198f,-0.0318198f,0.00525f},
00071 {0.0389711f,-0.0225f,0.00525f},{0.0434667f,-0.0116469f,0.00525f},{0.045f,0.0f,0.00525f},
00072 {0.0434667f,0.0116469f,0.00525f},{0.0389711f,0.0225f,0.00525f},{0.0318198f,0.0318198f,0.00525f},
00073 {0.0225f,0.0389711f,0.00525f},{0.0116469f,0.0434667f,0.00525f},{0.0f,0.045f,0.00525f},
00074 {-0.0116469f,0.0434667f,0.00525f},{-0.0225f,0.0389711f,0.00525f},{-0.0318198f,0.0318198f,0.00525f},
00075 {-0.0389711f,0.0225f,0.00525f},{-0.0434667f,0.0116469f,0.00525f},{-0.045f,0.0f,0.00525f},
00076 {-0.0434667f,-0.0116469f,0.00525f},{-0.0389711f,-0.0225f,0.00525f},{-0.0318198f,-0.0318198f,0.00525f},
00077 {-0.0116469f,-0.0434667f,0.045875f},{0.0f,-0.045f,0.045875f},{0.0116469f,-0.0434667f,0.045875f},
00078 {0.0225f,-0.0389711f,0.045875f},{0.0318198f,-0.0318198f,0.045875f},{0.0389711f,-0.0225f,0.045875f},
00079 {0.0434667f,-0.0116469f,0.045875f},{0.045f,0.0f,0.045875f},{0.0434667f,0.0116469f,0.045875f},
00080 {0.0389711f,0.0225f,0.045875f},{0.0318198f,0.0318198f,0.045875f},{0.0225f,0.0389711f,0.045875f},
00081 {0.0116469f,0.0434667f,0.045875f},{0.0f,0.045f,0.045875f},{-0.0116469f,0.0434667f,0.045875f},
00082 {-0.0225f,0.0389711f,0.045875f},{-0.0318198f,0.0318198f,0.045875f},{-0.0389711f,0.0225f,0.045875f},
00083 {-0.0434667f,0.0116469f,0.045875f},{-0.045f,0.0f,0.045875f},{-0.0434667f,-0.0116469f,0.045875f},
00084 {-0.0389711f,-0.0225f,0.045875f},{-0.0318198f,-0.0318198f,0.045875f},{-0.0225f,-0.0389711f,0.045875f}
00085 };
00086 static GLfloat normals [48][3] = {
00087 {-0.0438419f,-0.999038f,0.0f},{-0.216222f,-0.976344f,0.0f},{-0.300918f,-0.95365f,0.0f},
00088 {0.0438419f,-0.999038f,0.0f},{0.216222f,-0.976344f,0.0f},{0.300918f,-0.95365f,0.0f},
00089 {0.461551f,-0.887114f,0.0f},{0.537487f,-0.843272f,0.0f},{0.675426f,-0.737428f,0.0f},
00090 {0.737428f,-0.675426f,0.0f},{0.843272f,-0.537487f,0.0f},{0.887114f,-0.461551f,0.0f},
00091 {0.95365f,-0.300918f,0.0f},{0.976344f,-0.216222f,0.0f},{0.999038f,-0.0438419f,0.0f},
00092 {0.999038f,0.0438419f,0.0f},{0.976344f,0.216222f,0.0f},{0.95365f,0.300918f,0.0f},
00093 {0.887114f,0.461551f,0.0f},{0.843272f,0.537487f,0.0f},{0.737428f,0.675426f,0.0f},
00094 {0.675426f,0.737428f,0.0f},{0.537487f,0.843272f,0.0f},{0.461551f,0.887114f,0.0f},
00095 {0.300918f,0.95365f,0.0f},{0.216222f,0.976344f,0.0f},{0.0438419f,0.999038f,0.0f},
00096 {-0.0438419f,0.999038f,0.0f},{-0.216222f,0.976344f,0.0f},{-0.300918f,0.95365f,0.0f},
00097 {-0.461551f,0.887114f,0.0f},{-0.537487f,0.843272f,0.0f},{-0.675426f,0.737428f,0.0f},
00098 {-0.737428f,0.675426f,0.0f},{-0.843272f,0.537487f,0.0f},{-0.887114f,0.461551f,0.0f},
00099 {-0.95365f,0.300918f,0.0f},{-0.976344f,0.216222f,0.0f},{-0.999038f,0.0438419f,0.0f},
00100 {-0.999038f,-0.0438419f,0.0f},{-0.976344f,-0.216222f,0.0f},{-0.95365f,-0.300918f,0.0f},
00101 {-0.887114f,-0.461551f,0.0f},{-0.843272f,-0.537487f,0.0f},{-0.737428f,-0.675426f,0.0f},
00102 {-0.675426f,-0.737428f,0.0f},{-0.537487f,-0.843272f,0.0f},{-0.461551f,-0.887114f,0.0f}
00103 };
00104 static GLfloat textures [50][2] = {
00105 {0.251939f,0.326379f},{0.210595f,0.428389f},{0.210595f,0.326379f},
00106 {0.251939f,0.428389f},{0.293282f,0.326379f},{0.293282f,0.428389f},
00107 {0.334626f,0.326379f},{0.334626f,0.428389f},{0.375969f,0.326379f},
00108 {0.375969f,0.428389f},{0.417313f,0.326379f},{0.417313f,0.428389f},
00109 {0.458656f,0.326379f},{0.458656f,0.428389f},{0.5f,0.326379f},
00110 {0.5f,0.428389f},{0.541343f,0.326379f},{0.541343f,0.428389f},
00111 {0.582687f,0.326379f},{0.582687f,0.428389f},{0.62403f,0.326379f},
00112 {0.62403f,0.428389f},{0.665374f,0.326379f},{0.665374f,0.428389f},
00113 {0.706717f,0.326379f},{0.706717f,0.428389f},{0.748061f,0.326379f},
00114 {0.748061f,0.428389f},{0.789404f,0.326379f},{0.789404f,0.428389f},
00115 {0.830748f,0.326379f},{0.830748f,0.428389f},{0.872092f,0.326379f},
00116 {0.872092f,0.428389f},{0.913435f,0.326379f},{0.913435f,0.428389f},
00117 {0.954778f,0.326379f},{0.954778f,0.428389f},{0.996122f,0.326379f},
00118 {0.996122f,0.428389f},{0.0452214f,0.326379f},{0.00387793f,0.427763f},
00119 {0.00387793f,0.326379f},{0.0452214f,0.428389f},{0.086565f,0.326379f},
00120 {0.086565f,0.428389f},{0.127908f,0.326379f},{0.127908f,0.428389f},
00121 {0.169252f,0.326379f},{0.169252f,0.428389f}
00122 };
00123
00124 GLint GenFeederRing()
00125 {
00126 int i;
00127 int j;
00128
00129 GLint lid=glGenLists(1);
00130 glNewList(lid, GL_COMPILE);
00131
00132 glBegin (GL_TRIANGLES);
00133 for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++)
00134 {
00135 for(j=0;j<3;j++)
00136 {
00137 int vi=face_indicies[i][j];
00138 int ni=face_indicies[i][j+3];
00139 int ti=face_indicies[i][j+6];
00140
00141
00142
00143
00144
00145 glNormal3f (normals[ni][1],-normals[ni][0],normals[ni][2]);
00146 glTexCoord2f(textures[ti][0],textures[ti][1]);
00147 glVertex3f (100.f*vertices[vi][1],-100.f*vertices[vi][0],100.f*vertices[vi][2]);
00148 }
00149 }
00150 glEnd ();
00151
00152 glEndList();
00153 return lid;
00154 };
00155 }