1
0
Fork 0

Added F8 to toggle fog and F9 to toggle texturing.

This commit is contained in:
curt 1998-09-17 18:35:30 +00:00
parent 9e9fbd3185
commit 6438a27244
3 changed files with 110 additions and 4 deletions

View file

@ -47,6 +47,7 @@
#include <Debug/fg_debug.h>
#include <GUI/gui.h>
#include <Include/fg_constants.h>
#include <Objects/material.hxx>
#include <PUI/pu.h>
#include <Time/light.hxx>
#include <Weather/weather.h>
@ -78,7 +79,6 @@ void GLUTkey(unsigned char k, int x, int y) {
fgVIEW *v;
struct fgWEATHER *w;
float fov, tmp;
int status;
c = current_aircraft.controls;
f = current_aircraft.flight;
@ -299,8 +299,37 @@ void GLUTspecialkey(int k, int x, int y) {
} else {
fgPrintf( FG_INPUT, FG_DEBUG, "\n");
switch (k) {
case GLUT_KEY_F8: /* F8 toggles fog ... off fastest nicest... */
current_options.cycle_fog();
if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) {
fgPrintf( FG_INPUT, FG_INFO, "Fog disabled\n" );
} else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_FASTEST )
{
fgPrintf( FG_INPUT, FG_INFO,
"Fog enabled, hint set to fastest\n" );
} else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_NICEST )
{
fgPrintf( FG_INPUT, FG_INFO,
"Fog enabled, hint set to nicest\n" );
}
return;
case GLUT_KEY_F9: /* F9 toggles textures on and off... */
if ( material_mgr.get_textures_loaded() ) {
current_options.get_textures() ?
current_options.set_textures(false) :
current_options.set_textures(true);
fgPrintf( FG_INPUT, FG_INFO, "Toggling texture\n" );
} else {
fgPrintf( FG_INPUT, FG_INFO,
"No textures loaded, cannot toggle\n" );
}
return;
case GLUT_KEY_F10: /* F10 toggles menu on and off... */
printf("Invoking call back function");
fgPrintf(FG_INPUT, FG_INFO, "Invoking call back function");
hideMenuButton ->
setValue ((int) !(hideMenuButton -> getValue() ) );
hideMenuButton -> invokeCallback();
@ -347,9 +376,12 @@ void GLUTspecialkey(int k, int x, int y) {
/* $Log$
/* Revision 1.22 1998/09/15 04:27:27 curt
/* Changes for new Astro code.
/* Revision 1.23 1998/09/17 18:35:30 curt
/* Added F8 to toggle fog and F9 to toggle texturing.
/*
* Revision 1.22 1998/09/15 04:27:27 curt
* Changes for new Astro code.
*
* Revision 1.21 1998/08/29 13:09:25 curt
* Changes to event manager from Bernie Bright.
*

View file

@ -35,6 +35,13 @@
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <GL/glut.h>
#include <XGL/xgl.h>
#include <string>
#ifdef NEEDNAMESPACESTD
@ -163,6 +170,18 @@ public:
// Update functions
void set_hud_status( bool status ) { hud_status = status; }
void set_fov( double amount ) { fov = amount; }
void set_textures( bool status ) { textures = status; }
void cycle_fog( void ) {
if ( fog == FG_FOG_DISABLED ) {
fog = FG_FOG_FASTEST;
} else if ( fog == FG_FOG_FASTEST ) {
fog = FG_FOG_NICEST;
xglHint ( GL_FOG_HINT, GL_NICEST );
} else if ( fog == FG_FOG_NICEST ) {
fog = FG_FOG_DISABLED;
xglHint ( GL_FOG_HINT, GL_FASTEST );
}
}
private:
@ -182,6 +201,9 @@ extern fgOPTIONS current_options;
// $Log$
// Revision 1.18 1998/09/17 18:35:31 curt
// Added F8 to toggle fog and F9 to toggle texturing.
//
// Revision 1.17 1998/09/08 21:40:10 curt
// Fixes by Charlie Hotchkiss.
//

View file

@ -538,12 +538,64 @@ void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
}
#if 0
// Reject non viewable spheres from current View Frustrum by Curt
// Olson curt@me.umn.edu and Norman Vine nhv@yahoo.com with 'gentle
// guidance' from Steve Baker sbaker@link.com
int
fgVIEW::SphereClip( const fgPoint3d *cp,
const double radius )
{
double x1, y1;
MAT3vec eye;
double *mat;
double x, y, z;
x = cp->x;
y = cp->y;
z = cp->z;
mat = (double *)(WORLD_TO_EYE);
eye[2] = x*mat[2] + y*mat[6] + z*mat[10] + mat[14];
// Check near and far clip plane
if( ( eye[2] > radius ) ||
( eye[2] + radius + current_weather.visibility < 0) )
// ( eye[2] + radius + far_plane < 0) )
{
return 1;
}
// check right and left clip plane (from eye perspective)
x1 = radius * fov_x_clip;
eye[0] = (x*mat[0] + y*mat[4] + z*mat[8] + mat[12]) * slope_x;
if( (eye[2] > -(eye[0]+x1)) || (eye[2] > (eye[0]-x1)) ) {
return(1);
}
// check bottom and top clip plane (from eye perspective)
y1 = radius * fov_y_clip;
eye[1] = (x*mat[1] + y*mat[5] + z*mat[9] + mat[13]) * slope_y;
if( (eye[2] > -(eye[1]+y1)) || (eye[2] > (eye[1]-y1)) ) {
return 1;
}
return 0;
}
#endif
// Destructor
fgVIEW::~fgVIEW( void ) {
}
// $Log$
// Revision 1.21 1998/09/17 18:35:33 curt
// Added F8 to toggle fog and F9 to toggle texturing.
//
// Revision 1.20 1998/09/08 15:04:35 curt
// Optimizations by Norman Vine.
//