Directional point light (triangle) changes
Ensure that there are listeners on the properties as the scene features needs to be kept up to date with the properties.
This commit is contained in:
parent
75e28368ea
commit
ab1ecb0a31
2 changed files with 34 additions and 9 deletions
|
@ -461,6 +461,30 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class PointSpriteListener : public SGPropertyChangeListener {
|
||||
public:
|
||||
virtual void valueChanged(SGPropertyNode* node) {
|
||||
static SGSceneFeatures* sceneFeatures = SGSceneFeatures::instance();
|
||||
sceneFeatures->setEnablePointSpriteLights(node->getIntValue());
|
||||
}
|
||||
};
|
||||
|
||||
class DistanceAttenuationListener : public SGPropertyChangeListener {
|
||||
public:
|
||||
virtual void valueChanged(SGPropertyNode* node) {
|
||||
static SGSceneFeatures* sceneFeatures = SGSceneFeatures::instance();
|
||||
sceneFeatures->setEnableDistanceAttenuationLights(node->getIntValue());
|
||||
}
|
||||
};
|
||||
|
||||
class DirectionalLightsListener : public SGPropertyChangeListener {
|
||||
public:
|
||||
virtual void valueChanged(SGPropertyNode* node) {
|
||||
static SGSceneFeatures* sceneFeatures = SGSceneFeatures::instance();
|
||||
sceneFeatures->setEnableTriangleDirectionalLights(node->getIntValue());
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
FGRenderer::addChangeListener(SGPropertyChangeListener* l, const char* path)
|
||||
{
|
||||
|
@ -514,9 +538,6 @@ FGRenderer::init( void )
|
|||
_ysize = fgGetNode("/sim/startup/ysize", true);
|
||||
_splash_alpha = fgGetNode("/sim/startup/splash-alpha", true);
|
||||
|
||||
_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);
|
||||
|
@ -524,12 +545,16 @@ FGRenderer::init( void )
|
|||
_cloud_status = fgGetNode("/environment/clouds/status", true);
|
||||
_visibility_m = fgGetNode("/environment/visibility-m", true);
|
||||
|
||||
bool use_point_sprites = _point_sprites->getBoolValue();
|
||||
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
||||
bool triangles = _triangle_directional_lights->getBoolValue();
|
||||
|
||||
// configure the lighting related parameters and add change listeners.
|
||||
bool use_point_sprites = fgGetBool("/sim/rendering/point-sprites", true);
|
||||
bool distance_attenuation = fgGetBool("/sim/rendering/distance-attenuation", false);
|
||||
bool triangles = fgGetBool("/sim/rendering/triangle-directional-lights", true);
|
||||
SGConfigureDirectionalLights(use_point_sprites, distance_attenuation, triangles);
|
||||
|
||||
addChangeListener(new PointSpriteListener, "/sim/rendering/point-sprites");
|
||||
addChangeListener(new DistanceAttenuationListener, "/sim/rendering/distance-attenuation");
|
||||
addChangeListener(new DirectionalLightsListener, "/sim/rendering/triangle-directional-lights");
|
||||
|
||||
if (const char* tc = fgGetString("/sim/rendering/texture-compression", NULL)) {
|
||||
if (strcmp(tc, "false") == 0 || strcmp(tc, "off") == 0 ||
|
||||
strcmp(tc, "0") == 0 || strcmp(tc, "no") == 0 ||
|
||||
|
|
|
@ -137,7 +137,7 @@ protected:
|
|||
|
||||
|
||||
SGPropertyNode_ptr _splash_alpha;
|
||||
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation, _triangle_directional_lights;
|
||||
SGPropertyNode_ptr _enhanced_lighting;
|
||||
SGPropertyNode_ptr _textures;
|
||||
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
||||
SGPropertyNode_ptr _xsize, _ysize;
|
||||
|
|
Loading…
Add table
Reference in a new issue