diff options
-rw-r--r-- | Smoke/Week 2.suo | bin | 78336 -> 78336 bytes | |||
-rw-r--r-- | Smoke/renderer_gl.c | 12 | ||||
-rw-r--r-- | Smoke/seedpoint.c | 2 | ||||
-rw-r--r-- | Smoke/seedpoint.h | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo Binary files differindex 0dce0af..7c0de3f 100644 --- a/Smoke/Week 2.suo +++ b/Smoke/Week 2.suo diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index 9bbd754..57ed71f 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -764,12 +764,16 @@ static void render_streamlines(void) struct point p; struct fftw_real_xy *frame_history; fftw_real cell_x, cell_y; + float scale = 10.0f; + + glLineWidth(2.5f); i = j = k = l = 0; DIM = fluids_get_dim(); for (i = 0; i < get_cur_seedpoint(); i++) { p = get_seedpoint(i); + p.y = winHeight - p.y; glBegin(GL_LINE_STRIP); @@ -783,15 +787,19 @@ static void render_streamlines(void) idx_x = round(p.x / cell_x); idx_y = round(p.y / cell_y); - idx = (int)(cell_x * cell_y); + idx = (idx_x + (idx_y * DIM)) % (DIM * DIM); vx = (float)frame_history->x[idx]; vy = (float)frame_history->y[idx]; - glVertex3f(p.x + (vx * 10000), winHeight - p.y + (vy * 10000), 0.0f - j * cell_x); + p.x += vx * cell_x * scale; + p.y += vy * cell_y * scale; + + glVertex3f(p.x, p.y, j * cell_x); } glEnd(); } + glLineWidth(1.0f); } static void render_flowvis(void) diff --git a/Smoke/seedpoint.c b/Smoke/seedpoint.c index cf48160..98a7aff 100644 --- a/Smoke/seedpoint.c +++ b/Smoke/seedpoint.c @@ -127,7 +127,7 @@ void render_seedpoints(void) {
float color_scale = (float)i/MAX_SEEDPOINTS;
- glColor3f(color_scale, 1.0f - color_scale, 1.0f - color_scale);
+ glColor3f(color_scale, 1.0f - color_scale, 0.0f);
glPushMatrix();
glTranslatef(seedpoints[i].x, winHeight - seedpoints[i].y, seedpoints[i].z);
diff --git a/Smoke/seedpoint.h b/Smoke/seedpoint.h index 557f59f..446f126 100644 --- a/Smoke/seedpoint.h +++ b/Smoke/seedpoint.h @@ -1,7 +1,7 @@ #ifndef _SEEDPOINT_H
#define _SEEDPOINT_H
-#define MAX_SEEDPOINTS 16
+#define MAX_SEEDPOINTS 8
void create_seedpoint(float mx, float my);
void delete_seedpoint(int seedpoint_nr);
|