#include <simgear/misc/exception.hxx>
#include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/route/route.hxx>
+#include <simgear/screen/extensions.hxx>
#include <Environment/environment_mgr.hxx>
#include "fg_commands.hxx"
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
#ifdef WIN32
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)(GLenum pname,
GLfloat param);
OpenGLFuncExt glPointParameterfEXT = 0;
OpenGLFuncExtv glPointParameterfvEXT = 0;
#endif
-#endif
float default_attenuation[3] = {1.0, 0.0, 0.0};
//Required for using GL_extensions
// within the range of the far clip plane.
// Moon distance: 384,467 kilometers
// Sun distance: 150,000,000 kilometers
- double sun_eye_eff = 0.67+pow(0.5+cos(cur_light_params.sun_angle*2)/2,0.33)/3;
- double moon_eye_eff = 0.67+pow(0.5+cos(cur_light_params.moon_angle*2)/2,0.33)/3;
+ double sun_horiz_eff, moon_horiz_eff;
+ if (fgGetBool("/sim/rendering/horizon-effect")) {
+ sun_horiz_eff = 0.67+pow(0.5+cos(cur_light_params.sun_angle*2)/2,0.33)/3;
+ moon_horiz_eff = 0.67+pow(0.5+cos(cur_light_params.moon_angle*2)/2,0.33)/3;
+ } else {
+ sun_horiz_eff = moon_horiz_eff = 1.0;
+ }
thesky->reposition( current__view->get_view_pos(),
current__view->get_zero_elev(),
current__view->get_world_up(),
globals->get_time_params()->getGst(),
globals->get_ephem()->getSunRightAscension(),
globals->get_ephem()->getSunDeclination(),
- 50000.0 * sun_eye_eff,
+ 50000.0 * sun_horiz_eff,
globals->get_ephem()->getMoonRightAscension(),
globals->get_ephem()->getMoonDeclination(),
- 40000.0 * moon_eye_eff );
+ 40000.0 * moon_horiz_eff );
}
glEnable( GL_DEPTH_TEST );
glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through);
ssgSetNearFar( scene_nearplane, scene_farplane );
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
- // Enable states for drawing points with GL_extension
- glEnable(GL_POINT_SMOOTH);
+ if (fgGetBool("/sim/rendering/enhanced-lighting")) {
- if ( fgGetBool("/sim/rendering/distance-attenuation")
- && glutExtensionSupported("GL_EXT_point_parameters") )
- {
- float quadratic[3] = {1.0, 0.001, 0.0000001};
- // makes the points fade as they move away
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
- glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0);
- }
- glPointSize(4.0);
+ // Enable states for drawing points with GL_extension
+ glEnable(GL_POINT_SMOOTH);
- // blending function for runway lights
- glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
-#endif
+ if ( fgGetBool("/sim/rendering/distance-attenuation")
+ && glutExtensionSupported("GL_EXT_point_parameters") )
+ {
+ // Enable states for drawing points with GL_extension
+ glEnable(GL_POINT_SMOOTH);
+
+ float quadratic[3] = {1.0, 0.001, 0.0000001};
+ // makes the points fade as they move away
+ glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
+ glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0);
+ }
+
+ glPointSize(4.0);
+
+ // blending function for runway lights
+ glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
+ }
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
//_frame_count++;
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
- if ( fgGetBool("/sim/rendering/distance-attenuation")
- && glutExtensionSupported("GL_EXT_point_parameters") )
- {
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT,
- default_attenuation);
- }
+ if (fgGetBool("/sim/rendering/enhanced-lighting")) {
+ if ( fgGetBool("/sim/rendering/distance-attenuation")
+ && glutExtensionSupported("GL_EXT_point_parameters") )
+ {
+ glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT,
+ default_attenuation);
+ }
- glPointSize(1.0);
- glDisable(GL_POINT_SMOOTH);
-#endif
+ glPointSize(1.0);
+ glDisable(GL_POINT_SMOOTH);
+ }
// draw ground lighting
glFogf (GL_FOG_DENSITY, ground_exp2_punch_through);
glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
#endif
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
// get the address of our OpenGL extensions
if ( fgGetBool("/sim/rendering/distance-attenuation") )
{
#ifdef WIN32
glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)
- wglGetProcAddress("glPointParameterfEXT");
+ SGLookupFunction("glPointParameterfEXT");
glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)
- wglGetProcAddress("glPointParameterfvEXT");
+ SGLookupFunction("glPointParameterfvEXT");
#elif linux
glPointParameterfEXT = (OpenGLFuncExt)
- glXGetProcAddressARB((GLubyte *)"glPointParameterfEXT");
+ SGLookupFunction((GLubyte *)"glPointParameterfEXT");
glPointParameterfvEXT = (OpenGLFuncExtv)
- glXGetProcAddressARB((GLubyte *)"glPointParameterfvEXT");
+ SGLookupFunction((GLubyte *)"glPointParameterfvEXT");
#endif
}
-#endif
// based on the requested presets, calculate the true starting
// lon, lat