diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-19 20:59:56 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-19 20:59:56 (GMT) |
commit | 5f1fc7b0711f51dd05077303f854c658ccd9dcba (patch) | |
tree | 7d519f704a04a8f25d3e5f14ce809a7d985c4581 /Smoke/fluids.c | |
parent | a60088999da4f44bf5885f431fe78eb87d643ae7 (diff) | |
download | 2iv35-5f1fc7b0711f51dd05077303f854c658ccd9dcba.zip 2iv35-5f1fc7b0711f51dd05077303f854c658ccd9dcba.tar.gz 2iv35-5f1fc7b0711f51dd05077303f854c658ccd9dcba.tar.bz2 |
Loads of splitting, gui templates added for other elements
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r-- | Smoke/fluids.c | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c index 25d742f..3b3f8fe 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -16,9 +16,6 @@ #include "funcs.h" #include "fluids.h" -#include "palette.h" -#include "seedpoint.h" -#include "streamlines.h" //--- SIMULATION PARAMETERS ------------------------------------------------------------------------ const int DIM = 50; //size of simulation grid @@ -37,12 +34,7 @@ rfftwnd_plan plan_rc, plan_cr; //simulation domain discretization int winWidth, winHeight; //size of the graphics window, in pixels int color_dir = 0; //use direction color-coding or not float vec_scale = 1000; //scaling of hedgehogs -int draw_vecs = 1; //draw the vector field or not -int scalar_col = 0; //method for scalar coloring -int frozen = 0; //toggles on/off the animation int vis_dataset = DATASET_RHO; -int mousebutton; -int mousebuttonstate; int active_slider = 0; int glyph_scalar = SCALAR_RHO; int glyph_vector = VECTOR_VEL; @@ -383,124 +375,6 @@ void set_autoscaling(void) //threshold = (scale_min + scale_max) / 2; } -#define percentage(a, b) (min(a, b) / max(a, b)) - -void draw_isolines(float threshold) -{ - fftw_real wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width - fftw_real hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height - - int idx; - int i, j; - float v0, v1, v2, v3; - float x0, y0, x1, y1, x_offset, y_offset; - int state = 0; - static int prev_state = 0; - struct color4f colormap; - - v0 = v1 = v2 = v3 = 0.0f; - x0 = y0 = x1 = y1 = 0.0f; - - if (isolines_nr == 1) glLineWidth(2.0f); - else glLineWidth(2.0f); - glBegin(GL_LINES); - - for (i = 0; i < DIM - 1; i++) - { - for (j = 0; j < DIM - 1; j++) - { - state = 0; - idx = (j * DIM) + i; - colormap = set_palette(scalar_col, get_dataset(idx), 5); - glColor4f(colormap.r, colormap.g, colormap.b, 1.0f); - - v0 = get_dataset(idx + DIM); - v1 = get_dataset(idx + 1 + DIM); - v2 = get_dataset(idx + 1); - v3 = get_dataset(idx); - - if (v0 >= threshold) { state += 1; } - if (v1 >= threshold) { state += 2; } - if (v2 >= threshold) { state += 4; } - if (v3 >= threshold) { state += 8; } - - x_offset = wn + (fftw_real)i * wn; - y_offset = wn + (fftw_real)j * hn; - - switch (state) - { - case 5: - case 10: - x0 = 0; - y0 = percentage(fabs(v3 - v0), threshold) * hn; - x1 = percentage(fabs(v1 - v0), threshold) * wn; - y1 = hn; - if (x0 != y0 != x1 != y1 != 0.0f) { - glVertex3i(x_offset + x0, y_offset + y0, 0.0f); - glVertex3i(x_offset + x1, y_offset + y1, 0.0f); - } - // no break !! - case 4: - case 11: - x0 = percentage(fabs(v3 - v2), threshold) * wn; - y0 = 0; - x1 = wn; - y1 = percentage(fabs(v2 - v1), threshold) * hn; - break; - case 6: - case 9: - x0 = percentage(fabs(v3 - v2), threshold) * wn; - y0 = 0; - x1 = percentage(fabs(v1 - v0), threshold) * wn; - y1 = hn; - break; - case 7: - case 8: - x0 = percentage(fabs(v3 - v2), threshold) * wn; - y0 = 0; - x1 = 0; - y1 = percentage(fabs(v3 - v0), threshold) * hn; - break; - case 3: - case 12: - x0 = 0; - y0 = percentage(fabs(v3 - v0), threshold) * hn; - x1 = wn; - y1 = percentage(fabs(v2 - v1), threshold) * hn; - break; - case 2: - case 13: - x0 = percentage(fabs(v1 - v0), threshold) * wn; - y0 = hn; - x1 = wn; - y1 = percentage(fabs(v2 - v1), threshold) * hn; - break; - case 1: - case 14: - x0 = 0; - y0 = percentage(fabs(v3 - v0), threshold) * hn; - x1 = percentage(fabs(v1 - v0), threshold) * wn; - y1 = hn; - break; - case 0: case 15: default: - x0 = y0 = x1 = y1 = 0.0f; - break; - } - - // draw line - if (x0 != y0 != x1 != y1 != 0.0f) - { - glVertex3i(x_offset + x0, y_offset + y0, 0.0f); - glVertex3i(x_offset + x1, y_offset + y1, 0.0f); - } - - } - } - - glEnd(); -} - - //------ INTERACTION CODE STARTS HERE ----------------------------------------------------------------- void click(int button, int state, int mx, int my) @@ -610,7 +484,6 @@ void drag(int mx, int my) } } -void selectColor(int arg) { scalar_col = arg; } void select_dataset(int arg) { vis_dataset = arg; } void toggle_mouse_rotate(void) { rotate_plane = (rotate_plane) ? FALSE : TRUE; } void toggle_seed_insert(void) { seed_insert = (seed_insert) ? FALSE : TRUE; } |