From c8c41f2f654c3a5283a299c27fd29fd47aaafe4f Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Thu, 10 Jan 2008 21:54:34 +0000 Subject: crap --- Smoke/fluids.c | 16 +++++++++++----- Smoke/fluids.h | 2 +- Smoke/renderer_gl.c | 5 +++-- Smoke/smoke.bin | Bin 652769 -> 652385 bytes Smoke/streamlines.c | 8 ++++---- Smoke/streamlines.h | 4 ++-- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Smoke/fluids.c b/Smoke/fluids.c index 4a23c85..b339d1e 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -71,10 +71,10 @@ void fluids_init_simulation(int n, struct vis_data_arrays *vis_data) for (i = 0; i < HISTORY_SIZE; i++) { vis_data->history_frame[i] = (fftw_real *)malloc(dim1); - vis_data->history_scalars[i].x = (fftw_real *)malloc(dim1); - vis_data->history_scalars[i].y = (fftw_real *)malloc(dim1); + vis_data->history_scalars[i] = (struct fftw_real_xy *)malloc(sizeof(struct fftw_real_xy)); + vis_data->history_scalars[i]->x = (fftw_real *)malloc(dim1); + vis_data->history_scalars[i]->y = (fftw_real *)malloc(dim1); } - fluids_reset_simulation(); vis_data->rho = (fftw_real *)malloc(dim2); @@ -382,6 +382,7 @@ void setup_arrays(struct vis_data_arrays *vis_data) fftw_real *frame_smoke, *frame_streamlines; struct fftw_real_xy scalar_frames_glyphs, scalar_frames_streamlines; int dataset; + struct fftw_real_xy *test; fftw_real wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width @@ -396,6 +397,8 @@ void setup_arrays(struct vis_data_arrays *vis_data) dataset = streamlines_get_dataset(); scalar_frames_streamlines = get_scalar_frames(vis_data, dataset); + test = streamlines_get_history_scalars(0); + for (j = 0; j < DIM; j++) { for (i = 0; i < DIM; i++) @@ -410,8 +413,10 @@ void setup_arrays(struct vis_data_arrays *vis_data) vis_data->div_vel[idx] = par_der(vx[idx + 1], vx[idx], wn) + par_der(vy[idx + 1], vy[idx], wn); vis_data->div_force[idx] = par_der(fx[idx + 1], fx[idx], hn) + par_der(fy[idx + 1], fy[idx], hn); vis_data->history_frame[fluids_hisdex][idx] = frame_streamlines[idx]; - vis_data->history_scalars[fluids_hisdex].x[idx] = scalar_frames_streamlines.x[idx]; - vis_data->history_scalars[fluids_hisdex].y[idx] = scalar_frames_streamlines.y[idx]; + vis_data->history_scalars[fluids_hisdex]->x[idx] = scalar_frames_streamlines.x[idx]; + vis_data->history_scalars[fluids_hisdex]->y[idx] = scalar_frames_streamlines.y[idx]; + + // printf("val copy: %p; val orig: %f; test: %p\n", vis_data->history_scalars[fluids_hisdex]->x, scalar_frames_streamlines.x[idx], test->x); vis_data->height[idx] = calculate_height_plot(heightplots_get_dataset(), idx); vis_data->normals[idx] = calculate_normal_vector(vis_data->height, idx, i, j); @@ -422,6 +427,7 @@ void setup_arrays(struct vis_data_arrays *vis_data) } } + if (colormap_get_autoscaling()) { colormap_set_scale_min(scale_min); diff --git a/Smoke/fluids.h b/Smoke/fluids.h index d28f176..cdae24e 100644 --- a/Smoke/fluids.h +++ b/Smoke/fluids.h @@ -63,7 +63,7 @@ struct vis_data_arrays { fftw_real *height; struct point *normals; fftw_real *history_frame[HISTORY_SIZE]; - struct fftw_real_xy history_scalars[HISTORY_SIZE]; + struct fftw_real_xy *history_scalars[HISTORY_SIZE]; }; diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index 96c99af..cd2e5c8 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -737,13 +737,14 @@ static void render_streamlines(void) i = j = k = l = 0; DIM = fluids_get_dim(); +#if 0 for (i = 0; i < get_cur_seedpoint(); i++) { p = get_seedpoint(i); glBegin(GL_LINE_STRIP); - frame_history = streamlines_get_history_scalars(); + frame_history = streamlines_get_history_scalars(i); for (j = 0; j < HISTORY_SIZE; j++) { @@ -762,6 +763,7 @@ static void render_streamlines(void) } glEnd(); } +#endif } static void render_flowvis(void) @@ -977,7 +979,6 @@ void visualize(struct vis_data_arrays *vis_data) render_normals(); } - render_streamlines(); //create an orthographic projection matrix for rendering the legendbar glMatrixMode(GL_PROJECTION); glPushMatrix(); diff --git a/Smoke/smoke.bin b/Smoke/smoke.bin index 1e708e4..d818e11 100755 Binary files a/Smoke/smoke.bin and b/Smoke/smoke.bin differ diff --git a/Smoke/streamlines.c b/Smoke/streamlines.c index 0239fcf..1863439 100644 --- a/Smoke/streamlines.c +++ b/Smoke/streamlines.c @@ -19,7 +19,7 @@ static int streamlines_dataset = DATASET_RHO; static float streamlines_alpha = 1.0f; static fftw_real *streamlines_frame; -struct fftw_real_xy *streamlines_history_scalars; +struct fftw_real_xy **streamlines_history_scalars; void streamlines_set_render(int render_streamlines) { @@ -81,14 +81,14 @@ fftw_real *streamlines_get_frame(void) return streamlines_frame; } -void streamlines_set_history_scalars(struct fftw_real_xy *history) +void streamlines_set_history_scalars(struct fftw_real_xy **history) { streamlines_history_scalars = history; } -struct fftw_real_xy *streamlines_get_history_scalars(void) +struct fftw_real_xy *streamlines_get_history_scalars(int hisdex) { - return streamlines_history_scalars; + return streamlines_history_scalars[hisdex]; } diff --git a/Smoke/streamlines.h b/Smoke/streamlines.h index 7c62a98..3e96fd2 100644 --- a/Smoke/streamlines.h +++ b/Smoke/streamlines.h @@ -19,8 +19,8 @@ int streamlines_get_dataset(void); void streamlines_set_frame(fftw_real *frame); 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_scalars(struct fftw_real_xy **history); +struct fftw_real_xy *streamlines_get_history_scalars(int hisdex); struct color4f streamlines_get_color(float value); -- cgit v0.12