1
0
Fork 0

Parameter tweaking ... starting to stub in fog support.

This commit is contained in:
curt 1997-05-19 18:22:41 +00:00
parent 3768b119f5
commit 0341d3d05e
3 changed files with 41 additions and 20 deletions

View file

@ -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.
*
*/

View file

@ -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 );
/**/glDepthFunc(GL_LEQUAL);
/* glEnable( GL_FOG );
glFog( GL_FOG_MODE, GL_LINEAR );
glFogf( GL_FOG_END, 1000.0 ); */
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.
*

View file

@ -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.
*