diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2008-01-08 20:37:54 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2008-01-08 20:37:54 (GMT) |
commit | c3c41f66a48f40ae3471155ac302cc78175b5eac (patch) | |
tree | b34ad8798cbfa5b784c357df81b00d222c9247e9 /Smoke/renderer_gl.c | |
parent | 63b3f9cf7f2a5d2822f62c672eabe2e893bac441 (diff) | |
download | 2iv35-c3c41f66a48f40ae3471155ac302cc78175b5eac.zip 2iv35-c3c41f66a48f40ae3471155ac302cc78175b5eac.tar.gz 2iv35-c3c41f66a48f40ae3471155ac302cc78175b5eac.tar.bz2 |
minor fixes
Diffstat (limited to 'Smoke/renderer_gl.c')
-rw-r--r-- | Smoke/renderer_gl.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index 13b3b90..5e6bb95 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -52,6 +52,8 @@ #define BITMAP_WIDTH 0x12 #define BITMAP_HEIGHT 0x16 +#define NORMAL_SCALE 16 + float x_pos = DEFAULT_X_POS; float y_pos = DEFAULT_Y_POS; float z_pos = DEFAULT_ZOOM; @@ -155,7 +157,7 @@ static void render_grid(void) DIM = fluids_get_dim(); - glColor3f(0.0f, 0.0f, 0.5f); + glColor4f(0.0f, 0.0f, 0.5f, 0.8f); glLineWidth(1.0f); for (i = 0; i < winWidth; i += DIM) { @@ -214,16 +216,16 @@ static void render_normal(void) static void render_normals(void) { int i, j, idx, DIM; - double px, py; fftw_real wn, hn; fftw_real *height; - float normal_scale = 10.0f; + struct point *normals; 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 height = heightplots_get_frame(); + normals = normals_get_frame(); glDisable(GL_LIGHTING); glBegin(GL_LINES); @@ -233,14 +235,19 @@ static void render_normals(void) { for (i = 0; i < DIM; i++) { + int height_multiplier; + double px, py, pz; + + height_multiplier = heightplots_get_height(); idx = (j * DIM) + i; px = wn + (fftw_real)i * wn; py = hn + (fftw_real)(j + 1) * hn; + pz = height[idx] *height_multiplier; - glVertex3f(px, py, height[idx]); - glVertex3f(px + normal_array[idx].x * normal_scale, - py + normal_array[idx].y * normal_scale, - height[idx] + normal_array[idx].z * normal_scale); + glVertex3f(px, py, pz); + glVertex3f(px +(normal_array[idx].x *NORMAL_SCALE), + py +(normal_array[idx].y *NORMAL_SCALE), + pz +(normal_array[idx].z *NORMAL_SCALE)); } } glEnable(GL_LIGHTING); |