summaryrefslogtreecommitdiffstats
path: root/Smoke/renderer_gl.c
diff options
context:
space:
mode:
Diffstat (limited to 'Smoke/renderer_gl.c')
-rw-r--r--Smoke/renderer_gl.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c
index 19b982b..7bbf044 100644
--- a/Smoke/renderer_gl.c
+++ b/Smoke/renderer_gl.c
@@ -134,7 +134,8 @@ static void render_legend(void)
static void render_normal(void)
{
- int i, j, idx; double px,py;
+ 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
float normal_scale = 10.0f;
@@ -143,9 +144,9 @@ static void render_normal(void)
glBegin(GL_LINES);
glColor3f(1.0f, 0.2f, 0.0f);
- for (i = 0; i < DIM - 1; i++)
+ for (j = 0; j < DIM - 1; j++)
{
- for (j = 0; j < DIM - 1; j++)
+ for (i = 0; i < DIM; i++)
{
idx = (j * DIM) + i;
px = wn + (fftw_real)i * wn;
@@ -171,8 +172,6 @@ static void render_smoke(void)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- //glDisable(GL_LIGHTING);
-
for (j = 0; j < DIM - 1; j++) //draw smoke
{
glBegin(GL_TRIANGLE_STRIP);
@@ -184,9 +183,8 @@ static void render_smoke(void)
color = colormap_get_color(get_dataset(idx));
glColor4f(color.r, color.g, color.b, color.a);
- glVertex3f(px, py, height_array[idx]); // vertex 1
-
glNormal3f(normal_array[idx].x, normal_array[idx].y, normal_array[idx].z);
+ glVertex3f(px, py, height_array[idx]); // vertex 1
for (i = 0; i < DIM - 1; i++)
{
@@ -196,18 +194,16 @@ static void render_smoke(void)
get_dataset(idx);
color = colormap_get_color(get_dataset(idx));
glColor4f(color.r, color.g, color.b, color.a);
- glVertex3f(px, py, height_array[idx]); // vertex 2
-
glNormal3f(normal_array[idx].x, normal_array[idx].y, normal_array[idx].z);
+ glVertex3f(px, py, height_array[idx]); // vertex 2
px = wn + (fftw_real)(i + 1) * wn;
py = hn + (fftw_real)j * hn;
idx = (j * DIM) + (i + 1);
color = colormap_get_color(get_dataset(idx));
glColor4f(color.r, color.g, color.b, color.a);
- glVertex3f(px, py, height_array[idx]); // vertex 3
-
glNormal3f(normal_array[idx].x, normal_array[idx].y, normal_array[idx].z);
+ glVertex3f(px, py, height_array[idx]); // vertex 3
}
px = wn + (fftw_real)(DIM - 1) * wn;
@@ -215,9 +211,8 @@ static void render_smoke(void)
idx = ((j + 1) * DIM) + (DIM - 1);
color = colormap_get_color(get_dataset(idx));
glColor4f(color.r, color.g, color.b, color.a);
- glVertex3f(px, py, height_array[idx]); // vertex 4
-
glNormal3f(normal_array[idx].x, normal_array[idx].y, normal_array[idx].z);
+ glVertex3f(px, py, height_array[idx]); // vertex 4
glEnd();
}
@@ -590,9 +585,9 @@ void render_flowvis(fftw_real *field)
void renderer_init_gl(void)
{
- float LightAmbient[] = { 0.00f, 0.00f, 0.00f, 1.00f }; // Ambient light values
- float LightDiffuse[] = { 0.80f, 0.50f, 0.50f, 0.00f }; // Diffuse light values
- float LightPosition[] = { -300.0f, -300.0f, -500.0f, 1.00f }; // Position of the light source
+ float LightAmbient[] = { 0.10f, 0.10f, 0.10f, 1.00f }; // Ambient light values
+ float LightDiffuse[] = { 0.40f, 0.40f, 0.40f, 0.00f }; // Diffuse light values
+ float LightPosition[] = { -300.0f, -300.0f, -300.0f, 1.00f }; // Position of the light source
glShadeModel(GL_SMOOTH); // Enable smooth shading
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black background
@@ -600,7 +595,7 @@ void renderer_init_gl(void)
glDepthFunc(GL_LESS); // The type of depth testing to do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really nice perspective calculations
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); // Really nice point smoothing
- //glEnable(GL_BLEND);
+ glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
@@ -710,3 +705,8 @@ int normals_get_render(void)
{
return normals_render;
}
+
+void normals_set_render(int normals)
+{
+ normals_render = normals;
+}