1 /*
2 * Compiz cube atlantis plugin
3 *
4 * atlantis.c
5 *
6 * This plugin renders a fish tank inside of the transparent cube,
7 * replete with fish, crabs, sand, bubbles, and coral.
8 *
9 * Copyright : (C) 2007-2008 by David Mikos
10 * Email : infiniteloopcounter@gmail.com
11 *
12 * Copyright : (C) 2007 by Dennis Kasprzyk
13 * E-mail : onestone@opencompositing.org
14 *
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 */
27
28 /*
29 * This file is part of an automatically generated output from
30 * executing objToC.java on a .obj 3D model. The output was
31 * split manually into this code and a header with model data.
32 */
33
34 #include "atlantis-internal.h"
35 #include "bfish.h"
36
37 void
AnimateBFish(float t)38 AnimateBFish(float t)
39 {
40 int ti = (int) t;
41 float w = 2*PI*(t-ti);
42 BFishPoints[2+3*0] =-82.18+402.5359*sinf(w-6.242932);
43 BFishPoints[2+3*1] =-37.912+1161.102*sinf(w-6.167075);
44 BFishPoints[2+3*2] =87.136+1161.478*sinf(w-6.1670375);
45 BFishPoints[2+3*3] =149.72+403.23584*sinf(w-6.2428617);
46 BFishPoints[2+3*4] =-212.568+139.08008*sinf(w-6.269277);
47 BFishPoints[2+3*5] =286.456+140.58594*sinf(w-6.269127);
48 BFishPoints[2+3*6] =89.54+1315.0881*sinf(w-6.1516767);
49 BFishPoints[2+3*7] =302.104+303.52002*sinf(w-6.2528334);
50 BFishPoints[2+3*9] =-232.14801+301.90796*sinf(w-6.2529945);
51 BFishPoints[2+3*10] =-44.024002+1314.686*sinf(w-6.1517167);
52 BFishPoints[2+3*12] =93.287994+1153.2058*sinf(w-6.167865);
53 BFishPoints[2+3*13] =235.864+407.18384*sinf(w-6.242467);
54 BFishPoints[2+3*14] =239.892+73.65991*sinf(w-6.2758193);
55 BFishPoints[2+3*15] =-43.864002+1152.792*sinf(w-6.1679063);
56 BFishPoints[2+3*16] =-168.416+405.96387*sinf(w-6.242589);
57 BFishPoints[2+3*17] =-164.388+72.43994*sinf(w-6.2759414);
58 BFishPoints[2+3*18] =57.148+1017.93384*sinf(w-6.1813917);
59 BFishPoints[2+3*19] =-4.464+1017.74805*sinf(w-6.1814103);
60 BFishPoints[2+3*21] =-42.984+110.73413*sinf(w-6.272112);
61 BFishPoints[2+3*22] =117.572+111.21997*sinf(w-6.2720633);
62 BFishPoints[2+3*24] =60.792+716.166*sinf(w-6.211569);
63 BFishPoints[2+3*25] =287.344+66.98584*sinf(w-6.276487);
64 BFishPoints[2+3*26] =-211.68+65.47998*sinf(w-6.276637);
65 BFishPoints[2+3*27] =-0.82+715.98*sinf(w-6.2115874);
66 BFishPoints[2+3*34] =5.0039997+265.08203*sinf(w-6.256677);
67 BFishPoints[2+3*36] =-3.632+980.5979*sinf(w-6.1851254);
68 BFishPoints[2+3*44] =65.856+265.26587*sinf(w-6.2566586);
69 BFishPoints[2+3*45] =57.216+980.782*sinf(w-6.185107);
70 BFishPoints[2+3*46] =287.344+66.98584*sinf(w-6.276487);
71 BFishPoints[2+3*47] =286.456+140.58398*sinf(w-6.269127);
72 BFishPoints[2+3*52] =-212.568+139.07788*sinf(w-6.2692776);
73 BFishPoints[2+3*53] =-211.68+65.47998*sinf(w-6.276637);
74 BFishPoints[2+3*74] =239.892+73.65991*sinf(w-6.2758193);
75 BFishPoints[2+3*77] =-164.388+72.43994*sinf(w-6.2759414);
76 BFishPoints[2+3*125] =-37.912+1161.0999*sinf(w-6.167075);
77 BFishPoints[2+3*126] =22.928+1309.362*sinf(w-6.1522493);
78 BFishPoints[2+3*127] =87.136+1161.478*sinf(w-6.1670375);
79 BFishPoints[2+3*128] =20.880001+1475.4539*sinf(w-6.13564);
80 BFishPoints[2+3*129] =89.54+1315.0881*sinf(w-6.1516767);
81 BFishPoints[2+3*130] =22.88+1301.7122*sinf(w-6.153014);
82 BFishPoints[2+3*131] =93.287994+1153.2058*sinf(w-6.167865);
83 BFishPoints[2+3*132] =-43.864002+1152.792*sinf(w-6.1679063);
84 BFishPoints[2+3*133] =-44.024002+1314.6841*sinf(w-6.1517167);
85 BFishPoints[2+3*134] =57.148+1017.9319*sinf(w-6.181392);
86 BFishPoints[2+3*135] =24.852+1141.512*sinf(w-6.169034);
87 BFishPoints[2+3*136] =-4.464+1017.7461*sinf(w-6.181411);
88 BFishPoints[2+3*137] =-42.984+110.73413*sinf(w-6.272112);
89 BFishPoints[2+3*138] =35.332+273.35596*sinf(w-6.25585);
90 BFishPoints[2+3*139] =117.572+111.21802*sinf(w-6.2720637);
91 BFishPoints[2+3*140] =28.880001+807.60596*sinf(w-6.2024245);
92 BFishPoints[2+3*141] =60.792+716.166*sinf(w-6.211569);
93 BFishPoints[2+3*142] =-0.82+715.98*sinf(w-6.2115874);
94 BFishPoints[2+3*143] =-3.632+980.59985*sinf(w-6.1851254);
95 BFishPoints[2+3*144] =24.852+1141.512*sinf(w-6.169034);
96 BFishPoints[2+3*145] =57.216+980.782*sinf(w-6.185107);
97 BFishPoints[2+3*149] =65.856+265.26587*sinf(w-6.2566586);
98 BFishPoints[2+3*150] =33.72+406.91992*sinf(w-6.242493);
99 BFishPoints[2+3*155] =5.0039997+265.08203*sinf(w-6.256677);
100 }
101
102
103 void
DrawAnimatedBFish()104 DrawAnimatedBFish()
105 {
106 glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT);
107 glEnableClientState(GL_NORMAL_ARRAY);
108 glEnableClientState(GL_VERTEX_ARRAY);
109 glVertexPointer (3, GL_FLOAT, 0, BFishPoints);
110 glNormalPointer (GL_FLOAT, 0, BFishNormals);
111
112 //26/yellow:body_9_up_Mesh.024
113 glDisable (GL_COLOR_MATERIAL);
114 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
115 glMaterialfv (GL_FRONT, GL_SHININESS, fin_shininess);
116 glMaterialfv (GL_FRONT, GL_AMBIENT, fin_ambient);
117 glMaterialfv (GL_FRONT, GL_DIFFUSE, fin_diffuse);
118 glMaterialfv (GL_FRONT, GL_SPECULAR, fin_specular);
119 glDrawElements(GL_QUADS, 112, GL_UNSIGNED_INT, &(BFishIndices[0]));
120
121 //19/yellow:body_5_low_Mesh.017
122 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
123 glMaterialfv (GL_FRONT, GL_SHININESS, UserDefined_body_shininess);
124 glMaterialfv (GL_FRONT, GL_AMBIENT, UserDefined_body_ambient);
125 glMaterialfv (GL_FRONT, GL_DIFFUSE, UserDefined_body_diffuse);
126 glMaterialfv (GL_FRONT, GL_SPECULAR, UserDefined_body_specular);
127 glDrawElements(GL_QUADS, 120, GL_UNSIGNED_INT, &(BFishIndices[112]));
128
129 //13/black:body_2_Mesh.011
130 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
131 glMaterialfv (GL_FRONT, GL_SHININESS, shadow_shininess);
132 glMaterialfv (GL_FRONT, GL_AMBIENT, shadow_ambient);
133 glMaterialfv (GL_FRONT, GL_DIFFUSE, shadow_diffuse);
134 glMaterialfv (GL_FRONT, GL_SPECULAR, shadow_specular);
135 glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, &(BFishIndices[232]));
136
137 //12/yellow:body_1_Mesh.010
138 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
139 glMaterialfv (GL_FRONT, GL_SHININESS, UserDefined_body_shininess);
140 glMaterialfv (GL_FRONT, GL_AMBIENT, UserDefined_body_ambient);
141 glMaterialfv (GL_FRONT, GL_DIFFUSE, UserDefined_body_diffuse);
142 glMaterialfv (GL_FRONT, GL_SPECULAR, UserDefined_body_specular);
143 glDrawElements(GL_QUADS, 72, GL_UNSIGNED_INT, &(BFishIndices[256]));
144
145 glDrawElements(GL_TRIANGLES, 18, GL_UNSIGNED_INT, &(BFishIndices[328]));
146
147 //9/black:upper_Mesh.007
148 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
149 glMaterialfv (GL_FRONT, GL_SHININESS, shadow_shininess);
150 glMaterialfv (GL_FRONT, GL_AMBIENT, shadow_ambient);
151 glMaterialfv (GL_FRONT, GL_DIFFUSE, shadow_diffuse);
152 glMaterialfv (GL_FRONT, GL_SPECULAR, shadow_specular);
153 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &(BFishIndices[346]));
154
155 glDrawElements(GL_QUADS, 8, GL_UNSIGNED_INT, &(BFishIndices[349]));
156
157 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &(BFishIndices[357]));
158
159 glDrawElements(GL_QUADS, 8, GL_UNSIGNED_INT, &(BFishIndices[360]));
160
161 glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, &(BFishIndices[368]));
162
163 glDrawElements(GL_QUADS, 16, GL_UNSIGNED_INT, &(BFishIndices[374]));
164
165 glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, &(BFishIndices[390]));
166
167 glDrawElements(GL_QUADS, 32, GL_UNSIGNED_INT, &(BFishIndices[396]));
168
169 //6/yellow:side_Mesh.004
170 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
171 glLightModelf (GL_LIGHT_MODEL_TWO_SIDE, 1.0f);
172 glDisable(GL_CULL_FACE);
173 glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, userDefined_DS_fin_shininess);
174 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, userDefined_DS_fin_ambient);
175 glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, userDefined_DS_fin_diffuse);
176 glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, userDefined_DS_fin_specular);
177 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &(BFishIndices[428]));
178
179 glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, &(BFishIndices[431]));
180
181 glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, &(BFishIndices[435]));
182
183 glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, &(BFishIndices[441]));
184
185 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &(BFishIndices[445]));
186
187 //4/black:black_Mesh.002
188 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
189 glLightModelf (GL_LIGHT_MODEL_TWO_SIDE, 0.0f);
190 glEnable(GL_CULL_FACE);
191 glMaterialfv (GL_FRONT, GL_SHININESS, shadow_shininess);
192 glMaterialfv (GL_FRONT, GL_AMBIENT, shadow_ambient);
193 glMaterialfv (GL_FRONT, GL_DIFFUSE, shadow_diffuse);
194 glMaterialfv (GL_FRONT, GL_SPECULAR, shadow_specular);
195 glDrawElements(GL_QUADS, 8, GL_UNSIGNED_INT, &(BFishIndices[448]));
196
197 //2/white:white_Mesh
198 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
199 glMaterialfv (GL_FRONT, GL_SHININESS, eyeborder_shininess);
200 glMaterialfv (GL_FRONT, GL_AMBIENT, eyeborder_ambient);
201 glMaterialfv (GL_FRONT, GL_DIFFUSE, eyeborder_diffuse);
202 glMaterialfv (GL_FRONT, GL_SPECULAR, eyeborder_specular);
203 glDrawElements(GL_QUADS, 8, GL_UNSIGNED_INT, &(BFishIndices[456]));
204 glDisableClientState (GL_NORMAL_ARRAY);
205 glPopAttrib();
206 }
207
208 void
initDrawBFish(float * color)209 initDrawBFish(float *color)
210 {
211 glRotatef(180.0, 0.0, 1.0, 0.0);
212 glRotatef(90.0, 0.0, 1.0, 0.0);
213 glEnable(GL_CULL_FACE);
214
215 copyColor((float *)UserDefined_body_ambient, color, 0.8);
216 copyColor((float *)UserDefined_body_diffuse, color, 0.8);
217 copyColor((float *)UserDefined_body_specular, color, 0.1);
218 }
219
220 void
finDrawBFish()221 finDrawBFish()
222 {
223 glDisable(GL_CULL_FACE);
224 }
225
226
227