Moved little cms from contrib to core. Need for parsing of ICC files.
[AROS-Contrib.git] / Demo / GLExcess / scene02.cpp
blob3ab066c012ddd20d8a57e86b9ac0500921674bde
1 /*
2 GLExcess v1.0 Demo
3 Copyright (C) 2001-2003 Paolo Martella
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
16 #ifdef WIN32
17 #include <windows.h>
18 #endif
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <math.h>
23 #include <GL/gl.h>
24 #include <GL/glu.h>
25 #include <GL/glut.h>
26 #include "Texture.h"
27 #include "scene02.h"
29 static GLuint width=800;
30 static GLuint height=600;
31 static bool init=true;
32 static bool first=true;
33 static GLfloat a_time=0.0f;
35 static Texture* a_Text;
36 static GLuint numtexs=5;
38 static long a_gets=0;
39 static int a_timecyc;
41 static bool switcher=false;
42 static float gendep=1.55;
43 static const int size=64;
44 static float norm[size][size][3];
45 static float a_points[size][size][3];
46 static float camera[3]={-12.8,12.8,5};
47 static float cameraray[3];
48 static float rray[3];
49 static float newcoord[size][size][2];
50 static GLfloat coeff=7.1f;
51 static int a_x, a_y;
52 static float a_float_x, a_float_y, a_float_xb, a_float_yb;
53 static GLfloat a_xrot;
54 static GLfloat a_yrot;
55 static GLfloat a_zrot;
56 static GLfloat a_rad=0.0f;
57 static GLfloat quantos=-1.0f;
58 static GLfloat a_zeta=-1.0f;
59 static GLfloat a_factor=10.0f;
61 static const int a_num=200;
62 static int a_waves=0;
64 typedef struct
66 GLfloat a_x,a_y,z;
67 GLfloat a_mod;
68 GLfloat speed,speedlim;
69 int r,g,b,a;
70 int angle;
71 int time;
73 a_part;
75 static a_part parts[a_num];
77 static int a_az;
78 static GLfloat a_counter=0;
79 static GLfloat a_mod;
80 static int a_xa,a_ya;
82 static GLfloat a_diffuse[]= {0.2f, 0.2f, 0.2f, 1.0f};
83 static GLfloat a_ambient[]= {0.1f, 0.1f, 0.1f, 1.0f};
84 static GLfloat a_specular[]= {.750f, .750f, .750f, 1.0f};
85 static GLfloat a_emission[]= {0.2f, 0.2f, 0.2f, 1.0f};
87 static GLfloat a_shininess = 10.0f;
89 static GLfloat a_LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
90 static GLfloat a_LightDiffuse[]= { 0.5f, 0.5f, 0.5f, 1.0f };
91 static GLfloat a_LightSpecular[]= { .5f, .5f, .5f, 1.0f };
92 static GLfloat a_LightPosition[]= { 0.0f, 8.0f, -20.0f, 1.0f };
93 static GLfloat a_Sinus[3];
96 void copy(float vec0[3], float vec1[3])
98 vec0[0] = vec1[0];
99 vec0[1] = vec1[1];
100 vec0[2] = vec1[2];
103 void sub(float vec0[3], float vec1[3], float vec2[3])
105 vec0[0] = vec1[0] - vec2[0];
106 vec0[1] = vec1[1] - vec2[1];
107 vec0[2] = vec1[2] - vec2[2];
110 void add(float vec0[3], float vec1[3], float vec2[3])
112 vec0[0] = vec1[0] + vec2[0];
113 vec0[1] = vec1[1] + vec2[1];
114 vec0[2] = vec1[2] + vec2[2];
117 void scalDiv(float vec[3], float c)
119 vec[0] /= c; vec[1] /= c; vec[2] /= c;
122 void cross(float vec0[3], float vec1[3], float vec2[3])
124 vec0[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
125 vec0[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
126 vec0[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
129 void normz(float vec[3])
131 float c = sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
132 scalDiv(vec, c);
135 void set(float vec[3], float x, float y, float z)
137 vec[0] = x;
138 vec[1] = y;
139 vec[2] = z;
143 void MakeNorm(void)
145 int i, j;
146 float a[3],b[3],c[3];
148 for(i=0; i<size; i++)
149 for(j=0; j<size; j++)
151 if (i!=size-1 && j!=size-1)
153 sub(a, a_points[i][j+1], a_points[i][j]);
154 sub(b, a_points[i+1][j], a_points[i][j]);
156 else
158 sub(a, a_points[i][j-1], a_points[i][j]);
159 sub(b, a_points[i-1][j], a_points[i][j]);
162 cross(c, a, b);
163 normz(c);
165 if (i==0 && j==size-1)
167 sub(a, a_points[i][j-1], a_points[i][j]);
168 sub(b, a_points[i+1][j], a_points[i][j]);
170 cross(c, a, b);
171 normz(c);
173 c[0]=-c[0]; c[1]=-c[1]; c[2]=-c[2];
176 if (i==size-1 && j==0)
178 sub(a, a_points[i-1][j], a_points[i][j]);
179 sub(b, a_points[i][j+1], a_points[i][j]);
181 cross(c, a, b);
182 normz(c);
185 copy(norm[i][j], c);
188 void a_setpart();
189 void a_InitGL()
191 glDisable(GL_LIGHT0);
192 a_time=2.0;
193 a_gets=0;a_timecyc=0;
194 gendep=1.55;
195 cameraray[0]=0;cameraray[1]=0;cameraray[2]=0;
196 rray[0]=0;rray[1]=0;rray[2]=0;
197 a_x=0;a_y=0;a_float_x=0;a_float_y=0;a_float_xb=0;a_float_yb=0;
198 a_xrot=0;a_yrot=0;a_zrot=0;a_rad=0.0f;
199 quantos=-1.0f;
200 a_zeta=-1.0f;
201 a_factor=10.0f;
202 a_time=2.0f;
203 a_waves=0;
204 a_az=0;
205 a_counter=0;
206 a_mod=0;
207 a_xa=0;a_ya=0;
209 a_mod=0;
210 a_xa=0;a_ya=0;
211 a_diffuse[0]=0.2f;a_diffuse[1]=0.2f;a_diffuse[2]=0.2f;a_diffuse[3]=1.0f;
212 a_ambient[0]=0.1f;a_ambient[1]=0.1f;a_ambient[2]=0.1f;a_ambient[3]=1.0f;
213 a_specular[0]=.75f;a_specular[1]=.75f;a_specular[2]=.75f;a_specular[3]=1.0f;
214 a_emission[0]=0.2f;a_emission[1]=0.2f;a_emission[2]=0.2f;a_emission[3]=1.0f;
216 a_shininess = 10.0f;
218 a_LightAmbient[0]=0.5f;a_LightAmbient[1]=0.5f;a_LightAmbient[2]=0.5f;a_LightAmbient[3]=1.0f;
219 a_LightDiffuse[0]=0.5f;a_LightDiffuse[1]=0.5f;a_LightDiffuse[2]=0.5f;a_LightDiffuse[3]=1.0f;
220 a_LightSpecular[0]=.5f;a_LightSpecular[1]=.5f;a_LightSpecular[2]=.5f;a_LightSpecular[3]=1.0f;
221 a_LightPosition[0]=0.0f;a_LightPosition[1]=8.0f;a_LightPosition[2]=-20.0f;a_LightPosition[3]=1.0f;
222 a_Sinus[0]=0;
223 a_Sinus[1]=0;
224 a_Sinus[2]=0;
226 a_xrot=0;
227 a_yrot=0;
228 a_zrot=0;
229 a_counter=0;
231 a_rad=0.0f;
232 quantos=-1.0f;
233 a_zeta=-1.0f;
234 a_factor=10.0f;
236 a_waves=0;
237 a_counter=0;
238 coeff=7.1f;
239 a_gets=0;
240 switcher=false;
241 gendep=1.55;
243 camera[0]=-12.8;
244 camera[1]=12.8;
245 camera[2]=5;
247 glMatrixMode(GL_PROJECTION);
248 glLoadIdentity();
249 gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
250 glMatrixMode(GL_MODELVIEW);
251 glLoadIdentity();
253 glShadeModel(GL_SMOOTH);
254 glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
255 glClearDepth(1.0f);
256 glEnable(GL_DEPTH_TEST);
257 glDepthFunc(GL_LEQUAL);
258 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
261 a_Text=new Texture[numtexs];
262 a_Text[1].Load("data/logoxs.raw");
263 a_Text[2].Load("data/white.raw");
264 a_Text[3].Load("data/sun2.raw");
265 a_Text[4].Load("data/star.raw");
267 glEnable (GL_LIGHTING);
268 glEnable (GL_LIGHT1);
270 glLightfv(GL_LIGHT1,GL_DIFFUSE,a_LightDiffuse);
271 glLightfv(GL_LIGHT1,GL_AMBIENT,a_LightAmbient);
272 glLightfv(GL_LIGHT1,GL_SPECULAR,a_LightSpecular);
273 glLightfv(GL_LIGHT1,GL_POSITION,a_LightPosition);
275 glMaterialfv(GL_FRONT,GL_DIFFUSE,a_diffuse);
276 glMaterialfv(GL_FRONT,GL_AMBIENT,a_ambient);
277 glMaterialfv(GL_FRONT,GL_SPECULAR,a_specular);
278 glMaterialf(GL_FRONT,GL_SHININESS,10.0f);
280 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
281 glEnable(GL_TEXTURE_2D);
282 for (int a_x=0;a_x<size;a_x++)
284 for (int a_y=0; a_y<size;a_y++)
286 a_points[a_x][a_y][0]=float(a_x/(1.25f*size/32));
287 a_points[a_x][a_y][1]=float(a_y/(1.25f*size/32));
288 a_points[a_x][a_y][2]=0.0;
292 for (int p=0; p<a_num; p++)
294 parts[p].r=128+rand()%128;
295 parts[p].g=128+rand()%128;
296 parts[p].b=128+rand()%128;
297 parts[p].a=-1;
298 parts[p].angle=rand()%90;
299 parts[p].a_mod=0.0f;
300 parts[p].speedlim=.005+.0001*((GLfloat)(rand()%1000));
301 parts[p].speed=parts[p].speedlim;
302 parts[p].a_x=0.0f;
303 parts[p].a_y=0.0f;
304 parts[p].z=0.0f;
307 a_mod=1.0;
308 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
309 glEnable(GL_BLEND);
311 glDisable(GL_DEPTH_TEST);
312 a_setpart();
315 void a_Clean(void)
317 a_Text[1].Kill();
318 a_Text[2].Kill();
319 a_Text[3].Kill();
320 a_Text[4].Kill();
321 delete [] a_Text;
322 init=true;
325 void a_setpart(void)
327 int time=(int)a_time*500-2;//**********************************************
328 a_timecyc=time;
329 for (int a=0; a<a_num; a++)
330 parts[a].time=time;
333 void a_drawquad(GLfloat size)
335 glBegin(GL_QUADS);
336 glTexCoord2f(0.0f, 0.0f);
337 glVertex3f(-.5*size,-.5*size,0);
338 glTexCoord2f(1.0f, 0.0f);
339 glVertex3f(-.5*size,.5*size,0);
340 glTexCoord2f(1.0f, 1.0f);
341 glVertex3f(.5*size,.5*size,0);
342 glTexCoord2f(0.0f, 1.0f);
343 glVertex3f(.5*size,-.5*size,0);
344 glEnd();
347 void calcul(int xx,int yy)
349 if ((xx==0)&&(yy==0)) MakeNorm();
350 sub(cameraray,camera,a_points[xx][yy]);
351 normz(cameraray);
352 rray[0]=norm[xx][yy][0]*coeff+cameraray[0];
353 rray[1]=norm[xx][yy][1]*coeff+cameraray[1];
354 rray[2]=norm[xx][yy][2]*coeff+cameraray[2];
355 scalDiv(rray,-1);
356 normz(rray);
358 GLfloat depth=gendep+a_points[xx][yy][2];
359 GLfloat t=depth/rray[2];
360 GLfloat mapx=a_points[xx][yy][0]+rray[0]*t;
361 GLfloat mapz=a_points[xx][yy][1]+rray[1]*t;
363 newcoord[xx][yy][0]=-(mapx-a_points[0][0][0])/25.6;
364 newcoord[xx][yy][1]=(mapz-a_points[size][size][1])/25.6;
368 bool a_DrawGLScene(GLfloat globtime)
370 if (init) {a_InitGL();init=false;}
371 a_time=2.0+globtime*.01;
372 // MOTION
373 if (a_time<10.0f)
375 a_zeta=25.0f*cos((3.1415f/2.0f)*(1+a_time/10.0f));
376 a_xrot=-45.0f*cos((3.1415f/2.0f)*(1+a_time/10.0f));
378 else
380 a_xrot=45.0f-30.0f*sin((a_time-10.0f)/20.0f)*sin((a_time-10.0f)/20.0f);
381 a_zrot=360.0f*sin((a_time-10.0f)/50.0f)*sin((a_time-10.0f)/50.0f);
382 a_zeta=-25.0f+5.0f*sin((a_time-10.0f)/10.0f)*sin((a_time-10.0f)/10.0f);
385 if (a_time>90.0f) a_zeta=-20.0f+10.0f*(1.0f-cos((a_time-90.0f)*3.1415f/10.0f));
387 if (a_zeta>-2.5f) a_zeta=-2.5f;
388 a_factor=(a_xrot/.5+20)/50.0f;
390 if (a_mod>0.5f) a_mod=1.0-.03f*(a_time-a_gets); else a_mod=.5-0.015f*(a_time-a_gets);
391 if (a_mod<0.0f) a_mod=0.0f;
392 glDisable(GL_TEXTURE_2D);
393 glLoadIdentity();
394 glTranslatef(0,0,-5);
395 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
396 if (a_zeta>-20.0f) glColor4f(0,0,0,-(a_zeta+20.0f)/40.0f+.25f);
397 else glColor4f(0,0,0,.25f);
398 glDisable(GL_LIGHTING);
399 glEnable(GL_BLEND);
400 a_drawquad(6);
401 if (first)//a_time<3.01f)
403 glDisable(GL_BLEND);
404 glColor4ub(255,255,255,255);
405 a_drawquad(6);
406 glEnable(GL_BLEND);
407 first=false;
409 if (a_time>95.0f)
411 glColor4f(1.0f,1.0f,1.0f,(a_time-95.0f)/1.5f);
412 a_drawquad(6);
414 glEnable(GL_TEXTURE_2D);
415 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
416 glEnable(GL_LIGHTING);
417 glLoadIdentity();
418 if (a_time>30.0) glTranslatef(0.0f,1.5f,a_zeta);
419 else glTranslatef(0.0f,.5+.5f*(1.0-cos((a_time-2.0f)*3.1415f/28.0f)),a_zeta);
420 glRotatef(-90+2*a_xrot,1.0f,0.0f,0.0f);
421 glRotatef(a_yrot,0.0f,1.0f,0.0f);
422 glRotatef(a_zrot,0.0f,0.0f,1.0f);
425 for (int a_xx=0; a_xx<size; a_xx++) for (int a_yy=0; a_yy<size; a_yy++)
427 double raggio;
428 double value;
429 double arg;
431 if (quantos>0.0f)
433 raggio=.5*sqrt((double)((a_points[a_xx][a_yy][0]-a_points[size/2][size/2][0])*(a_points[a_xx][a_yy][0]-a_points[size/2][size/2][0])
434 +(a_points[a_xx][a_yy][1]-a_points[size/2][size/2][1])*(a_points[a_xx][a_yy][1]-a_points[size/2][size/2][1])));
435 arg=2.5*raggio-quantos*2+30;
436 if ((arg<-2*6.28)||(arg>4*6.28)) value=0; else
437 value=.05*sin(arg)*sin(arg)*exp(arg/7);
438 a_points[a_xx][a_yy][2]=value;
440 if (quantos>10)
442 raggio=.5*sqrt((double)((a_points[a_xx][a_yy][0]-a_points[48][48][0])*(a_points[a_xx][a_yy][0]-a_points[48][48][0])
443 +(a_points[a_xx][a_yy][1]-a_points[48][48][1])*(a_points[a_xx][a_yy][1]-a_points[48][48][1])));
444 arg=2.5*raggio-(quantos-10)*3+30;
445 if ((arg<-2*6.28)||(arg>4*6.28)) value=0; else
446 value=.025*sin(arg)*sin(arg)*exp(arg/7);
447 a_points[a_xx][a_yy][2]+=value;
449 if (quantos>24)
451 raggio=.5*sqrt((double)((a_points[a_xx][a_yy][0]-a_points[50][22][0])*(a_points[a_xx][a_yy][0]-a_points[50][22][0])
452 +(a_points[a_xx][a_yy][1]-a_points[50][22][1])*(a_points[a_xx][a_yy][1]-a_points[50][22][1])));
453 arg=3.0*raggio-(quantos-24)*4+30;
454 if ((arg<-2*6.28)||(arg>4*6.28)) value=0; else
455 value=.02*sin(arg)*sin(arg)*exp(arg/7);
456 a_points[a_xx][a_yy][2]+=value;
458 if (quantos>32)
460 raggio=.5*sqrt((double)((a_points[a_xx][a_yy][0]-a_points[32][32][0])*(a_points[a_xx][a_yy][0]-a_points[32][32][0])
461 +(a_points[a_xx][a_yy][1]-a_points[32][32][1])*(a_points[a_xx][a_yy][1]-a_points[32][32][1])));
462 arg=2.5*raggio-(quantos-32)*3+30;
463 if ((arg<0*6.28)||(arg>4*6.28)) value=0; else
464 value=.035*sin(arg)*sin(arg)*exp(arg/7);
465 a_points[a_xx][a_yy][2]+=value;
468 calcul(a_xx,a_yy);
470 if (a_time>34.0f) quantos=2.0+(a_time-34.0)/1.5f;
472 a_Text[1].Use();
473 glMaterialfv(GL_FRONT,GL_DIFFUSE,a_diffuse);
474 glMaterialfv(GL_FRONT,GL_AMBIENT,a_ambient);
475 glMaterialfv(GL_FRONT,GL_SPECULAR,a_specular);
476 glMaterialf(GL_FRONT,GL_SHININESS,10.0f);
477 glPushMatrix();
478 //glDisable(GL_LIGHTING);
479 glScalef(-1,-1,1);
480 glColor4f(1,1,1,1);
482 glPushMatrix();
483 glTranslatef(-12.8,12.8,0);
487 glNormal3f(0,0,1);
488 for (int cc=0; cc<1; cc++)
490 if ((cc%2)==0)
492 glScalef(1,-1,1);
493 glFrontFace(GL_CCW);
495 else
497 glScalef(-1,1,1);
498 glFrontFace(GL_CW);
500 glBegin(GL_QUADS);
501 for( a_x = 0; a_x < size-1; a_x++ )
503 if (1)//a_x%2==0)
505 for( a_y = 0; a_y < size-1; a_y++ )
507 glTexCoord2f(newcoord[a_x][a_y][0],newcoord[a_x][a_y][1]);
508 //glNormal3f(-norm[a_x][a_y][0],-norm[a_x][a_y][1],-norm[a_x][a_y][2]);
509 glVertex3f( a_points[a_x][a_y][0], a_points[a_x][a_y][1], a_points[a_x][a_y][2]);
511 glTexCoord2f(newcoord[a_x][a_y+1][0],newcoord[a_x][a_y+1][1]);
512 //glNormal3f(-norm[a_x][a_y+1][0],-norm[a_x][a_y+1][1],-norm[a_x][a_y+1][2]);
513 glVertex3f( a_points[a_x][a_y+1][0], a_points[a_x][a_y+1][1], a_points[a_x][a_y+1][2]);
515 glTexCoord2f(newcoord[a_x+1][a_y+1][0],newcoord[a_x+1][a_y+1][1]);
516 //glNormal3f(-norm[a_x+1][a_y+1][0],-norm[a_x+1][a_y+1][1],-norm[a_x+1][a_y+1][2]);
517 glVertex3f( a_points[a_x+1][a_y+1][0], a_points[a_x+1][a_y+1][1], a_points[a_x+1][a_y+1][2]);
519 glTexCoord2f(newcoord[a_x+1][a_y][0],newcoord[a_x+1][a_y][1]);
520 //glNormal3f(-norm[a_x+1][a_y][0],-norm[a_x+1][a_y][1],-norm[a_x+1][a_y][2]);
521 glVertex3f( a_points[a_x+1][a_y][0], a_points[a_x+1][a_y][1], a_points[a_x+1][a_y][2]);
524 else
526 for(a_y=size-2;a_y>=0;a_y--)
528 glTexCoord2f(newcoord[a_x][a_y][0],newcoord[a_x][a_y][1]);
529 glVertex3f( a_points[a_x][a_y][0], a_points[a_x][a_y][1], a_points[a_x][a_y][2]);
531 glTexCoord2f(newcoord[a_x][a_y+1][0],newcoord[a_x][a_y+1][1]);
532 glVertex3f( a_points[a_x][a_y+1][0], a_points[a_x][a_y+1][1], a_points[a_x][a_y+1][2]);
534 glTexCoord2f(newcoord[a_x+1][a_y+1][0],newcoord[a_x+1][a_y+1][1]);
535 glVertex3f( a_points[a_x+1][a_y+1][0], a_points[a_x+1][a_y+1][1], a_points[a_x+1][a_y+1][2]);
537 glTexCoord2f(newcoord[a_x+1][a_y][0],newcoord[a_x+1][a_y][1]);
538 glVertex3f( a_points[a_x+1][a_y][0], a_points[a_x+1][a_y][1], a_points[a_x+1][a_y][2]);
542 glEnd();
544 glPushMatrix();
545 glDisable(GL_DEPTH_TEST);
546 glPopMatrix();
547 glDisable(GL_LIGHTING);
548 a_Text[4].Use();
549 a_counter=a_time*10.0f;
551 for (int p=0; p<a_num; p++)
553 GLfloat time;
554 time=a_time*500-2.0-parts[p].time;//********************************************************
555 glPushMatrix();
556 glTranslatef(parts[p].a_x,parts[p].a_y,parts[p].z);
557 glRotatef(-a_zrot,0,0,1);
558 glRotatef(90-2.0f*a_xrot,1,0,0);
559 glRotatef(parts[p].angle-135,0,0,1);
560 glTranslatef(parts[p].a_mod,0,0);
562 if (a_time<20.0f) glColor4ub(parts[p].r,parts[p].g,parts[p].b,(unsigned char)((parts[p].a-(int)((GLfloat)time/8.0f))*(a_time-6.0)/14.0));
563 else glColor4ub(parts[p].r,parts[p].g,parts[p].b,(unsigned char)(parts[p].a-(int)((GLfloat)time/8.0f)));
565 if (a_time>6.0) a_drawquad(1.125f-.75*p/a_num);
566 parts[p].a_mod=parts[p].speed*time/35.0f;
567 parts[p].speed=parts[p].speedlim-time/2500000.0f;
568 if (parts[p].speed<0.005f) parts[p].speed=0.005f;
569 if (parts[p].a-(int)((GLfloat)time/8.0f)<3)
572 parts[p].a_x=10.0f*sin(a_counter*4.0f*3.14f/360.0f);
573 parts[p].a_y=0.0f+10.0f*sin(a_counter*2*3.14/360.0);
574 parts[p].z=a_Sinus[2]=3.0f-2.5f*cos(a_counter*8.0f*3.14f/360.0f);
575 parts[p].r=128+rand()%128;
576 parts[p].g=128+rand()%128;
577 parts[p].b=128+rand()%128;
578 parts[p].a=rand()%255;
579 parts[p].a_mod=0.0f;
580 parts[p].speedlim=.005+.0001*((GLfloat)(rand()%1000));
581 parts[p].speed=parts[p].speedlim;
582 parts[p].time=(int)(a_time*500-2);//*********************************
585 glPopMatrix();
587 glPushMatrix();
588 a_Sinus[0]=10.0f*sin(a_counter*4.0f*3.14f/360.0f);
589 a_Sinus[1]=0.0f+10.0f*sin(a_counter*2*3.14/360.0);
590 a_Sinus[2]=3.0f-2.5f*cos(a_counter*8.0f*3.14f/360.0f);
591 glTranslatef(a_Sinus[0],a_Sinus[1],a_Sinus[2]);
593 glRotatef(-a_zrot,0,0,1);
594 glRotatef(90-2*a_xrot,1,0,0);
595 glColor4ub(255,128,255,255);
596 glColor4ub(128,192,255,255);
597 glRotatef(2*a_counter,0,0,1);
599 a_LightPosition[0]=0;//a_Sinus[0];//10.0f*sin(a_counter*4.0f*3.14f/360.0f);
600 a_LightPosition[1]=0;//a_Sinus[1];//0.0f+10.0f*sin(a_counter*2*3.14/360.0);
601 a_LightPosition[2]=0;//a_Sinus[2];//3.0f-2.5f*cos(a_counter*8.0f*3.14f/360.0f);
602 glEnable(GL_LIGHTING);
603 glLightfv(GL_LIGHT1,GL_POSITION,a_LightPosition);
604 glDisable(GL_LIGHTING);
605 a_Text[2].Use();
606 a_drawquad(1.0f+sin(a_counter*12.0f*3.1415f/360.0)+3.1415f/2.0f);
607 a_Text[3].Use();
608 a_drawquad(3.0f+2*sin(a_counter*6.0f*3.1415f/360.0));
609 glPopMatrix();
612 a_LightPosition[0]=10.0f*sin(a_counter*4.0f*3.14f/360.0f);
613 a_LightPosition[1]=0.0f+10.0f*sin(a_counter*2*3.14/360.0);
614 a_LightPosition[2]=3.0f-2.5f*cos(a_counter*8.0f*3.14f/360.0f);
615 // glTranslatef(a_LightPosition[0],a_LightPosition[1],a_LightPosition[2]);
616 glEnable(GL_LIGHTING);
617 glLightfv(GL_LIGHT1,GL_POSITION,a_LightPosition);
620 // a_time=2.0f+(1)/500.0f;//************************************
623 if (a_time>96.0f)
625 //****************************** FINISH
626 //a_Clean();
627 return false;
629 glutSwapBuffers();
630 return true;