diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-19 15:44:23 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-19 15:44:23 (GMT) |
commit | a60088999da4f44bf5885f431fe78eb87d643ae7 (patch) | |
tree | 27940a3cd14a7cdee60ddb0263bf1173c51df56c /Smoke/fluids.c | |
parent | c287b3f591fe3e10dceedfd90a5ce71b2c703988 (diff) | |
download | 2iv35-a60088999da4f44bf5885f431fe78eb87d643ae7.zip 2iv35-a60088999da4f44bf5885f431fe78eb87d643ae7.tar.gz 2iv35-a60088999da4f44bf5885f431fe78eb87d643ae7.tar.bz2 |
splitted up glyphs
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r-- | Smoke/fluids.c | 138 |
1 files changed, 1 insertions, 137 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c index c9b54e4..25d742f 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -14,13 +14,11 @@ #include <GL/gl.h> #include <GL/glu.h> +#include "funcs.h" #include "fluids.h" #include "palette.h" -#include "colormap.h" -#include "glyphs.h" #include "seedpoint.h" #include "streamlines.h" -#include "funcs.h" //--- SIMULATION PARAMETERS ------------------------------------------------------------------------ const int DIM = 50; //size of simulation grid @@ -39,7 +37,6 @@ 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 -static int fluids_render_smoke = FALSE; 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 @@ -47,7 +44,6 @@ int vis_dataset = DATASET_RHO; int mousebutton; int mousebuttonstate; int active_slider = 0; -int use_glyphs = FALSE; int glyph_scalar = SCALAR_RHO; int glyph_vector = VECTOR_VEL; int glyph_sort = GLYPH_CYLINDERS; @@ -67,15 +63,6 @@ float z_rot = 0.0f; //------ SIMULATION CODE STARTS HERE ----------------------------------------------------------------- -/* Setters and getters */ -void fluids_set_render_smoke(int render_smoke) { - fluids_render_smoke = render_smoke; -} - -int fluids_get_render_smoke(void) { - return fluids_render_smoke; -} - //init_simulation: Initialize simulation data structures as a function of the grid size 'n'. // Although the simulation takes place on a 2D grid, we allocate all data structures as 1D arrays, // for compatibility with the FFTW numerical library. @@ -513,126 +500,6 @@ void draw_isolines(float threshold) glEnd(); } -void render_smoke(void) -{ - int i, j, idx; double px,py; - 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 - struct color4f color; - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - for (j = 0; j < DIM - 1; j++) //draw smoke - { - glBegin(GL_TRIANGLE_STRIP); - - i = 0; - px = wn + (fftw_real)i * wn; - py = hn + (fftw_real)j * hn; - idx = (j * DIM) + i; - - glColor3f(rho[idx],rho[idx],rho[idx]); - glVertex3f(px,py, height_array[idx]); - - 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 = colormap_get_color(get_dataset(idx)); - glColor4f(color.r, color.g, color.b, 1.0f); - glVertex3f(px, py, height_array[idx]); - px = wn + (fftw_real)(i + 1) * wn; - py = hn + (fftw_real)j * hn; - idx = (j * DIM) + (i + 1); - color = colormap_get_color(get_dataset(idx)); - glColor4f(color.r, color.g, color.b, 1.0f); - glVertex3f(px, py, height_array[idx]); - } - - px = wn + (fftw_real)(DIM - 1) * wn; - py = hn + (fftw_real)(j + 1) * hn; - idx = ((j + 1) * DIM) + (DIM - 1); - color = colormap_get_color(get_dataset(idx)); - glColor4f(color.r, color.g, color.b, 1.0f); - glVertex3f(px, py, height_array[idx]); - glEnd(); - } -} - -void render_legend(void) -{ - int i; - struct color4f color; - - for (i = 0; i < winWidth; i++) - { - float value, clamp_scaled_min, clamp_scaled_max, scale_scaled_min, scale_scaled_max; - - - value = (float)((float)i/winWidth); - - color = colormap_get_color(value); - - - 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; - - 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); - } - 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); - } - 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); - } else { - glColor3f(color.r, color.g, color.b); - 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); - } - 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); - } - glEnd(); - } -} //------ INTERACTION CODE STARTS HERE ----------------------------------------------------------------- @@ -743,11 +610,8 @@ void drag(int mx, int my) } } -int get_glyph_usage(void) { return use_glyphs; } - void selectColor(int arg) { scalar_col = arg; } void select_dataset(int arg) { vis_dataset = arg; } -void toggle_glyph_usage(void) { use_glyphs = (use_glyphs) ? FALSE : TRUE; } void toggle_mouse_rotate(void) { rotate_plane = (rotate_plane) ? FALSE : TRUE; } void toggle_seed_insert(void) { seed_insert = (seed_insert) ? FALSE : TRUE; } void set_glyph_scalar(int arg) { glyph_scalar = arg; } |