#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>
fgVIEW *v;
struct fgWEATHER *w;
float fov, tmp;
- int status;
c = current_aircraft.controls;
f = current_aircraft.flight;
} 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();
/* $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.
*
# include <config.h>
#endif
+#ifdef HAVE_WINDOWS_H
+# include <windows.h>
+#endif
+
+#include <GL/glut.h>
+#include <XGL/xgl.h>
+
#include <string>
#ifdef NEEDNAMESPACESTD
// 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:
// $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.
//
}
+#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.
//