Added GNU copyright headers.
Fog now works!
This commit is contained in:
parent
726c961553
commit
f08257175f
7 changed files with 166 additions and 25 deletions
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -58,9 +74,13 @@ GLenum GLTKkey(int k, GLenum mask) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:49 curt
|
/* Revision 1.2 1997/05/23 15:40:24 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:49 curt
|
||||||
|
* Renamed due to added GLUT support.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/05/19 18:22:41 curt
|
* Revision 1.2 1997/05/19 18:22:41 curt
|
||||||
* Parameter tweaking ... starting to stub in fog support.
|
* Parameter tweaking ... starting to stub in fog support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -23,9 +39,13 @@ GLenum GLTKkey(int k, GLenum mask);
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:49 curt
|
/* Revision 1.2 1997/05/23 15:40:24 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:49 curt
|
||||||
|
* Renamed due to added GLUT support.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/05/17 00:17:34 curt
|
* Revision 1.2 1997/05/17 00:17:34 curt
|
||||||
* Trying to stub in support for standard OpenGL.
|
* Trying to stub in support for standard OpenGL.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -68,9 +84,13 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/05/23 00:35:12 curt
|
/* Revision 1.3 1997/05/23 15:40:25 curt
|
||||||
/* Trying to get fog to work ...
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/05/23 00:35:12 curt
|
||||||
|
* Trying to get fog to work ...
|
||||||
|
*
|
||||||
* Revision 1.1 1997/05/21 15:57:50 curt
|
* Revision 1.1 1997/05/21 15:57:50 curt
|
||||||
* Renamed due to added GLUT support.
|
* Renamed due to added GLUT support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -27,9 +43,13 @@ void GLUTkey(unsigned char k, int x, int y);
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:51 curt
|
/* Revision 1.2 1997/05/23 15:40:25 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:51 curt
|
||||||
|
* Renamed due to added GLUT support.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/05/17 00:17:34 curt
|
* Revision 1.2 1997/05/17 00:17:34 curt
|
||||||
* Trying to stub in support for standard OpenGL.
|
* Trying to stub in support for standard OpenGL.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson for OpenGL, started May 1997.
|
* Written by Curtis Olson for OpenGL, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -44,7 +60,7 @@ static GLfloat win_ratio = 1.0;
|
||||||
/* pointer to terrain mesh structure */
|
/* pointer to terrain mesh structure */
|
||||||
static GLint mesh;
|
static GLint mesh;
|
||||||
|
|
||||||
double fogDensity = 0.04;
|
double fogDensity = 0.001;
|
||||||
|
|
||||||
/* init_view() -- Setup view parameters */
|
/* init_view() -- Setup view parameters */
|
||||||
static void init_view() {
|
static void init_view() {
|
||||||
|
@ -68,11 +84,11 @@ static void init_view() {
|
||||||
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
|
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
|
||||||
|
|
||||||
glEnable( GL_FOG );
|
glEnable( GL_FOG );
|
||||||
glFogi (GL_FOG_MODE, GL_EXP);
|
glFogi (GL_FOG_MODE, GL_LINEAR);
|
||||||
/* glFogf (GL_FOG_START, 1.0); */
|
/* glFogf (GL_FOG_START, 1.0); */
|
||||||
/* glFogf (GL_FOG_END, 1000.0); */
|
glFogf (GL_FOG_END, 2000.0);
|
||||||
glFogfv (GL_FOG_COLOR, fogColor);
|
glFogfv (GL_FOG_COLOR, fogColor);
|
||||||
glFogf (GL_FOG_DENSITY, fogDensity);
|
/* glFogf (GL_FOG_DENSITY, fogDensity); */
|
||||||
/* glHint (GL_FOG_HINT, GL_FASTEST); */
|
/* glHint (GL_FOG_HINT, GL_FASTEST); */
|
||||||
|
|
||||||
glClearColor(0.6, 0.6, 0.9, 1.0);
|
glClearColor(0.6, 0.6, 0.9, 1.0);
|
||||||
|
@ -91,7 +107,7 @@ static void init_scene() {
|
||||||
GLint make_mesh() {
|
GLint make_mesh() {
|
||||||
GLint mesh;
|
GLint mesh;
|
||||||
|
|
||||||
mesh = mesh_to_ogl(mesh_ptr);
|
mesh = mesh2GL(mesh_ptr);
|
||||||
|
|
||||||
return(mesh);
|
return(mesh);
|
||||||
}
|
}
|
||||||
|
@ -106,8 +122,10 @@ static void update_view() {
|
||||||
/* Tell GL we are about to modify the projection parameters */
|
/* Tell GL we are about to modify the projection parameters */
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
gluPerspective(45.0, 1.0/win_ratio, 1.0, 6000.0);
|
gluPerspective(45.0, 1.0/win_ratio, 1.0, 6000.0);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
gluLookAt(f->pos_x, f->pos_y, f->pos_z,
|
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,
|
f->pos_x + cos(f->Psi), f->pos_y + sin(f->Psi), f->pos_z,
|
||||||
0.0, 0.0, 1.0);
|
0.0, 0.0, 1.0);
|
||||||
|
@ -123,7 +141,7 @@ static void draw_scene( void ) {
|
||||||
|
|
||||||
/* Tell GL we are switching to model view parameters */
|
/* Tell GL we are switching to model view parameters */
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
/* glLoadIdentity(); */
|
||||||
|
|
||||||
/* draw terrain mesh */
|
/* draw terrain mesh */
|
||||||
draw_mesh();
|
draw_mesh();
|
||||||
|
@ -211,8 +229,7 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
/* Set initial position and slew parameters */
|
/* Set initial position and slew parameters */
|
||||||
/* slew_init(-398391.3, 120070.4, 244, 3.1415); */ /* GLOBE Airport */
|
/* slew_init(-398391.3, 120070.4, 244, 3.1415); */ /* GLOBE Airport */
|
||||||
/* slew_init(-398673.28,120625.64, 53, 4.38); */
|
slew_init(-398673.28,120625.64, 53, 4.38);
|
||||||
slew_init(0.0, 0.0, 53, 0.77);
|
|
||||||
|
|
||||||
#ifdef GLUT
|
#ifdef GLUT
|
||||||
/* call reshape() on window resizes */
|
/* call reshape() on window resizes */
|
||||||
|
@ -255,9 +272,13 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/05/23 00:35:12 curt
|
/* Revision 1.3 1997/05/23 15:40:25 curt
|
||||||
/* Trying to get fog to work ...
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/05/23 00:35:12 curt
|
||||||
|
* Trying to get fog to work ...
|
||||||
|
*
|
||||||
* Revision 1.1 1997/05/21 15:57:51 curt
|
* Revision 1.1 1997/05/21 15:57:51 curt
|
||||||
* Renamed due to added GLUT support.
|
* Renamed due to added GLUT support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
#
|
#
|
||||||
# Written by Curtis Olson, started May 1997.
|
# Written by Curtis Olson, started May 1997.
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
# (Log is kept at end of this file)
|
# (Log is kept at end of this file)
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@ -86,6 +102,10 @@ mesh2GL.o: mesh2GL.c ../scenery/mesh.h
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.4 1997/05/23 15:40:26 curt
|
||||||
|
# Added GNU copyright headers.
|
||||||
|
# Fog now works!
|
||||||
|
#
|
||||||
# Revision 1.3 1997/05/23 00:35:13 curt
|
# Revision 1.3 1997/05/23 00:35:13 curt
|
||||||
# Trying to get fog to work ...
|
# Trying to get fog to work ...
|
||||||
#
|
#
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* (Log is kept at end of this file)
|
* (Log is kept at end of this file)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -35,7 +51,7 @@ static void mat3_cross_product(float result_vec[3], register float vec1[3],
|
||||||
|
|
||||||
|
|
||||||
/* walk through mesh and make ogl calls */
|
/* walk through mesh and make ogl calls */
|
||||||
GLint mesh_to_ogl(struct mesh *m) {
|
GLint mesh2GL(struct mesh *m) {
|
||||||
GLint mesh;
|
GLint mesh;
|
||||||
/* static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 }; */
|
/* static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 }; */
|
||||||
|
|
||||||
|
@ -44,7 +60,7 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
int i, j, istep, jstep, iend, jend;
|
int i, j, istep, jstep, iend, jend;
|
||||||
float temp;
|
float temp;
|
||||||
|
|
||||||
istep = jstep = 25; /* Detail level 1 -- 1200 ... */
|
istep = jstep = 10; /* Detail level 1 -- 1200 ... */
|
||||||
|
|
||||||
mesh = glGenLists(1);
|
mesh = glGenLists(1);
|
||||||
glNewList(mesh, GL_COMPILE);
|
glNewList(mesh, GL_COMPILE);
|
||||||
|
@ -53,11 +69,11 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
iend = m->cols - 1;
|
iend = m->cols - 1;
|
||||||
jend = m->rows - 1;
|
jend = m->rows - 1;
|
||||||
|
|
||||||
y1 = 0.0; /* y1 = m->originy; */
|
y1 = m->originy;
|
||||||
y2 = y1 + (m->col_step * istep);
|
y2 = y1 + (m->col_step * istep);
|
||||||
|
|
||||||
for ( i = 0; i < iend; i += istep ) {
|
for ( i = 0; i < iend; i += istep ) {
|
||||||
x1 = 0.0; /* x1 = m->originx; */
|
x1 = m->originx;
|
||||||
x2 = x1 + (m->row_step * jstep);
|
x2 = x1 + (m->row_step * jstep);
|
||||||
for ( j = 0; j < jend; j += jstep ) {
|
for ( j = 0; j < jend; j += jstep ) {
|
||||||
z11 = 0.03 * m->mesh_data[j * m->rows + i ];
|
z11 = 0.03 * m->mesh_data[j * m->rows + i ];
|
||||||
|
@ -112,9 +128,13 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/05/23 00:35:13 curt
|
/* Revision 1.3 1997/05/23 15:40:26 curt
|
||||||
/* Trying to get fog to work ...
|
/* Added GNU copyright headers.
|
||||||
|
/* Fog now works!
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/05/23 00:35:13 curt
|
||||||
|
* Trying to get fog to work ...
|
||||||
|
*
|
||||||
* Revision 1.1 1997/05/21 15:57:52 curt
|
* Revision 1.1 1997/05/21 15:57:52 curt
|
||||||
* Renamed due to added GLUT support.
|
* Renamed due to added GLUT support.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue