summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2008-01-10 23:50:12 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2008-01-10 23:50:12 (GMT)
commit28d83930cdf2844b69ac9f51c05e68b41d121307 (patch)
treec3366d61035360bb9e66af59907b5abaf74621ee
parent91f06a00a710267c4d4fc708ff88d63cc42c46fb (diff)
download2iv35-28d83930cdf2844b69ac9f51c05e68b41d121307.zip
2iv35-28d83930cdf2844b69ac9f51c05e68b41d121307.tar.gz
2iv35-28d83930cdf2844b69ac9f51c05e68b41d121307.tar.bz2
betere streamlines
-rw-r--r--Smoke/Week 2.suobin78336 -> 78336 bytes
-rw-r--r--Smoke/renderer_gl.c12
-rw-r--r--Smoke/seedpoint.c2
-rw-r--r--Smoke/seedpoint.h2
4 files changed, 12 insertions, 4 deletions
diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo
index 0dce0af..7c0de3f 100644
--- a/Smoke/Week 2.suo
+++ b/Smoke/Week 2.suo
Binary files differ
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);