summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2008-01-10 21:10:50 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2008-01-10 21:10:50 (GMT)
commit37e4a2a9857669837417b0b5e6ba35248bec9030 (patch)
tree36d3cccee52404e450f1fc76051a9cf01aab89cb
parentdcab21f30e9c451bfc2b7e65d90323b5e11a8612 (diff)
download2iv35-37e4a2a9857669837417b0b5e6ba35248bec9030.zip
2iv35-37e4a2a9857669837417b0b5e6ba35248bec9030.tar.gz
2iv35-37e4a2a9857669837417b0b5e6ba35248bec9030.tar.bz2
moved history to flowvis "smoke history"
-rw-r--r--Smoke/flowvis.c25
-rw-r--r--Smoke/flowvis.h7
-rw-r--r--Smoke/fluids.c9
-rw-r--r--Smoke/gtk_flowvis.c14
-rw-r--r--Smoke/renderer_gl.c4
-rwxr-xr-xSmoke/smoke.binbin653837 -> 656364 bytes
-rw-r--r--Smoke/streamlines.c27
-rw-r--r--Smoke/streamlines.h5
8 files changed, 44 insertions, 47 deletions
diff --git a/Smoke/flowvis.c b/Smoke/flowvis.c
index 151d80b..3c6d637 100644
--- a/Smoke/flowvis.c
+++ b/Smoke/flowvis.c
@@ -6,6 +6,7 @@
#include <rfftw.h>
+#include "fluids.h"
#include "funcs.h"
#include "palette.h"
@@ -21,7 +22,22 @@ static int flowvis_colormap = PALETTE_BLACKWHITE;
static float flowvis_alpha = 1.0f;
static fftw_real *flowvis_frame;
+static fftw_real **flowvis_history;
+static int hisdex = 0;
+
+
+void flowvis_set_hisdex(int arg)
+{
+ int idx = (fluids_get_hisdex() + 1) % HISTORY_SIZE;
+
+ hisdex = (arg + idx) % HISTORY_SIZE;
+}
+
+int flowvis_get_hisdex(void)
+{
+ return hisdex;
+}
void flowvis_set_render(int render_flowvis)
{
@@ -73,6 +89,15 @@ fftw_real *flowvis_get_frame(void)
return flowvis_frame;
}
+void flowvis_set_history(fftw_real **history)
+{
+ flowvis_history = history;
+}
+
+fftw_real *flowvis_get_history(int hisdex)
+{
+ return flowvis_history[hisdex];
+}
struct color4f flowvis_get_color(float value)
{
diff --git a/Smoke/flowvis.h b/Smoke/flowvis.h
index 7e186e2..bf3b237 100644
--- a/Smoke/flowvis.h
+++ b/Smoke/flowvis.h
@@ -16,6 +16,13 @@ float flowvis_get_alpha(void);
void flowvis_set_frame(fftw_real *frame);
fftw_real *flowvis_get_frame(void);
+void flowvis_set_history(fftw_real **history);
+fftw_real *flowvis_get_history(int hisdex);
+
+void flowvis_set_hisdex(int arg);
+int flowvis_get_hisdex(void);
+
+
struct color4f flowvis_get_color(float value);
diff --git a/Smoke/fluids.c b/Smoke/fluids.c
index a6c0a03..04d28d8 100644
--- a/Smoke/fluids.c
+++ b/Smoke/fluids.c
@@ -26,6 +26,7 @@
#include "streamlines.h"
#include "normals.h"
#include "isolines.h"
+#include "flowvis.h"
//--- SIMULATION PARAMETERS ------------------------------------------------------------------------
int var_dims = 25;
@@ -247,10 +248,6 @@ struct point vector_normal(struct point vert1, struct point vert2, struct point
return_value.y /= length;
return_value.z /= length;
- if (return_value.x == return_value.y == return_value.z == 0.0f)
- {
- return_value.z = 1.0f;
- }
return return_value;
}
@@ -293,7 +290,6 @@ void calculate_normal_vectors(void)
struct point calculate_normal_vector(fftw_real *height, int index, int i, int j)
{
- int idx;
float px, py;
struct point p1, p2, p3, rv;
@@ -525,7 +521,8 @@ void fluids_calculate_one_simulation_step(struct vis_data_arrays *vis_data)
frame = get_vector_frame(vis_data, dataset);
isolines_set_frame(frame);
- streamlines_set_history(vis_data->history_frame);
+ flowvis_set_history(vis_data->history_frame);
+
streamlines_set_history_scalars(vis_data->history_scalars);
}
diff --git a/Smoke/gtk_flowvis.c b/Smoke/gtk_flowvis.c
index d161bb4..06f456c 100644
--- a/Smoke/gtk_flowvis.c
+++ b/Smoke/gtk_flowvis.c
@@ -13,29 +13,29 @@
static gboolean select_colormap(GtkComboBox *combo, gpointer data)
{
- flowvis_set_colormap(gtk_combo_box_get_active(combo));
+ flowvis_set_colormap(gtk_combo_box_get_active(combo));
- return TRUE;
+ return TRUE;
}
static gboolean select_num_colors(GtkRange *adjustment, gpointer data)
{
- flowvis_set_num_colors((int)gtk_range_get_value(adjustment));
+ flowvis_set_num_colors((int)gtk_range_get_value(adjustment));
- return TRUE;
+ return TRUE;
}
static gboolean select_alpha(GtkRange *adjustment, gpointer data)
{
- flowvis_set_alpha((float)gtk_range_get_value(adjustment));
+ flowvis_set_alpha((float)gtk_range_get_value(adjustment));
- return TRUE;
+ return TRUE;
}
static gboolean select_history(GtkRange *adjustment, gpointer data)
{
- streamlines_set_hisdex((int)gtk_range_get_value(adjustment) - 1);
+ flowvis_set_hisdex((int)gtk_range_get_value(adjustment) - 1);
return TRUE;
}
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c
index ac10bf7..c8e6274 100644
--- a/Smoke/renderer_gl.c
+++ b/Smoke/renderer_gl.c
@@ -778,7 +778,7 @@ static void render_streamlines(void)
for (j = 0; j < HISTORY_SIZE; j++)
{
- frame_history = streamlines_get_history(j);
+ frame_history = flowvis_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
@@ -809,7 +809,7 @@ static void render_flowvis(void)
wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width
hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height
- history = streamlines_get_history(streamlines_get_hisdex());
+ history = flowvis_get_history(flowvis_get_hisdex());
if (flowvis_get_alpha() < 1.0f)
{
diff --git a/Smoke/smoke.bin b/Smoke/smoke.bin
index 03ad4dd..0c324d9 100755
--- a/Smoke/smoke.bin
+++ b/Smoke/smoke.bin
Binary files differ
diff --git a/Smoke/streamlines.c b/Smoke/streamlines.c
index 6bae373..0239fcf 100644
--- a/Smoke/streamlines.c
+++ b/Smoke/streamlines.c
@@ -19,23 +19,8 @@ static int streamlines_dataset = DATASET_RHO;
static float streamlines_alpha = 1.0f;
static fftw_real *streamlines_frame;
-static fftw_real **streamlines_history;
struct fftw_real_xy *streamlines_history_scalars;
-static int hisdex = 0;
-
-void streamlines_set_hisdex(int arg)
-{
- int idx = (fluids_get_hisdex() + 1) % HISTORY_SIZE;
-
- hisdex = (arg + idx) % HISTORY_SIZE;
-}
-
-int streamlines_get_hisdex(void)
-{
- return hisdex;
-}
-
void streamlines_set_render(int render_streamlines)
{
streamlines_render = render_streamlines;
@@ -96,18 +81,6 @@ fftw_real *streamlines_get_frame(void)
return streamlines_frame;
}
-/* rename and move to flowvis */
-void streamlines_set_history(fftw_real **history)
-{
- streamlines_history = history;
-}
-
-/* rename and move to flowvis */
-fftw_real *streamlines_get_history(int hisdex)
-{
- return streamlines_history[hisdex];
-}
-
void streamlines_set_history_scalars(struct fftw_real_xy *history)
{
streamlines_history_scalars = history;
diff --git a/Smoke/streamlines.h b/Smoke/streamlines.h
index 54c31ea..7c62a98 100644
--- a/Smoke/streamlines.h
+++ b/Smoke/streamlines.h
@@ -22,11 +22,6 @@ fftw_real *streamlines_get_frame(void);
void streamlines_set_history_scalars(struct fftw_real_xy *history);
struct fftw_real_xy *streamlines_get_history_scalars(void);
-void streamlines_set_history(fftw_real **history);
-fftw_real *streamlines_get_history(int hisdex);
-
-void streamlines_set_hisdex(int arg);
-int streamlines_get_hisdex(void);
struct color4f streamlines_get_color(float value);