i have model a cloud…
the problem is, how to animate it…
i don’t really understand about the partical system…
which formula should i used to animate the cloud?
below is my cloud model source code ::
#include <glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define TITIK 2000
typedef GLfloat point3D[3];
typedef point3D gas[TITIK];
gas dot;
void Populate(gas anal)
{
int i=0;
GLfloat randx, randy;
{
while(i<TITIK)
{
randx = 2 * ((GLfloat)rand()/RAND_MAX) -1;
randy = 2 * ((GLfloat)rand()/RAND_MAX) -1;
// if not true, then (x,y) lies outside of the unit circle, so do not keep
if( 1.0 > (randx * randx + randy * randy) )
{
anal[i][0] = randx;
anal[i][1] = randy;
anal[i][2] = 0;
i++;
}
}
}
}
void MyInit()
{
Populate(dot);
}
int Update()
{
}
void Display(void)
{
int i;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(100.0, 200.0, 100.0, // eye point
1.0, 0.0, 0.0, // center of view
5.0, 0.0, 1.3); // up
glPushMatrix();
glScalef(10.0,10.0,10.0);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
for (i=0; i<TITIK; i++)
glVertex3fv(dot[i]);
glEnd();
glutSwapBuffers();
}
void Reshape(int w,int h)
{
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(25.0, 0.3, 1.0, 300.0);
}
void Animate()
{
}
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode (GLUT_DOUBLE |GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(600,400);
glutInitWindowPosition(50,50);
glutCreateWindow("Awan");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
MyInit();
glutMainLoop();
return 0;
}