Fix directional lights for AMD
Some AMD drivers do not like triangles for point sprites, which breaks directional lights. This works around this by allowing users to set /rendering/triangle-directional-lights=false which falls back to the non-directional implementation of a point.
This commit is contained in:
parent
65a20b5829
commit
f6285bc528
4 changed files with 81 additions and 78 deletions
|
@ -414,6 +414,7 @@ FGRenderer::init( void )
|
||||||
_splash_alpha = fgGetNode("/sim/startup/splash-alpha", true);
|
_splash_alpha = fgGetNode("/sim/startup/splash-alpha", true);
|
||||||
|
|
||||||
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
|
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
|
||||||
|
_triangle_directional_lights = fgGetNode("/sim/rendering/triangle-directional-lights", true);
|
||||||
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
|
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
|
||||||
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
|
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
|
||||||
|
|
||||||
|
@ -424,8 +425,9 @@ FGRenderer::init( void )
|
||||||
|
|
||||||
bool use_point_sprites = _point_sprites->getBoolValue();
|
bool use_point_sprites = _point_sprites->getBoolValue();
|
||||||
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
||||||
|
bool triangles = _triangle_directional_lights->getBoolValue();
|
||||||
|
|
||||||
SGConfigureDirectionalLights( use_point_sprites, distance_attenuation );
|
SGConfigureDirectionalLights( use_point_sprites, distance_attenuation, triangles );
|
||||||
|
|
||||||
if (const char* tc = fgGetString("/sim/rendering/texture-compression", NULL)) {
|
if (const char* tc = fgGetString("/sim/rendering/texture-compression", NULL)) {
|
||||||
if (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
|
if (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
|
||||||
|
|
|
@ -95,7 +95,7 @@ protected:
|
||||||
SGPropertyNode_ptr _scenery_loaded, _position_finalized;
|
SGPropertyNode_ptr _scenery_loaded, _position_finalized;
|
||||||
|
|
||||||
SGPropertyNode_ptr _splash_alpha;
|
SGPropertyNode_ptr _splash_alpha;
|
||||||
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
|
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation, _triangle_directional_lights;
|
||||||
SGPropertyNode_ptr _textures;
|
SGPropertyNode_ptr _textures;
|
||||||
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
||||||
SGPropertyNode_ptr _xsize, _ysize;
|
SGPropertyNode_ptr _xsize, _ysize;
|
||||||
|
|
|
@ -519,6 +519,7 @@ FGRenderer::init( void )
|
||||||
|
|
||||||
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
|
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
|
||||||
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
|
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
|
||||||
|
_triangle_directional_lights = fgGetNode("/sim/rendering/triangle-directional-lights", true);
|
||||||
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
|
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
|
||||||
|
|
||||||
_altitude_ft = fgGetNode("/position/altitude-ft", true);
|
_altitude_ft = fgGetNode("/position/altitude-ft", true);
|
||||||
|
@ -528,8 +529,9 @@ FGRenderer::init( void )
|
||||||
|
|
||||||
bool use_point_sprites = _point_sprites->getBoolValue();
|
bool use_point_sprites = _point_sprites->getBoolValue();
|
||||||
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
||||||
|
bool triangles = _triangle_directional_lights->getBoolValue();
|
||||||
|
|
||||||
SGConfigureDirectionalLights( use_point_sprites, distance_attenuation );
|
SGConfigureDirectionalLights( use_point_sprites, distance_attenuation, triangles );
|
||||||
|
|
||||||
if (const char* tc = fgGetString("/sim/rendering/texture-compression", NULL)) {
|
if (const char* tc = fgGetString("/sim/rendering/texture-compression", NULL)) {
|
||||||
if (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
|
if (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
|
||||||
|
@ -2079,4 +2081,3 @@ bool printVisibleSceneInfo(FGRenderer* renderer)
|
||||||
|
|
||||||
}
|
}
|
||||||
// end of renderer.cxx
|
// end of renderer.cxx
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
SGPropertyNode_ptr _splash_alpha;
|
SGPropertyNode_ptr _splash_alpha;
|
||||||
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
|
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation, _triangle_directional_lights;
|
||||||
SGPropertyNode_ptr _textures;
|
SGPropertyNode_ptr _textures;
|
||||||
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
||||||
SGPropertyNode_ptr _xsize, _ysize;
|
SGPropertyNode_ptr _xsize, _ysize;
|
||||||
|
|
Loading…
Reference in a new issue