]> git.mxchange.org Git - flightgear.git/commitdiff
Make sun-angle a plain property, so observers fire.
authorJames Turner <zakalawe@mac.com>
Wed, 12 Oct 2011 08:17:58 +0000 (09:17 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 12 Oct 2011 08:17:58 +0000 (09:17 +0100)
src/Time/light.cxx
src/Time/light.hxx

index 042919aee4d26bc754d5e88a01d428c2c4c696be..e4e432e4c50decbd1b8efadf4641beae55368f86 100644 (file)
@@ -148,8 +148,9 @@ void FGLight::bind () {
     prop->tie("/rendering/scene/scattering",SGRawValuePointer<float>(&_scattering));
     prop->tie("/rendering/scene/overcast",SGRawValuePointer<float>(&_overcast));
 
+    _sunAngleRad = prop->getNode("/sim/time/sun-angle-rad", true);
+  
     // Read Only
-    prop->tie("/sim/time/sun-angle-rad",SGRawValuePointer<double>(&_sun_angle));
     prop->tie("/rendering/scene/ambient/red",SGRawValuePointer<float>(&_scene_ambient[0]));
     prop->tie("/rendering/scene/ambient/green",SGRawValuePointer<float>(&_scene_ambient[1]));
     prop->tie("/rendering/scene/ambient/blue",SGRawValuePointer<float>(&_scene_ambient[2]));
@@ -181,8 +182,6 @@ void FGLight::unbind () {
     prop->untie("/rendering/scene/saturation");
     prop->untie("/rendering/scene/scattering");
     prop->untie("/rendering/scene/overcast");
-
-    prop->untie("/sim/time/sun-angle-rad");
     prop->untie("/rendering/scene/ambient/red");
     prop->untie("/rendering/scene/ambient/green");
     prop->untie("/rendering/scene/ambient/blue");
@@ -453,4 +452,6 @@ void FGLight::updateSunPos()
 
     // cout << "  Sky needs to rotate = " << _sun_rotation << " rads = "
     //      << _sun_rotation * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
+  
+    _sunAngleRad->setDoubleValue(_sun_angle);
 }
index 1880c3deab0a3cf9fa34b95e39b23a0c9f5dc105..a7be74786792882f5af0bd63fceaf1657c9153e9 100644 (file)
@@ -112,6 +112,8 @@ private:
     // properties for chrome light; not a tie because I want to fire
     // property listeners when the values change.
     SGPropertyNode_ptr _chromeProps[4];
+  
+    SGPropertyNode_ptr _sunAngleRad;
 public:
 
     FGLight ();