1
0
Fork 0

Added command line rendering options:

enable/disable fog/haze
  specify smooth/flat shading
  disable sky blending and just use a solid color
  enable wireframe drawing mode
This commit is contained in:
curt 1998-04-30 12:34:17 +00:00
parent 67cc5c5482
commit d87408c767
5 changed files with 123 additions and 19 deletions

View file

@ -54,7 +54,7 @@
#include <Math/fg_geodesy.h>
#include <Math/mat3.h>
#include <Math/polar.h>
#include <Scenery/scenery.h>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#include <Time/event.hxx>
#include <Time/fg_time.hxx>
@ -184,9 +184,11 @@ const int DefaultViewMode = HUD_VIEW;
// fgInitVisuals() -- Initialize various GL/view parameters
static void fgInitVisuals( void ) {
fgLIGHT *l;
fgOPTIONS *o;
struct fgWEATHER *w;
l = &cur_light_params;
o = &current_options;
w = &current_weather;
// xglDisable( GL_DITHER );
@ -205,8 +207,10 @@ static void fgInitVisuals( void ) {
// xglFogf (GL_FOG_DENSITY, w->visibility);
xglHint (GL_FOG_HINT, GL_NICEST /* GL_FASTEST */ );
// draw wire frame
// xglPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
if ( o->wireframe ) {
// draw wire frame
xglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
}
@ -319,6 +323,7 @@ static void fgRenderFrame( void ) {
fgTIME *t;
fgVIEW *v;
double angle;
GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat color[4] = { 0.54, 0.44, 0.29, 1.0 };
@ -330,6 +335,12 @@ static void fgRenderFrame( void ) {
// update view volume parameters
fgUpdateViewParams();
if ( o->skyblend ) {
glClearColor(black[0], black[1], black[2], black[3]);
} else {
glClearColor(l->sky_color[0], l->sky_color[1],
l->sky_color[2], l->sky_color[3]);
}
xglClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
// Tell GL we are switching to model view parameters
@ -342,7 +353,9 @@ static void fgRenderFrame( void ) {
xglDisable( GL_CULL_FACE );
xglDisable( GL_FOG );
xglShadeModel( GL_SMOOTH );
fgSkyRender();
if ( o->skyblend ) {
fgSkyRender();
}
// setup transformation for drawing astronomical objects
xglPushMatrix();
@ -376,15 +389,21 @@ static void fgRenderFrame( void ) {
xglPopMatrix();
// draw scenery
xglShadeModel( /* GL_FLAT */ GL_SMOOTH );
if ( o->shading ) {
xglShadeModel( GL_SMOOTH );
} else {
xglShadeModel( GL_FLAT );
}
xglEnable( GL_DEPTH_TEST );
xglEnable( GL_FOG );
xglFogfv (GL_FOG_COLOR, l->fog_color);
if ( o->fog ) {
xglEnable( GL_FOG );
xglFogfv (GL_FOG_COLOR, l->fog_color);
}
// set lighting parameters
xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
if ( o->use_textures ) {
if ( o->textures ) {
// texture parameters
xglEnable( GL_TEXTURE_2D );
xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ) ;
@ -699,6 +718,13 @@ extern "C" {
// $Log$
// Revision 1.9 1998/04/30 12:34:17 curt
// Added command line rendering options:
// enable/disable fog/haze
// specify smooth/flat shading
// disable sky blending and just use a solid color
// enable wireframe drawing mode
//
// Revision 1.8 1998/04/28 01:20:21 curt
// Type-ified fgTIME and fgVIEW.
// Added a command line option to disable textures.

View file

@ -45,7 +45,7 @@
#include <Debug/fg_debug.h>
#include <Joystick/joystick.h>
#include <Math/fg_random.h>
#include <Scenery/scenery.h>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#include <Time/event.hxx>
#include <Time/fg_time.hxx>
@ -97,6 +97,18 @@ int fgInitPosition( void ) {
// FG_Runway_altitude = 950.0;
// FG_Altitude = FG_Runway_altitude + 3.758099;
// Initial Position near KHSP (Hot Springs, VA)
// FG_Longitude = (-79.8338964 + 0.01) * DEG_TO_RAD;
// FG_Latitude = ( 37.9514564 + 0.008) * DEG_TO_RAD;
// FG_Runway_altitude = (3792 + 2800);
// FG_Altitude = FG_Runway_altitude + 3.758099;
// Initial Position at (SEZ) SEDONA airport
FG_Longitude = (-111.7884614 + 0.01) * DEG_TO_RAD;
FG_Latitude = ( 34.8486289 - 0.015) * DEG_TO_RAD;
FG_Runway_altitude = (4827 + 450);
FG_Altitude = FG_Runway_altitude + 3.758099;
// Initial Position: Somewhere near the Grand Canyon
// FG_Longitude = ( -112.5 ) * DEG_TO_RAD;
// FG_Latitude = ( 36.5 ) * DEG_TO_RAD;
@ -369,6 +381,13 @@ int fgInitSubsystems( void ) {
// $Log$
// Revision 1.8 1998/04/30 12:34:18 curt
// Added command line rendering options:
// enable/disable fog/haze
// specify smooth/flat shading
// disable sky blending and just use a solid color
// enable wireframe drawing mode
//
// Revision 1.7 1998/04/28 01:20:22 curt
// Type-ified fgTIME and fgVIEW.
// Added a command line option to disable textures.

View file

@ -46,9 +46,19 @@ fgOPTIONS::fgOPTIONS( void ) {
// set initial values/defaults
strcpy(airport_id, "");
// Features
hud_status = 0;
// Rendering options
fog = 1;
shading = 1;
skyblend = 1;
textures = 1;
wireframe = 0;
// Time options
time_offset = 0;
use_textures = 1;
}
@ -171,10 +181,26 @@ int fgOPTIONS::parse( int argc, char **argv ) {
} else if ( strncmp(argv[i], "--airport-id=", 13) == 0 ) {
argv[i] += 13;
strncpy(airport_id, argv[i], 4);
} else if ( strcmp(argv[i], "--disable-fog") == 0 ) {
fog = 0;
} else if ( strcmp(argv[i], "--enable-fog") == 0 ) {
fog = 1;
} else if ( strcmp(argv[i], "--shading-flat") == 0 ) {
shading = 0;
} else if ( strcmp(argv[i], "--shading-smooth") == 0 ) {
shading = 1;
} else if ( strcmp(argv[i], "--disable-skyblend") == 0 ) {
skyblend = 0;
} else if ( strcmp(argv[i], "--enable-skyblend") == 0 ) {
skyblend = 1;
} else if ( strcmp(argv[i], "--disable-textures") == 0 ) {
use_textures = 0;
textures = 0;
} else if ( strcmp(argv[i], "--enable-textures") == 0 ) {
use_textures = 1;
textures = 1;
} else if ( strcmp(argv[i], "--disable-wireframe") == 0 ) {
wireframe = 0;
} else if ( strcmp(argv[i], "--enable-wireframe") == 0 ) {
wireframe = 1;
} else if ( strncmp(argv[i], "--time-offset=", 14) == 0 ) {
time_offset = parse_time_offset(argv[i]);
} else {
@ -207,8 +233,16 @@ void fgOPTIONS::usage ( void ) {
printf("\n");
printf("Rendering Options:\n");
printf("\t--disable-fog: disable fog/haze\n");
printf("\t--enable-fog: enable fog/haze\n");
printf("\t--shading-flat: enable flat shading\n");
printf("\t--shading-smooth: enable smooth shading\n");
printf("\t--disable-skyblend: disable sky blending\n");
printf("\t--enable-skyblend: enable sky blending\n");
printf("\t--disable-textures: disable textures\n");
printf("\t--enable-textures: enable textures\n");
printf("\t--disable-wireframe: disable wireframe drawing mode\n");
printf("\t--enable-wireframe: enable wireframe drawing mode\n");
printf("\n");
printf("Time Options:\n");
@ -222,6 +256,13 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $Log$
// Revision 1.5 1998/04/30 12:34:19 curt
// Added command line rendering options:
// enable/disable fog/haze
// specify smooth/flat shading
// disable sky blending and just use a solid color
// enable wireframe drawing mode
//
// Revision 1.4 1998/04/28 01:20:22 curt
// Type-ified fgTIME and fgVIEW.
// Added a command line option to disable textures.

View file

@ -44,14 +44,18 @@ public:
// ID of initial starting airport
char airport_id[5];
// HUD on/off
int hud_status;
// Features
int hud_status; // HUD on/off
// Offset true time by this many seconds
int time_offset;
// Rendering options
int fog; // Fog enabled/disabled
int shading; // shading method, 0 = Flat, 1 = Smooth
int skyblend; // Blend sky to haze (using polygons) or just clear
int textures; // Textures enabled/disabled
int wireframe; // Wireframe mode enabled/disabled
// Textures enabled/disabled
int use_textures;
// Time options
int time_offset; // Offset true time by this many seconds
// Constructor
fgOPTIONS( void );
@ -75,6 +79,13 @@ extern fgOPTIONS current_options;
// $Log$
// Revision 1.4 1998/04/30 12:34:19 curt
// Added command line rendering options:
// enable/disable fog/haze
// specify smooth/flat shading
// disable sky blending and just use a solid color
// enable wireframe drawing mode
//
// Revision 1.3 1998/04/28 01:20:23 curt
// Type-ified fgTIME and fgVIEW.
// Added a command line option to disable textures.

View file

@ -34,7 +34,7 @@
#include <Math/mat3.h>
#include <Math/polar.h>
#include <Math/vector.h>
#include <Scenery/scenery.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_time.hxx>
#include "views.hxx"
@ -200,6 +200,13 @@ void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l) {
// $Log$
// Revision 1.7 1998/04/30 12:34:20 curt
// Added command line rendering options:
// enable/disable fog/haze
// specify smooth/flat shading
// disable sky blending and just use a solid color
// enable wireframe drawing mode
//
// Revision 1.6 1998/04/28 01:20:23 curt
// Type-ified fgTIME and fgVIEW.
// Added a command line option to disable textures.