Trying to get fog to work ...
This commit is contained in:
parent
a104d9c820
commit
1d7a109e9a
6 changed files with 131 additions and 132 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "GLUTkey.h"
|
#include "GLUTkey.h"
|
||||||
#include "../aircraft/aircraft.h"
|
#include "../aircraft/aircraft.h"
|
||||||
|
|
||||||
|
extern double fogDensity;
|
||||||
|
|
||||||
/* Handle keyboard events */
|
/* Handle keyboard events */
|
||||||
void GLUTkey(unsigned char k, int x, int y) {
|
void GLUTkey(unsigned char k, int x, int y) {
|
||||||
|
@ -48,6 +49,17 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case 4:
|
case 4:
|
||||||
c->throttle[0] += 0.05;
|
c->throttle[0] += 0.05;
|
||||||
|
return;
|
||||||
|
case 122:
|
||||||
|
fogDensity *= 1.10;
|
||||||
|
glFogf(GL_FOG_DENSITY, fogDensity);
|
||||||
|
printf("Fog density = %.4f\n", fogDensity);
|
||||||
|
return;
|
||||||
|
case 90:
|
||||||
|
fogDensity /= 1.10;
|
||||||
|
glFogf(GL_FOG_DENSITY, fogDensity);
|
||||||
|
printf("Fog density = %.4f\n", fogDensity);
|
||||||
|
return;
|
||||||
case 27: /* ESC */
|
case 27: /* ESC */
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -56,9 +68,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:50 curt
|
/* Revision 1.2 1997/05/23 00:35:12 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Trying to get fog to work ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:50 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.
|
||||||
*
|
*
|
||||||
|
|
|
@ -44,25 +44,36 @@ 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;
|
||||||
|
|
||||||
/* init_view() -- Setup view parameters */
|
/* init_view() -- Setup view parameters */
|
||||||
static void init_view() {
|
static void init_view() {
|
||||||
/* if the 4th field is 0.0, this specifies a direction ... */
|
/* if the 4th field is 0.0, this specifies a direction ... */
|
||||||
static GLfloat pos[4] = {-3.0, 1.0, 3.0, 0.0 };
|
static GLfloat pos[4] = {-3.0, 1.0, 3.0, 0.0 };
|
||||||
|
static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 };
|
||||||
static GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
|
static GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
|
||||||
|
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, pos );
|
glEnable( GL_DEPTH_TEST );
|
||||||
glEnable( GL_CULL_FACE );
|
glEnable( GL_CULL_FACE );
|
||||||
|
|
||||||
|
/* If enabled, normal vectors specified with glNormal are scaled
|
||||||
|
to unit length after transformation. See glNormal. */
|
||||||
|
glEnable( GL_NORMALIZE );
|
||||||
|
|
||||||
|
glLightfv( GL_LIGHT0, GL_POSITION, pos );
|
||||||
glEnable( GL_LIGHTING );
|
glEnable( GL_LIGHTING );
|
||||||
glEnable( GL_LIGHT0 );
|
glEnable( GL_LIGHT0 );
|
||||||
glEnable( GL_DEPTH_TEST );
|
|
||||||
|
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color );
|
||||||
|
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
|
||||||
|
|
||||||
glEnable( GL_FOG );
|
glEnable( GL_FOG );
|
||||||
glFogi (GL_FOG_MODE, GL_LINEAR);
|
glFogi (GL_FOG_MODE, GL_EXP);
|
||||||
/* glFogf (GL_FOG_START, 1.0); */
|
/* glFogf (GL_FOG_START, 1.0); */
|
||||||
glFogf (GL_FOG_END, 1000.0);
|
/* glFogf (GL_FOG_END, 1000.0); */
|
||||||
glFogfv (GL_FOG_COLOR, fogColor);
|
glFogfv (GL_FOG_COLOR, fogColor);
|
||||||
glFogf (GL_FOG_DENSITY, 0.04);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -73,10 +84,6 @@ static void init_scene() {
|
||||||
|
|
||||||
/* make terrain mesh */
|
/* make terrain mesh */
|
||||||
mesh = make_mesh();
|
mesh = make_mesh();
|
||||||
|
|
||||||
/* If enabled, normal vectors specified with glNormal are scaled
|
|
||||||
to unit length after transformation. See glNormal. */
|
|
||||||
glEnable( GL_NORMALIZE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,50 +97,6 @@ GLint make_mesh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create the terrain mesh */
|
|
||||||
GLint make_mesh_old() {
|
|
||||||
GLint mesh;
|
|
||||||
static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 };
|
|
||||||
|
|
||||||
mesh = glGenLists(1);
|
|
||||||
glNewList(mesh, GL_COMPILE);
|
|
||||||
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color );
|
|
||||||
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
|
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glVertex3f(-10.0, -10.0, 0.0);
|
|
||||||
glVertex3f(0.0, -10.0, 0.0);
|
|
||||||
glVertex3f(0.0, 0.0, 1.0);
|
|
||||||
glVertex3f(-10.0, 0.0, 1.0);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glVertex3f(-10.0, 0.0, 1.0);
|
|
||||||
glVertex3f(0.0, 0.0, 1.0);
|
|
||||||
glVertex3f(0.0, 10.0, 0.0);
|
|
||||||
glVertex3f(-10.0, 10.0, 0.0);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glVertex3f(0.0, 0.0, 0.0);
|
|
||||||
glVertex3f(10.0, 0.0, 2.0);
|
|
||||||
glVertex3f(10.0, 10.0, 2.0);
|
|
||||||
glVertex3f(0.0, 10.0, 0.0);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glVertex3f(0.0, -10.0, -1.0);
|
|
||||||
glVertex3f(10.0, -10.0, 0.0);
|
|
||||||
glVertex3f(10.0, 0.0, -1.0);
|
|
||||||
glVertex3f(0.0, 0.0, 0.0);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
return(mesh);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* update the view volume */
|
/* update the view volume */
|
||||||
static void update_view() {
|
static void update_view() {
|
||||||
struct flight_params *f;
|
struct flight_params *f;
|
||||||
|
@ -153,24 +116,18 @@ static void update_view() {
|
||||||
|
|
||||||
/* draw the scene */
|
/* draw the scene */
|
||||||
static void draw_scene( void ) {
|
static void draw_scene( void ) {
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
|
||||||
|
|
||||||
/* update view volume parameters */
|
/* update view volume parameters */
|
||||||
update_view();
|
update_view();
|
||||||
|
|
||||||
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||||
|
|
||||||
/* 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();
|
||||||
|
|
||||||
/* glTranslatef(0.0, 0.0, -5.0); */
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
|
|
||||||
/* draw terrain mesh */
|
/* draw terrain mesh */
|
||||||
draw_mesh();
|
draw_mesh();
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
#ifdef GLUT
|
#ifdef GLUT
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
#elif MESA_TK
|
#elif MESA_TK
|
||||||
|
@ -225,12 +182,12 @@ int main( int argc, char *argv[] ) {
|
||||||
/* initialize GLUT */
|
/* initialize GLUT */
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
/* Define initial window size */
|
|
||||||
glutInitWindowSize(640, 400);
|
|
||||||
|
|
||||||
/* Define Display Parameters */
|
/* Define Display Parameters */
|
||||||
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
||||||
|
|
||||||
|
/* Define initial window size */
|
||||||
|
glutInitWindowSize(640, 400);
|
||||||
|
|
||||||
/* Initialize the main window */
|
/* Initialize the main window */
|
||||||
glutCreateWindow("Terrain Demo");
|
glutCreateWindow("Terrain Demo");
|
||||||
#elif MESA_TK
|
#elif MESA_TK
|
||||||
|
@ -254,7 +211,8 @@ 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 */
|
||||||
|
@ -297,9 +255,12 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:51 curt
|
/* Revision 1.2 1997/05/23 00:35:12 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Trying to get fog to work ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:51 curt
|
||||||
|
* Renamed due to added GLUT support.
|
||||||
|
*
|
||||||
* Revision 1.3 1997/05/19 18:22:42 curt
|
* Revision 1.3 1997/05/19 18:22:42 curt
|
||||||
* Parameter tweaking ... starting to stub in fog support.
|
* Parameter tweaking ... starting to stub in fog support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,12 +37,12 @@ INTERFACE_FILES = GLUTkey.c
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# For OpenGL
|
# For OpenGL
|
||||||
GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11
|
# GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11
|
||||||
|
|
||||||
# For Mesa
|
# For Mesa
|
||||||
# MESA_LIBS = -L/usr/lib/mesa -lMesaaux -lMesatk -lMesaGLU -lMesaGL
|
MESA_LIBS = -L/usr/lib/mesa -lMesaaux -lMesatk -lMesaGLU -lMesaGL
|
||||||
# X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
|
X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
|
||||||
# GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
|
GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = $(STD_CFLAGS) $(INTERFACE_FLAGS)
|
CFLAGS = $(STD_CFLAGS) $(INTERFACE_FLAGS)
|
||||||
|
@ -86,6 +86,9 @@ mesh2GL.o: mesh2GL.c ../scenery/mesh.h
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.3 1997/05/23 00:35:13 curt
|
||||||
|
# Trying to get fog to work ...
|
||||||
|
#
|
||||||
# Revision 1.2 1997/05/21 15:57:52 curt
|
# Revision 1.2 1997/05/21 15:57:52 curt
|
||||||
# Renamed due to added GLUT support.
|
# Renamed due to added GLUT support.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mesh2ogl.c -- walk through a mesh data structure and make ogl calls
|
* mesh2GL.c -- walk through a mesh data structure and make GL calls
|
||||||
*
|
*
|
||||||
* Written by Curtis Olson, started May 1997.
|
* Written by Curtis Olson, started May 1997.
|
||||||
*
|
*
|
||||||
|
@ -37,28 +37,27 @@ 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 mesh_to_ogl(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 }; */
|
||||||
|
|
||||||
float x1, y1, x2, y2, z11, z12, z21, z22;
|
float x1, y1, x2, y2, z11, z12, z21, z22;
|
||||||
float v1[3], v2[3], normal[3];
|
float v1[3], v2[3], normal[3];
|
||||||
int i, j, istep, jstep, iend, jend;
|
int i, j, istep, jstep, iend, jend;
|
||||||
float temp;
|
float temp;
|
||||||
|
|
||||||
istep = jstep = 10; /* Detail level 1 -- 1200 ... */
|
istep = jstep = 25; /* Detail level 1 -- 1200 ... */
|
||||||
|
|
||||||
mesh = glGenLists(1);
|
mesh = glGenLists(1);
|
||||||
glNewList(mesh, GL_COMPILE);
|
glNewList(mesh, GL_COMPILE);
|
||||||
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color );
|
/* glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color ); */
|
||||||
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
|
|
||||||
|
|
||||||
iend = m->cols - 1;
|
iend = m->cols - 1;
|
||||||
jend = m->rows - 1;
|
jend = m->rows - 1;
|
||||||
|
|
||||||
y1 = m->originy;
|
y1 = 0.0; /* 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 = m->originx;
|
x1 = 0.0; /* 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 ];
|
||||||
|
@ -75,8 +74,8 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
v2[0] = x2 - x1; v2[1] = y2 - y1; v2[2] = z22 - z11;
|
v2[0] = x2 - x1; v2[1] = y2 - y1; v2[2] = z22 - z11;
|
||||||
mat3_cross_product(normal, v1, v2);
|
mat3_cross_product(normal, v1, v2);
|
||||||
MAT3_NORMALIZE_VEC(normal,temp);
|
MAT3_NORMALIZE_VEC(normal,temp);
|
||||||
glNormal3fv(normal);
|
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
|
glNormal3fv(normal);
|
||||||
glVertex3f(x1, y1, z11);
|
glVertex3f(x1, y1, z11);
|
||||||
glVertex3f(x2, y1, z21);
|
glVertex3f(x2, y1, z21);
|
||||||
glVertex3f(x2, y2, z22);
|
glVertex3f(x2, y2, z22);
|
||||||
|
@ -89,8 +88,8 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
v2[0] = 0; v2[1] = y2 - y1; v2[2] = z12 - z11;
|
v2[0] = 0; v2[1] = y2 - y1; v2[2] = z12 - z11;
|
||||||
mat3_cross_product(normal, v1, v2);
|
mat3_cross_product(normal, v1, v2);
|
||||||
MAT3_NORMALIZE_VEC(normal,temp);
|
MAT3_NORMALIZE_VEC(normal,temp);
|
||||||
glNormal3fv(normal);
|
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
|
glNormal3fv(normal);
|
||||||
glVertex3f(x1, y1, z11);
|
glVertex3f(x1, y1, z11);
|
||||||
glVertex3f(x2, y2, z22);
|
glVertex3f(x2, y2, z22);
|
||||||
glVertex3f(x1, y2, z12);
|
glVertex3f(x1, y2, z12);
|
||||||
|
@ -113,9 +112,12 @@ GLint mesh_to_ogl(struct mesh *m) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/05/21 15:57:52 curt
|
/* Revision 1.2 1997/05/23 00:35:13 curt
|
||||||
/* Renamed due to added GLUT support.
|
/* Trying to get fog to work ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/05/21 15:57:52 curt
|
||||||
|
* Renamed due to added GLUT support.
|
||||||
|
*
|
||||||
* Revision 1.3 1997/05/19 18:22:42 curt
|
* Revision 1.3 1997/05/19 18:22:42 curt
|
||||||
* Parameter tweaking ... starting to stub in fog support.
|
* Parameter tweaking ... starting to stub in fog support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,14 +19,6 @@
|
||||||
|
|
||||||
/* custom print routine */
|
/* custom print routine */
|
||||||
static int scanner_debug = 0;
|
static int scanner_debug = 0;
|
||||||
static int scanner_msg_len;
|
|
||||||
static char scanner_msg[1024];
|
|
||||||
|
|
||||||
static void scanner_print(char *s) {
|
|
||||||
if ( scanner_debug ) {
|
|
||||||
printf("%s", s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Routines to manage a stack of nested input buffers (for
|
/* Routines to manage a stack of nested input buffers (for
|
||||||
processing the #include directive */
|
processing the #include directive */
|
||||||
|
@ -100,87 +92,111 @@ other .
|
||||||
/* Rules */
|
/* Rules */
|
||||||
%%
|
%%
|
||||||
|
|
||||||
include { scanner_print("return IncludeSym\n");
|
include { if ( scanner_debug ) {
|
||||||
|
printf("return IncludeSym\n");
|
||||||
|
}
|
||||||
return IncludeSym;
|
return IncludeSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh { scanner_print("return MeshSym\n");
|
mesh { if ( scanner_debug ) {
|
||||||
|
printf("return MeshSym\n");
|
||||||
|
}
|
||||||
return MeshSym;
|
return MeshSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
row { scanner_print("return RowSym\n");
|
row { if ( scanner_debug ) {
|
||||||
|
printf("return RowSym\n");
|
||||||
|
}
|
||||||
return RowSym;
|
return RowSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk { scanner_print("return ChunkSym\n");
|
chunk { if ( scanner_debug ) {
|
||||||
|
printf("return ChunkSym\n");
|
||||||
|
}
|
||||||
return ChunkSym;
|
return ChunkSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds { scanner_print("return BoundsSym\n");
|
bounds { if ( scanner_debug ) {
|
||||||
|
printf("return BoundsSym\n");
|
||||||
|
}
|
||||||
return BoundsSym;
|
return BoundsSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
place { scanner_print("return PlaceSym\n");
|
place { if ( scanner_debug ) {
|
||||||
|
printf("return PlaceSym\n");
|
||||||
|
}
|
||||||
return PlaceSym;
|
return PlaceSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ident} { scanner_msg_len = snprintf(scanner_msg, 1024,
|
{ident} { if ( scanner_debug ) {
|
||||||
"return Identifier = %s\n", yytext);
|
printf("return Identifier = %s\n", yytext);
|
||||||
scanner_msg[scanner_msg_len] = '\0';
|
}
|
||||||
scanner_print(scanner_msg);
|
|
||||||
return Identifier;
|
return Identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
{number} { scanner_print("return Number\n");
|
{number} { if ( scanner_debug ) {
|
||||||
|
printf("return Number\n");
|
||||||
|
}
|
||||||
return Number;
|
return Number;
|
||||||
}
|
}
|
||||||
|
|
||||||
{string} { scanner_msg_len = snprintf(scanner_msg, 1024,
|
{string} { if ( scanner_debug ) {
|
||||||
"return StringLiteral = %s\n", yytext);
|
printf("return StringLiteral = %s\n", yytext);
|
||||||
scanner_msg[scanner_msg_len] = '\0';
|
}
|
||||||
scanner_print(scanner_msg);
|
|
||||||
return StringLiteral;
|
return StringLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
{bad_string} { scanner_msg_len = snprintf(scanner_msg, 1024,
|
{bad_string} { if ( scanner_debug ) {
|
||||||
"return BadStringLiteral = %s\n", yytext);
|
printf("return BadStringLiteral = %s\n", yytext);
|
||||||
scanner_msg[scanner_msg_len] = '\0';
|
}
|
||||||
scanner_print(scanner_msg);
|
|
||||||
return BadStringLiteral;
|
return BadStringLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
"\n" { line_num++;
|
"\n" { line_num++;
|
||||||
scanner_msg_len = snprintf(scanner_msg, 1024,
|
if ( scanner_debug ) {
|
||||||
"Line number = %d\n", line_num);
|
printf("Line number = %d\n", line_num);
|
||||||
scanner_msg[scanner_msg_len] = '\0';
|
}
|
||||||
scanner_print(scanner_msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"#" { scanner_print("return HashSym\n");
|
"#" { if ( scanner_debug ) {
|
||||||
|
printf("return HashSym\n");
|
||||||
|
}
|
||||||
return HashSym;
|
return HashSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
"=" { scanner_print("return EqualSym\n");
|
"=" { if ( scanner_debug ) {
|
||||||
|
printf("return EqualSym\n");
|
||||||
|
}
|
||||||
return EqualSym;
|
return EqualSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
"," { scanner_print("return CommaSym\n");
|
"," { if ( scanner_debug ) {
|
||||||
|
printf("return CommaSym\n");
|
||||||
|
}
|
||||||
return CommaSym;
|
return CommaSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
"{" { scanner_print("return LBraceSym\n");
|
"{" { if ( scanner_debug ) {
|
||||||
|
printf("return LBraceSym\n");
|
||||||
|
}
|
||||||
return LBraceSym;
|
return LBraceSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
"}" { scanner_print("return RBraceSym\n");
|
"}" { if ( scanner_debug ) {
|
||||||
|
printf("return RBraceSym\n");
|
||||||
|
}
|
||||||
return RBraceSym;
|
return RBraceSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
"(" { scanner_print("return LParenSym\n");
|
"(" { if ( scanner_debug ) {
|
||||||
|
printf("return LParenSym\n");
|
||||||
|
}
|
||||||
return LParenSym;
|
return LParenSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
")" { scanner_print("return RParenSym\n");
|
")" { if ( scanner_debug ) {
|
||||||
|
printf("return RParenSym\n");
|
||||||
|
}
|
||||||
return RParenSym;
|
return RParenSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,10 +212,9 @@ place { scanner_print("return PlaceSym\n");
|
||||||
|
|
||||||
{ws} { ; }
|
{ws} { ; }
|
||||||
|
|
||||||
{other} { scanner_msg_len = snprintf(scanner_msg, 1024,
|
{other} { if ( scanner_debug ) {
|
||||||
"Scanned some unexpected text = `%s'\n", yytext);
|
printf("Scanned some unexpected text = `%s'\n", yytext);
|
||||||
scanner_msg[scanner_msg_len] = '\0';
|
}
|
||||||
scanner_print(scanner_msg);
|
|
||||||
return ErrorMisc;
|
return ErrorMisc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,18 +12,18 @@ CC = gcc
|
||||||
|
|
||||||
|
|
||||||
SUBDIRS = aircraft controls flight scenery
|
SUBDIRS = aircraft controls flight scenery
|
||||||
MAIN = gltk
|
MAIN = OpenGL
|
||||||
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
for dir in $(SUBDIRS) $(MAIN); do \
|
for dir in $(SUBDIRS) $(MAIN); do \
|
||||||
( cd $$dir; make CC=$(CC) CFLAGS=$(CFLAGS) ) ; \
|
( cd $$dir; make CC=$(CC) ) ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
for dir in $(SUBDIRS) $(MAIN); do \
|
for dir in $(SUBDIRS) $(MAIN); do \
|
||||||
( cd $$dir; make CC=$(CC) CFLAGS=$(CFLAGS) install) ; \
|
( cd $$dir; make CC=$(CC) install) ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ clean:
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.2 1997/05/23 00:35:09 curt
|
||||||
|
# Trying to get fog to work ...
|
||||||
|
#
|
||||||
# Revision 1.1 1997/05/16 15:51:13 curt
|
# Revision 1.1 1997/05/16 15:51:13 curt
|
||||||
# Initial revision.
|
# Initial revision.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue