Add:
/sim/rendering/horizon-effect toggle sun and moon resizing effect near the horizon /sim/rendering/enhanced-lighting toggle enhanced runway lighting on or off /sim/rendering/distance-attenuation add distance attenuation to the enhanced runway lighting
This commit is contained in:
parent
b082300ab1
commit
0eda5f3872
1 changed files with 44 additions and 37 deletions
|
@ -39,6 +39,7 @@ SG_USING_STD(endl);
|
||||||
#include <simgear/misc/exception.hxx>
|
#include <simgear/misc/exception.hxx>
|
||||||
#include <simgear/ephemeris/ephemeris.hxx>
|
#include <simgear/ephemeris/ephemeris.hxx>
|
||||||
#include <simgear/route/route.hxx>
|
#include <simgear/route/route.hxx>
|
||||||
|
#include <simgear/screen/extensions.hxx>
|
||||||
|
|
||||||
#include <Environment/environment_mgr.hxx>
|
#include <Environment/environment_mgr.hxx>
|
||||||
|
|
||||||
|
@ -142,7 +143,6 @@ SG_USING_STD(endl);
|
||||||
|
|
||||||
#include "fg_commands.hxx"
|
#include "fg_commands.hxx"
|
||||||
|
|
||||||
#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)(GLenum pname,
|
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)(GLenum pname,
|
||||||
GLfloat param);
|
GLfloat param);
|
||||||
|
@ -160,7 +160,6 @@ SG_USING_STD(endl);
|
||||||
OpenGLFuncExt glPointParameterfEXT = 0;
|
OpenGLFuncExt glPointParameterfEXT = 0;
|
||||||
OpenGLFuncExtv glPointParameterfvEXT = 0;
|
OpenGLFuncExtv glPointParameterfvEXT = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
||||||
//Required for using GL_extensions
|
//Required for using GL_extensions
|
||||||
|
@ -624,8 +623,13 @@ void fgRenderFrame() {
|
||||||
// within the range of the far clip plane.
|
// within the range of the far clip plane.
|
||||||
// Moon distance: 384,467 kilometers
|
// Moon distance: 384,467 kilometers
|
||||||
// Sun distance: 150,000,000 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 sun_horiz_eff, moon_horiz_eff;
|
||||||
double moon_eye_eff = 0.67+pow(0.5+cos(cur_light_params.moon_angle*2)/2,0.33)/3;
|
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(),
|
thesky->reposition( current__view->get_view_pos(),
|
||||||
current__view->get_zero_elev(),
|
current__view->get_zero_elev(),
|
||||||
current__view->get_world_up(),
|
current__view->get_world_up(),
|
||||||
|
@ -639,10 +643,10 @@ void fgRenderFrame() {
|
||||||
globals->get_time_params()->getGst(),
|
globals->get_time_params()->getGst(),
|
||||||
globals->get_ephem()->getSunRightAscension(),
|
globals->get_ephem()->getSunRightAscension(),
|
||||||
globals->get_ephem()->getSunDeclination(),
|
globals->get_ephem()->getSunDeclination(),
|
||||||
50000.0 * sun_eye_eff,
|
50000.0 * sun_horiz_eff,
|
||||||
globals->get_ephem()->getMoonRightAscension(),
|
globals->get_ephem()->getMoonRightAscension(),
|
||||||
globals->get_ephem()->getMoonDeclination(),
|
globals->get_ephem()->getMoonDeclination(),
|
||||||
40000.0 * moon_eye_eff );
|
40000.0 * moon_horiz_eff );
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable( GL_DEPTH_TEST );
|
glEnable( GL_DEPTH_TEST );
|
||||||
|
@ -773,23 +777,28 @@ void fgRenderFrame() {
|
||||||
glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through);
|
glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through);
|
||||||
ssgSetNearFar( scene_nearplane, scene_farplane );
|
ssgSetNearFar( scene_nearplane, scene_farplane );
|
||||||
|
|
||||||
#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
|
if (fgGetBool("/sim/rendering/enhanced-lighting")) {
|
||||||
|
|
||||||
// Enable states for drawing points with GL_extension
|
// Enable states for drawing points with GL_extension
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation")
|
if ( fgGetBool("/sim/rendering/distance-attenuation")
|
||||||
&& glutExtensionSupported("GL_EXT_point_parameters") )
|
&& 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};
|
float quadratic[3] = {1.0, 0.001, 0.0000001};
|
||||||
// makes the points fade as they move away
|
// makes the points fade as they move away
|
||||||
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
|
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
|
||||||
glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0);
|
glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPointSize(4.0);
|
glPointSize(4.0);
|
||||||
|
|
||||||
// blending function for runway lights
|
// blending function for runway lights
|
||||||
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||||
|
@ -826,7 +835,7 @@ void fgRenderFrame() {
|
||||||
//_frame_count++;
|
//_frame_count++;
|
||||||
|
|
||||||
|
|
||||||
#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
|
if (fgGetBool("/sim/rendering/enhanced-lighting")) {
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation")
|
if ( fgGetBool("/sim/rendering/distance-attenuation")
|
||||||
&& glutExtensionSupported("GL_EXT_point_parameters") )
|
&& glutExtensionSupported("GL_EXT_point_parameters") )
|
||||||
{
|
{
|
||||||
|
@ -836,7 +845,7 @@ void fgRenderFrame() {
|
||||||
|
|
||||||
glPointSize(1.0);
|
glPointSize(1.0);
|
||||||
glDisable(GL_POINT_SMOOTH);
|
glDisable(GL_POINT_SMOOTH);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// draw ground lighting
|
// draw ground lighting
|
||||||
glFogf (GL_FOG_DENSITY, ground_exp2_punch_through);
|
glFogf (GL_FOG_DENSITY, ground_exp2_punch_through);
|
||||||
|
@ -1657,23 +1666,21 @@ static bool fgMainInit( int argc, char **argv ) {
|
||||||
glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
|
glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
|
|
||||||
// get the address of our OpenGL extensions
|
// get the address of our OpenGL extensions
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation") )
|
if ( fgGetBool("/sim/rendering/distance-attenuation") )
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)
|
glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)
|
||||||
wglGetProcAddress("glPointParameterfEXT");
|
SGLookupFunction("glPointParameterfEXT");
|
||||||
glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)
|
glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)
|
||||||
wglGetProcAddress("glPointParameterfvEXT");
|
SGLookupFunction("glPointParameterfvEXT");
|
||||||
#elif linux
|
#elif linux
|
||||||
glPointParameterfEXT = (OpenGLFuncExt)
|
glPointParameterfEXT = (OpenGLFuncExt)
|
||||||
glXGetProcAddressARB((GLubyte *)"glPointParameterfEXT");
|
SGLookupFunction((GLubyte *)"glPointParameterfEXT");
|
||||||
glPointParameterfvEXT = (OpenGLFuncExtv)
|
glPointParameterfvEXT = (OpenGLFuncExtv)
|
||||||
glXGetProcAddressARB((GLubyte *)"glPointParameterfvEXT");
|
SGLookupFunction((GLubyte *)"glPointParameterfvEXT");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// based on the requested presets, calculate the true starting
|
// based on the requested presets, calculate the true starting
|
||||||
// lon, lat
|
// lon, lat
|
||||||
|
|
Loading…
Reference in a new issue