summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2008-01-10 19:14:14 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2008-01-10 19:14:14 (GMT)
commitb7bad543e14945a84d58a205ff30038db0b87ca0 (patch)
tree2f31e826b26c3806594283cd10d40420b187b596
parent890f2eba8e594f345600b6e97de4d35d22b9b31f (diff)
download2iv35-b7bad543e14945a84d58a205ff30038db0b87ca0.zip
2iv35-b7bad543e14945a84d58a205ff30038db0b87ca0.tar.gz
2iv35-b7bad543e14945a84d58a205ff30038db0b87ca0.tar.bz2
gui voor grid-smoke, resetten van scaling en clamping and fixed the motha-focking rescaling bug
-rw-r--r--Smoke/Week 2.suobin77312 -> 78336 bytes
-rw-r--r--Smoke/Week 2.vcproj10
-rw-r--r--Smoke/colormap.c16
-rw-r--r--Smoke/gtk.c5
-rw-r--r--Smoke/gtk_colormap.c55
-rw-r--r--Smoke/gtk_main.c7
-rw-r--r--Smoke/renderer_gl.c151
-rw-r--r--Smoke/seedpoint.c70
-rw-r--r--Smoke/smoke.c20
-rw-r--r--Smoke/smoke.h7
10 files changed, 238 insertions, 103 deletions
diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo
index ee33852..d77119f 100644
--- a/Smoke/Week 2.suo
+++ b/Smoke/Week 2.suo
Binary files differ
diff --git a/Smoke/Week 2.vcproj b/Smoke/Week 2.vcproj
index d9b7680..ebf3a32 100644
--- a/Smoke/Week 2.vcproj
+++ b/Smoke/Week 2.vcproj
@@ -47,7 +47,7 @@
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="1"
@@ -974,19 +974,19 @@
>
</File>
<File
- RelativePath="fftw-2.1.3\rfftw\Makefile.am"
+ RelativePath="fftw-2.1.3\fftw\Makefile.am"
>
</File>
<File
- RelativePath="fftw-2.1.3\fftw\Makefile.am"
+ RelativePath="fftw-2.1.3\rfftw\Makefile.am"
>
</File>
<File
- RelativePath="fftw-2.1.3\fftw\Makefile.in"
+ RelativePath="fftw-2.1.3\rfftw\Makefile.in"
>
</File>
<File
- RelativePath="fftw-2.1.3\rfftw\Makefile.in"
+ RelativePath="fftw-2.1.3\fftw\Makefile.in"
>
</File>
<File
diff --git a/Smoke/colormap.c b/Smoke/colormap.c
index c7b5f61..e4a4901 100644
--- a/Smoke/colormap.c
+++ b/Smoke/colormap.c
@@ -26,12 +26,10 @@ static int colormap_scaling = FALSE;
static int colormap_clamping = FALSE;
static float colormap_scale_min = 0.0f;
-
static float colormap_scale_max = 1.0f;
static float colormap_clamp_min = 0.0f;
-
-static float colormap_clamp_max = 0.9999f;
+static float colormap_clamp_max = 1.0f;
static int colormap_autoscaling = FALSE;
@@ -185,3 +183,15 @@ struct color4f colormap_get_color(float value)
return return_value;
}
+
+void renderer_reset_scaling(void)
+{
+ colormap_scale_min = 0.0f;
+ colormap_scale_max = 1.0f;
+}
+
+void renderer_reset_clamping(void)
+{
+ colormap_clamp_min = 0.0f;
+ colormap_clamp_max = 1.0f;
+}
diff --git a/Smoke/gtk.c b/Smoke/gtk.c
index b376b3c..e696d8d 100644
--- a/Smoke/gtk.c
+++ b/Smoke/gtk.c
@@ -162,14 +162,11 @@ configure_event (GtkWidget *widget,
glViewport (0, 0, w, h);
-// fluids
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)w / (GLfloat)h, 0.1, 5000.0f);
- //gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h);
- winWidth = w;
+ winWidth = w;
winHeight = h;
-// endf
gdk_gl_drawable_gl_end (gldrawable);
/*** OpenGL END ***/
diff --git a/Smoke/gtk_colormap.c b/Smoke/gtk_colormap.c
index 169291d..6a055eb 100644
--- a/Smoke/gtk_colormap.c
+++ b/Smoke/gtk_colormap.c
@@ -4,6 +4,7 @@
#include <rfftw.h>
#include "fluids.h"
+#include "smoke.h"
#include "palette.h"
#include "smoke.h" /* colormap and smoke are siblings */
#include "colormap.h"
@@ -37,6 +38,25 @@ static gboolean set_clamping(GtkToggleButton *button, gpointer data) {
return TRUE;
}
+static gboolean reset_scaling(GtkWidget *button, gpointer data) {
+ renderer_reset_scaling();
+
+ return TRUE;
+}
+
+static gboolean reset_clamping(GtkWidget *button, gpointer data) {
+ renderer_reset_clamping();
+
+ return TRUE;
+}
+
+static gboolean select_smoke_sort(GtkComboBox *combo, gpointer data)
+{
+ smoke_set_sort(gtk_combo_box_get_active(combo));
+
+ return TRUE;
+}
+
static gboolean select_alpha(GtkRange *adjustment, gpointer data)
{
colormap_set_alpha((float)gtk_range_get_value(adjustment));
@@ -94,8 +114,8 @@ GtkWidget *create_colormap_page(void)
gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
gtk_widget_show(button);
- gtk_box_pack_start(GTK_BOX(box), box2, TRUE, TRUE, 0);
- gtk_widget_show(box2);
+ gtk_box_pack_start(GTK_BOX(box), box2, TRUE, TRUE, 0);
+ gtk_widget_show(box2);
button = gtk_check_button_new_with_label("AutoScale");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), colormap_get_autoscaling());
@@ -103,6 +123,21 @@ GtkWidget *create_colormap_page(void)
gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
gtk_widget_show(button);
+ box2 = gtk_hbox_new(FALSE, 0);
+
+ button = gtk_button_new_with_label("Reset scaling");
+ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_scaling), NULL);
+ gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
+ gtk_widget_show(button);
+
+ button = gtk_button_new_with_label("Reset clamping");
+ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_clamping), NULL);
+ gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
+ gtk_widget_show(button);
+
+ gtk_box_pack_start(GTK_BOX(box), box2, TRUE, TRUE, 0);
+ gtk_widget_show(box2);
+
gtk_container_add(GTK_CONTAINER(frame), box);
gtk_widget_show(box);
@@ -251,8 +286,22 @@ GtkWidget *create_colormap_page(void)
gtk_box_pack_start(GTK_BOX(page), frame, FALSE, TRUE, 0);
- gtk_widget_show(frame);
+ label = gtk_label_new("Smoke visualization");
+ gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0);
+ gtk_widget_show(label);
+
+ combo = gtk_combo_box_new_text();
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Fluid smoke");
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Grid smoke");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), smoke_get_sort());
+ g_signal_connect(combo, "changed", G_CALLBACK(select_smoke_sort), (gpointer)NULL);
+
+ gtk_box_pack_start(GTK_BOX(box), combo, FALSE, TRUE, 0);
+ gtk_widget_show(combo);
+
+ gtk_widget_show(frame);
return page;
}
diff --git a/Smoke/gtk_main.c b/Smoke/gtk_main.c
index ebc1fe1..88a89b6 100644
--- a/Smoke/gtk_main.c
+++ b/Smoke/gtk_main.c
@@ -7,7 +7,6 @@
#include "gtk_main.h"
#include "renderer_gl.h"
-#include "smoke.h"
#include "normals.h"
#include "colormap.h"
#include "glyphs.h"
@@ -179,12 +178,6 @@ GtkWidget *create_main_page(void)
gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0);
gtk_widget_show(button);
- button = gtk_check_button_new_with_label("Draw grid-smoke");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), smoke_grid_get_render());
- g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(select_render_grid_smoke), NULL);
- gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
-
button = gtk_check_button_new_with_label("Draw glyphs");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), glyphs_get_render());
g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(select_render_glyphs), NULL);
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c
index 15cff39..01205fe 100644
--- a/Smoke/renderer_gl.c
+++ b/Smoke/renderer_gl.c
@@ -111,7 +111,6 @@ static void render_legend(void)
glDisable(GL_BLEND);
glLoadIdentity();
- glTranslatef(LEGEND_X_POS, LEGEND_Y_POS, LEGEND_Z_POS);
for (i = 0; i < winWidth; i++)
{
@@ -130,60 +129,60 @@ static void render_legend(void)
colormap_set_scaling(s);
colormap_set_clamping(c);
- clamp_scaled_min = colormap_get_clamp_min() *winWidth;
- clamp_scaled_max = colormap_get_clamp_max() *winWidth;
+ clamp_scaled_min = colormap_get_clamp_min() * winWidth;
+ clamp_scaled_max = colormap_get_clamp_max() * winWidth;
- scale_scaled_min = colormap_get_scale_min() *winWidth;
- scale_scaled_max = colormap_get_scale_max() *winWidth;
+ scale_scaled_min = colormap_get_scale_min() * winWidth;
+ scale_scaled_max = colormap_get_scale_max() * winWidth;
glBegin(GL_LINES);
if (colormap_get_scaling()) {
glColor3f(1, 0, 0);
- glVertex2i(scale_scaled_min, winHeight -4);
- glVertex2i(scale_scaled_min, winHeight -18);
- glVertex2i(scale_scaled_max, winHeight -4);
- glVertex2i(scale_scaled_max, winHeight -18);
+ glVertex2i(scale_scaled_min, winHeight - 4);
+ glVertex2i(scale_scaled_min, winHeight - 18);
+ glVertex2i(scale_scaled_max, winHeight - 4);
+ glVertex2i(scale_scaled_max, winHeight - 18);
}
if (colormap_get_clamping()) {
glColor4f(0.2, 0.2, 0.2, 1.0);
- glVertex2i(clamp_scaled_min, winHeight -6);
- glVertex2i(clamp_scaled_min, winHeight -18);
- glVertex2i(clamp_scaled_max, winHeight -6);
- glVertex2i(clamp_scaled_max, winHeight -18);
+ glVertex2i(clamp_scaled_min, winHeight - 6);
+ glVertex2i(clamp_scaled_min, winHeight - 18);
+ glVertex2i(clamp_scaled_max, winHeight - 6);
+ glVertex2i(clamp_scaled_max, winHeight - 18);
}
if (!(i %20)) {
glColor3f(0.7, 0.7, 0.7);
- glVertex2i(i -1, winHeight -6);
- glVertex2i(i -1, winHeight -22);
- glVertex2i(i, winHeight -6);
- glVertex2i(i, winHeight -22);
- glVertex2i(i +1, winHeight -6);
- glVertex2i(i +1, winHeight -22);
+ glVertex2i(i -1, winHeight - 6);
+ glVertex2i(i -1, winHeight - 22);
+ glVertex2i(i, winHeight - 6);
+ glVertex2i(i, winHeight - 22);
+ glVertex2i(i +1, winHeight - 6);
+ glVertex2i(i +1, winHeight - 22);
} else {
glColor3f(color.r, color.g, color.b);
- glVertex2i(i, winHeight -6);
- glVertex2i(i, winHeight -18);
+ glVertex2i(i, winHeight - 6);
+ glVertex2i(i, winHeight - 18);
}
glEnd();
glBegin(GL_TRIANGLES);
if (colormap_get_scaling()) {
glColor3f(1, 0, 0);
- glVertex2i(scale_scaled_min, winHeight -6);
- glVertex2i(scale_scaled_min -4, winHeight);
- glVertex2i(scale_scaled_min +4, winHeight);
- glVertex2i(scale_scaled_max, winHeight -6);
- glVertex2i(scale_scaled_max -4, winHeight);
- glVertex2i(scale_scaled_max +4, winHeight);
+ glVertex2i(scale_scaled_min, winHeight - 6);
+ glVertex2i(scale_scaled_min - 4, winHeight);
+ glVertex2i(scale_scaled_min + 4, winHeight);
+ glVertex2i(scale_scaled_max, winHeight - 6);
+ glVertex2i(scale_scaled_max - 4, winHeight);
+ glVertex2i(scale_scaled_max + 4, winHeight);
}
if (colormap_get_clamping()) {
glColor3f(0.9, 0.9, 0.9);
- glVertex2i(clamp_scaled_min, winHeight -18);
- glVertex2i(clamp_scaled_min -4, winHeight -25);
- glVertex2i(clamp_scaled_min +4, winHeight -25);
- glVertex2i(clamp_scaled_max, winHeight -18);
- glVertex2i(clamp_scaled_max -4, winHeight -25);
- glVertex2i(clamp_scaled_max +4, winHeight -25);
+ glVertex2i(clamp_scaled_min, winHeight - 18);
+ glVertex2i(clamp_scaled_min - 4, winHeight - 25);
+ glVertex2i(clamp_scaled_min + 4, winHeight - 25);
+ glVertex2i(clamp_scaled_max, winHeight - 18);
+ glVertex2i(clamp_scaled_max - 4, winHeight - 25);
+ glVertex2i(clamp_scaled_max + 4, winHeight - 25);
}
glEnd();
}
@@ -750,8 +749,8 @@ static void render_isolines(void)
} // end switch state
// draw line
- glVertex3i(e1.x, e1.y, e1.z);
- glVertex3i(e2.x, e2.y, e2.z);
+ glVertex3i((GLint)e1.x, (GLint)e1.y, (GLint)e1.z);
+ glVertex3i((GLint)e2.x, (GLint)e2.y, (GLint)e2.z);
}
} // end for count
glEnd();
@@ -761,10 +760,10 @@ static void render_isolines(void)
static void render_streamlines(void)
{
- int i, j, k, l, idx, DIM;
+ int i, j, k, l, idx, idx_x, idx_y, DIM;
float v;
struct point p;
- int *frame_history;
+ fftw_real *frame_history;
fftw_real cell_x, cell_y;
i = j = k = l = 0;
@@ -773,22 +772,26 @@ static void render_streamlines(void)
for (i = 0; i < get_cur_seedpoint(); i++)
{
p = get_seedpoint(i);
+
+ glBegin(GL_LINE_STRIP);
- while (j < DIM)
+ for (j = 0; j < HISTORY_SIZE; j++)
{
- // frame_history = frame_hist[j];
+ frame_history = streamlines_get_history(j);
cell_x = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width
cell_y = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell heigh
- cell_x = round(p.x / cell_x);
- cell_y = round(p.y / cell_y);
+ idx_x = round(p.x / cell_x);
+ idx_y = round(p.y / cell_y);
+
+ idx = (int)(cell_x * cell_y);
- idx = cell_x + (cell_y * DIM) + (j * DIM * DIM);
- v = frame_history[idx];
+ v = (float)frame_history[idx];
- j++;
+ glVertex3f(p.x + v, winHeight - p.y, 0.0f - j * 10.0f);
}
+ glEnd();
}
}
@@ -823,33 +826,33 @@ static void render_flowvis(void)
py = hn + (fftw_real)j * hn;
idx = (j * DIM) + i;
- color = flowvis_get_color(history[idx]);
+ color = flowvis_get_color((float)history[idx]);
glColor4f(color.r, color.g, color.b, color.a);
- glVertex2f(px, py); // vertex 1
+ glVertex2f((GLfloat)px, (GLfloat)py); // vertex 1
for (i = 0; i < DIM - 1; i++)
{
px = wn + (fftw_real)i * wn;
py = hn + (fftw_real)(j + 1) * hn;
idx = ((j + 1) * DIM) + i;
- color = flowvis_get_color(history[idx]);
+ color = flowvis_get_color((float)history[idx]);
glColor4f(color.r, color.g, color.b, color.a);
- glVertex2f(px, py); // vertex 2
+ glVertex2f((GLfloat)px, (GLfloat)py); // vertex 2
px = wn + (fftw_real)(i + 1) * wn;
py = hn + (fftw_real)j * hn;
idx = (j * DIM) + (i + 1);
- color = flowvis_get_color(history[idx]);
+ color = flowvis_get_color((float)history[idx]);
glColor4f(color.r, color.g, color.b, color.a);
- glVertex2f(px, py); // vertex 3
+ glVertex2f((GLfloat)px, (GLfloat)py); // vertex 3
}
px = wn + (fftw_real)(DIM - 1) * wn;
py = hn + (fftw_real)(j + 1) * hn;
idx = ((j + 1) * DIM) + (DIM - 1);
- color = flowvis_get_color(history[idx]);
+ color = flowvis_get_color((float)history[idx]);
glColor4f(color.r, color.g, color.b, color.a);
- glVertex2f(px, py); // vertex 4
+ glVertex2f((GLfloat)px, (GLfloat)py); // vertex 4
glEnd();
}
@@ -963,17 +966,22 @@ void visualize(struct vis_data_arrays *vis_data)
glRotatef(y_rot, 0.0f, 1.0f, 0.0f);
glRotatef(z_rot, 0.0f, 0.0f, 1.0f);
- glTranslatef(-winWidth/2, -winHeight/2, 0.0f);
+ glTranslatef((GLfloat)(-winWidth / 2), (GLfloat)(-winHeight / 2), 0.0f);
if (renderer_render_grid) {
render_grid();
}
- if (smoke_get_render()) {
- render_smoke();
- }
- else if (smoke_grid_get_render()) {
- render_grid_smoke();
+ if (smoke_get_render())
+ {
+ if (smoke_get_sort() == SMOKE_FLUID)
+ {
+ render_smoke();
+ }
+ else // SMOKE_GRID
+ {
+ render_grid_smoke();
+ }
}
if (isolines_get_render()) {
@@ -1004,7 +1012,32 @@ void visualize(struct vis_data_arrays *vis_data)
render_streamlines();
- render_legend();
+ //create an orthographic projection matrix for rendering the legendbar
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+
+ glLoadIdentity();
+
+ //create an orthographic viewing volume with the same dimensions as the
+ //window in front of the previous viewing volume
+ //from znear = 0.0 to zfar = 1.0
+ glOrtho(0.0, (GLfloat)winWidth, 0.0, (GLfloat)winHeight, 0.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix(); //save the current modelview matrix
+
+ glLoadIdentity();
+
+ //now render the legendbar
+ render_legend();
+
+ //restore the previous modelview matrix
+ glPopMatrix();
+
+ //restore the previous projection matrix
+ glMatrixMode(GL_PROJECTION);
+
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
diff --git a/Smoke/seedpoint.c b/Smoke/seedpoint.c
index 4c07038..359bf03 100644
--- a/Smoke/seedpoint.c
+++ b/Smoke/seedpoint.c
@@ -16,13 +16,70 @@
struct point seedpoints[MAX_SEEDPOINTS];
int cur_seedpoint;
+static struct point2f hit_test(struct point2f mouse_coord)
+{
+ double l_ProjectionMatrix[16], l_ModelViewMatrix[16], l_PointNear[3], l_PointFar[3], l_dFactor;
+ int l_ViewPort[4];
+
+ struct point2f new_mouse, return_value;
+ new_mouse.x = mouse_coord.x;
+ new_mouse.y = mouse_coord.y;
+
+ //first setup the modelview matrix (assume the projection matrix is still valid/correct)
+ glMatrixMode(GL_MODELVIEW);
+
+ glPushMatrix();
+ glLoadIdentity();
+ glTranslatef(x_pos, y_pos, z_pos);
+ glScalef(z_pos, z_pos, z_pos);
+ glRotatef(x_rot, 1.0f, 0.0f, 0.0f);
+ glRotatef(y_rot, 0.0f, 1.0f, 0.0f);
+ glRotatef(z_rot, 0.0f, 0.0f, 1.0f);
+
+ //get the viewport, modelview and projection matrices' values
+ glGetIntegerv(GL_VIEWPORT, l_ViewPort);
+ glGetDoublev(GL_MODELVIEW_MATRIX, l_ModelViewMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, l_ProjectionMatrix);
+
+ glPopMatrix();
+
+ //invert the mouse y coordinate
+ new_mouse.y = (winHeight - new_mouse.y);
+
+ //unproject the mouse coords to the object coordinates at the near clipping plane
+ gluUnProject((GLdouble) new_mouse.x, new_mouse.y, 0.0,
+ l_ModelViewMatrix, l_ProjectionMatrix, l_ViewPort,
+ &l_PointNear[0], &l_PointNear[1], &l_PointNear[2]);
+
+ //unproject the mouse coords to the object coordinates at the far clipping plane
+ gluUnProject((GLdouble) new_mouse.x, new_mouse.y, 1.0,
+ l_ModelViewMatrix, l_ProjectionMatrix, l_ViewPort,
+ &l_PointFar[0], &l_PointFar[1], &l_PointFar[2]);
+
+ //determine where the the vector (l_PointNear -> l_PointFar) intersects the plane z = 0,
+ //because we draw the data visualisation at z = 0, we get the coordinates
+ l_dFactor = -l_PointNear[2] / (l_PointFar[2] - l_PointNear[2]);
+
+ //return the x,y coordinates at the point where the vector intersects the z = 0 plane
+ return_value.x = l_PointNear[0] + (l_dFactor * (l_PointFar[0] - l_PointNear[0]));
+ return_value.y = l_PointNear[1] + (l_dFactor * (l_PointFar[1] - l_PointNear[1]));
+
+ return return_value;
+}
+
void create_seedpoint(float mx, float my)
{
+ struct point2f coords;
+
if (cur_seedpoint >= MAX_SEEDPOINTS) return;
- seedpoints[cur_seedpoint].x = mx;
- seedpoints[cur_seedpoint].y = my;
- seedpoints[cur_seedpoint].z = -725.0f;
+ coords.x = mx;
+ coords.y = my;
+ //coords = hit_test(coords);
+
+ seedpoints[cur_seedpoint].x = coords.x;
+ seedpoints[cur_seedpoint].y = coords.y;
+ seedpoints[cur_seedpoint].z = 0;
cur_seedpoint++;
} // create_seedpoint
@@ -58,6 +115,8 @@ void render_seedpoints(void)
gluQuadricOrientation(qobj, GLU_INSIDE);
gluQuadricTexture(qobj, GL_TRUE);
+ glDisable(GL_BLEND);
+
glNewList(lid, GL_COMPILE);
gluSphere(qobj, 10.0f, 16, 16);
glEndList();
@@ -66,11 +125,10 @@ void render_seedpoints(void)
{
float color_scale = (float)i/MAX_SEEDPOINTS;
- glColor3f(color_scale, 1.0f - color_scale, 0.0f);
+ glColor3f(color_scale, 1.0f - color_scale, 1.0f - color_scale);
glPushMatrix();
- glLoadIdentity();
- glTranslatef(seedpoints[i].x - (winWidth/2), -(seedpoints[i].y - (winHeight/2)), seedpoints[i].z);
+ glTranslatef(seedpoints[i].x, winHeight - seedpoints[i].y, seedpoints[i].z);
glCallList(lid);
glPopMatrix();
}
diff --git a/Smoke/smoke.c b/Smoke/smoke.c
index cc21479..a8b9a68 100644
--- a/Smoke/smoke.c
+++ b/Smoke/smoke.c
@@ -6,11 +6,11 @@
#include <rfftw.h>
#include "fluids.h"
+#include "smoke.h"
#include "funcs.h"
-
static int smoke_render_smoke = TRUE;
-static int smoke_render_smoke_grid = FALSE;
+static int smoke_sort = SMOKE_FLUID;
static int smoke_dataset = DATASET_RHO;
static fftw_real *smoke_frame;
@@ -18,11 +18,6 @@ static fftw_real *smoke_frame;
void smoke_set_render(int render_smoke)
{
smoke_render_smoke = render_smoke;
-
- if (smoke_render_smoke)
- {
- smoke_render_smoke_grid = FALSE;
- }
}
int smoke_get_render(void)
@@ -30,17 +25,14 @@ int smoke_get_render(void)
return smoke_render_smoke;
}
-int smoke_grid_get_render(void)
+int smoke_get_sort (void)
{
- return smoke_render_smoke_grid;
+ return smoke_sort;
}
-void smoke_grid_set_render(int render_grid)
+void smoke_set_sort (int sort)
{
- if (!smoke_render_smoke)
- {
- smoke_render_smoke_grid = render_grid;
- }
+ smoke_sort = sort;
}
void smoke_set_dataset(int dataset)
diff --git a/Smoke/smoke.h b/Smoke/smoke.h
index 7d7fa3c..44f2360 100644
--- a/Smoke/smoke.h
+++ b/Smoke/smoke.h
@@ -1,11 +1,14 @@
#ifndef _SMOKE_H
#define _SMOKE_H
+#define SMOKE_FLUID 0
+#define SMOKE_GRID 1
+
void smoke_set_render(int render_smoke);
int smoke_get_render(void);
-void smoke_grid_set_render(int render_grid);
-int smoke_grid_get_render(void);
+void smoke_set_sort(int sort);
+int smoke_get_sort(void);
void smoke_set_dataset(int dataset);
int smoke_get_dataset(void);