summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2007-12-13 19:16:07 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2007-12-13 19:16:07 (GMT)
commit2b49eb5eb684537c19d9f0eabdffad0ffcf196ac (patch)
tree8601d86513101881250a765c0d646c29dcad9b7f
parentb2ee5b9e43beab038be81df3f8951e010313b5dc (diff)
download2iv35-2b49eb5eb684537c19d9f0eabdffad0ffcf196ac.zip
2iv35-2b49eb5eb684537c19d9f0eabdffad0ffcf196ac.tar.gz
2iv35-2b49eb5eb684537c19d9f0eabdffad0ffcf196ac.tar.bz2
nogmaals seedpoints (nu heb ik de files wel geadd)
-rw-r--r--Smoke/seedpoint.c79
-rw-r--r--Smoke/seedpoint.h11
2 files changed, 90 insertions, 0 deletions
diff --git a/Smoke/seedpoint.c b/Smoke/seedpoint.c
new file mode 100644
index 0000000..c19da14
--- /dev/null
+++ b/Smoke/seedpoint.c
@@ -0,0 +1,79 @@
+// Includes
+
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#include <rfftw.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include "fluids.h"
+#include "seedpoint.h"
+
+struct point seedpoints[MAX_SEEDPOINTS];
+int cur_seedpoint;
+
+void create_seedpoint(float mx, float my)
+{
+ if (cur_seedpoint >= MAX_SEEDPOINTS) return;
+
+ seedpoints[cur_seedpoint].x = mx;
+ seedpoints[cur_seedpoint].y = my;
+ seedpoints[cur_seedpoint].z = zPos;
+ cur_seedpoint++;
+
+} // create_seedpoint
+
+void delete_seedpoint(int seedpoint_nr)
+{
+ int i = seedpoint_nr;
+
+ for (i; i < cur_seedpoint; i++)
+ {
+ seedpoints[i].x = seedpoints[i+1].x;
+ seedpoints[i].y = seedpoints[i+1].y;
+ seedpoints[i].z = seedpoints[i+1].z;
+ }
+
+ for (i; i < MAX_SEEDPOINTS; i++)
+ {
+ seedpoints[i].x = 0.0f;
+ seedpoints[i].y = 0.0f;
+ seedpoints[i].z = 0.0f;
+ }
+
+} // delete_seedpoint
+
+void render_seedpoints(void)
+{
+ int i;
+ GLuint lid = glGenLists(1);
+ GLUquadricObj *qobj = gluNewQuadric();
+
+ gluQuadricDrawStyle(qobj, GLU_FILL);
+ gluQuadricNormals(qobj, GLU_SMOOTH);
+ gluQuadricOrientation(qobj, GLU_INSIDE);
+ gluQuadricTexture(qobj, GL_TRUE);
+
+ glNewList(lid, GL_COMPILE);
+ gluSphere(qobj, 10.0f, 16, 16);
+ glEndList();
+
+ for (i = 0; i < cur_seedpoint; i++)
+ {
+ float color_scale = (float)i/MAX_SEEDPOINTS;
+
+ glColor3f(color_scale, 1.0f - color_scale, 0.0f);
+
+ glPushMatrix();
+ glLoadIdentity();
+ glTranslatef(seedpoints[i].x - (winWidth/2), -(seedpoints[i].y - (winHeight/2)), seedpoints[i].z);
+ glCallList(lid);
+ glPopMatrix();
+ }
+
+ gluDeleteQuadric(qobj);
+
+}
diff --git a/Smoke/seedpoint.h b/Smoke/seedpoint.h
new file mode 100644
index 0000000..feb9545
--- /dev/null
+++ b/Smoke/seedpoint.h
@@ -0,0 +1,11 @@
+#ifndef _SEEDPOINT_H
+#define _SEEDPOINT_H
+
+#define MAX_SEEDPOINTS 16
+
+void create_seedpoint(float mx, float my);
+void delete_seedpoint(int seedpoint_nr);
+void render_seedpoints(void);
+
+#endif
+