diff options
Diffstat (limited to 'Smoke/renderer_gl.c')
-rw-r--r-- | Smoke/renderer_gl.c | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index 186568d..b21ef58 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -137,10 +137,13 @@ static void render_legend(void) static void render_normal(void) { - int i, j, idx; + int i, j, idx, DIM; 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 + fftw_real wn, hn; + + DIM = fluids_get_dim(); + wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width + hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height float normal_scale = 10.0f; glDisable(GL_LIGHTING); @@ -168,11 +171,16 @@ static void render_normal(void) static 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 + int i, j, idx, DIM; + double px,py; + fftw_real wn, hn; struct color4f color; + + DIM = fluids_get_dim(); + wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width + hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); for (j = 0; j < DIM - 1; j++) //draw smoke @@ -225,10 +233,13 @@ static void render_smoke(void) static void render_glyph(GLUquadricObj *qobj, float x_value, float y_value, float i, float j) { float x0, y0, z0, x1, y1, z1, x_dev, y_dev, size, length; - float scale = (float)((float)DIM / (float)get_var_dims()) / 6; + float scale; double theta, in_prod; fftw_real wn, hn; + int DIM; + DIM = fluids_get_dim(); + scale = (float)((float)DIM / (float)get_var_dims()) / 6; size = quake_root((x_value * x_value * 20) + (y_value * y_value * 20)) * 5 * scale; wn = (fftw_real)winWidth / (fftw_real)(get_var_dims() + 1); // Grid cell width @@ -306,7 +317,7 @@ static void render_glyph(GLUquadricObj *qobj, float x_value, float y_value, floa static void render_glyphs(void) { - int i, j, idx; + int i, j, idx, DIM; float value, scale, idxcf, idxrf; struct color4f color; @@ -314,6 +325,8 @@ static void render_glyphs(void) gluQuadricDrawStyle(qobj, GLU_FILL); gluQuadricNormals(qobj, GLU_SMOOTH); + DIM = fluids_get_dim(); + scale = (float)((float)DIM / (float)get_var_dims()); for (i = 0; i < get_var_dims(); i++) { @@ -361,12 +374,15 @@ static void render_glyphs(void) static void render_isolines(void) { - 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 count; + fftw_real wn, hn; + int count, DIM; float iso_scale; + DIM = fluids_get_dim(); + + wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width + hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height + if (isolines_nr) { iso_scale = (float)(fabs(threshold1 - threshold2) / (float)isolines_nr); } else { @@ -502,13 +518,14 @@ static void render_isolines(void) static void render_streamlines(void) { - int i, j, k, l, idx; + int i, j, k, l, idx, DIM; float v; struct point p; int *frame_history; fftw_real cell_x, cell_y; i = j = k = l = 0; + DIM = fluids_get_dim(); for (i = 0; i < get_cur_seedpoint(); i++) { @@ -535,14 +552,20 @@ static void render_streamlines(void) void render_flowvis(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 + int i, j, idx, DIM; + double px,py; + fftw_real wn, hn; struct color4f color; fftw_real *field; + DIM = fluids_get_dim(); + + wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width + hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height + field = smoke_get_frame(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); for (j = 0; j < DIM - 1; j++) //draw smoke @@ -661,7 +684,7 @@ void renderer_reset_roll(void) //visualize: This is the main visualization function -void visualize(fftw_real *field) +void visualize(struct vis_data_arrays *vis_data) { // Rotate field |