1
0
Fork 0

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:
Stuart Buchanan 2020-01-27 09:30:09 +00:00
parent 65a20b5829
commit f6285bc528
4 changed files with 81 additions and 78 deletions

View file

@ -414,6 +414,7 @@ FGRenderer::init( void )
_splash_alpha = fgGetNode("/sim/startup/splash-alpha", 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);
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
@ -424,8 +425,9 @@ FGRenderer::init( void )
bool use_point_sprites = _point_sprites->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 (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||

View file

@ -95,7 +95,7 @@ protected:
SGPropertyNode_ptr _scenery_loaded, _position_finalized;
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 _cloud_status, _visibility_m;
SGPropertyNode_ptr _xsize, _ysize;

View file

@ -519,6 +519,7 @@ FGRenderer::init( void )
_point_sprites = fgGetNode("/sim/rendering/point-sprites", 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);
_altitude_ft = fgGetNode("/position/altitude-ft", true);
@ -528,8 +529,9 @@ FGRenderer::init( void )
bool use_point_sprites = _point_sprites->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 (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
@ -2079,4 +2081,3 @@ bool printVisibleSceneInfo(FGRenderer* renderer)
}
// end of renderer.cxx

View file

@ -137,7 +137,7 @@ protected:
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 _cloud_status, _visibility_m;
SGPropertyNode_ptr _xsize, _ysize;