From 0341d3d05ea39f873f260e20cab2061f71b20e58 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 19 May 1997 18:22:41 +0000 Subject: [PATCH] Parameter tweaking ... starting to stub in fog support. --- Main/gltkkey.c | 11 +++++++---- Main/gltkmain.c | 33 ++++++++++++++++++++++++--------- Main/mesh2ogl.c | 17 ++++++++++------- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/Main/gltkkey.c b/Main/gltkkey.c index 8901eb8dc..2df8462b9 100644 --- a/Main/gltkkey.c +++ b/Main/gltkkey.c @@ -25,10 +25,10 @@ GLenum key(int k, GLenum mask) { switch (k) { case TK_UP: - c->elev -= 0.01; + c->elev -= 0.1; return GL_TRUE; case TK_DOWN: - c->elev += 0.01; + c->elev += 0.1; return GL_TRUE; case TK_LEFT: c->aileron += 0.01; @@ -58,7 +58,10 @@ GLenum key(int k, GLenum mask) { /* $Log$ -/* Revision 1.1 1997/05/16 16:05:51 curt -/* Initial revision. +/* Revision 1.2 1997/05/19 18:22:41 curt +/* Parameter tweaking ... starting to stub in fog support. /* + * Revision 1.1 1997/05/16 16:05:51 curt + * Initial revision. + * */ diff --git a/Main/gltkmain.c b/Main/gltkmain.c index 49f55a3d2..49088f21c 100644 --- a/Main/gltkmain.c +++ b/Main/gltkmain.c @@ -47,16 +47,27 @@ static GLint mesh; /* init_view() -- Setup view parameters */ static void init_view() { /* if the 4th field is 0.0, this specifies a direction ... */ - static GLfloat pos[4] = {2.0, 2.0, 3.0, 0.0 }; + static GLfloat pos[4] = {-3.0, 1.0, 3.0, 0.0 }; + static GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0}; + static GLfloat local_view[] = { 0.0 }; glLightfv( GL_LIGHT0, GL_POSITION, pos ); glEnable( GL_CULL_FACE ); glEnable( GL_LIGHTING ); glEnable( GL_LIGHT0 ); +/**/glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); glEnable( GL_DEPTH_TEST ); - /* glEnable( GL_FOG ); - glFog( GL_FOG_MODE, GL_LINEAR ); - glFogf( GL_FOG_END, 1000.0 ); */ +/**/glDepthFunc(GL_LEQUAL); + +/* glEnable( GL_FOG ); + glFogi (GL_FOG_MODE, GL_LINEAR); + glFogf (GL_FOG_START, 1.0); + glFogf (GL_FOG_END, 100.0); + glFogfv (GL_FOG_COLOR, fogColor); + glFogf (GL_FOG_DENSITY, 0.35); + glHint (GL_FOG_HINT, GL_DONT_CARE); + */ + glClearColor(0.6, 0.6, 0.9, 1.0); } @@ -137,9 +148,9 @@ static void update_view() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(80.0, 1.0/win_ratio, 1.0, 6000.0); + gluPerspective(45.0, 1.0/win_ratio, 1.0, 6000.0); gluLookAt(f->pos_x, f->pos_y, f->pos_z, - f->pos_x + cos(f->Psi), f->pos_y + sin(f->Psi), f->pos_z - 0.5, + f->pos_x + cos(f->Psi), f->pos_y + sin(f->Psi), f->pos_z, 0.0, 0.0, 1.0); } @@ -229,7 +240,8 @@ int main( int argc, char *argv[] ) { init_scene(); /* Set initial position and slew parameters */ - slew_init(-406658.0, 129731.0, 344, 0.79); + /* slew_init(-398391.3, 120070.4, 244, 3.1415); */ /* GLOBE Airport */ + slew_init(-398673.28,120625.64, 53, 4.38); /* call reshape() on expose events */ tkExposeFunc( reshape ); @@ -254,9 +266,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.2 1997/05/17 00:17:34 curt -/* Trying to stub in support for standard OpenGL. +/* Revision 1.3 1997/05/19 18:22:42 curt +/* Parameter tweaking ... starting to stub in fog support. /* + * Revision 1.2 1997/05/17 00:17:34 curt + * Trying to stub in support for standard OpenGL. + * * Revision 1.1 1997/05/16 16:05:52 curt * Initial revision. * diff --git a/Main/mesh2ogl.c b/Main/mesh2ogl.c index 5c6b3ad9b..9e0453da9 100644 --- a/Main/mesh2ogl.c +++ b/Main/mesh2ogl.c @@ -40,7 +40,7 @@ GLint mesh_to_ogl(struct mesh *m) { int i, j, istep, jstep, iend, jend; float temp; - istep = jstep = 150; /* Detail level 1 -- 1200 ... */ + istep = jstep = 4; /* Detail level 1 -- 1200 ... */ mesh = glGenLists(1); glNewList(mesh, GL_COMPILE); @@ -57,10 +57,10 @@ GLint mesh_to_ogl(struct mesh *m) { x1 = m->originx; x2 = x1 + (m->row_step * jstep); for ( j = 0; j < jend; j += jstep ) { - z11 = 0.12 * m->mesh_data[j * m->rows + i ]; - z12 = 0.12 * m->mesh_data[j * m->rows + (i+istep)]; - z21 = 0.12 * m->mesh_data[(j+jstep) * m->rows + i ]; - z22 = 0.12 * m->mesh_data[(j+jstep) * m->rows + (i+istep)]; + z11 = 0.03 * m->mesh_data[j * m->rows + i ]; + z12 = 0.03 * m->mesh_data[j * m->rows + (i+istep)]; + z21 = 0.03 * m->mesh_data[(j+jstep) * m->rows + i ]; + z22 = 0.03 * m->mesh_data[(j+jstep) * m->rows + (i+istep)]; /* printf("x1 = %f y1 = %f\n", x1, y1); printf("x2 = %f y2 = %f\n", x2, y2); @@ -109,9 +109,12 @@ GLint mesh_to_ogl(struct mesh *m) { /* $Log$ -/* Revision 1.2 1997/05/17 00:17:35 curt -/* Trying to stub in support for standard OpenGL. +/* Revision 1.3 1997/05/19 18:22:42 curt +/* Parameter tweaking ... starting to stub in fog support. /* + * Revision 1.2 1997/05/17 00:17:35 curt + * Trying to stub in support for standard OpenGL. + * * Revision 1.1 1997/05/16 16:05:52 curt * Initial revision. * -- 2.39.2