From 8986c3488daaafe531882f67818f1baf2eac4ae3 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 12 Oct 2011 09:17:58 +0100 Subject: [PATCH] Make sun-angle a plain property, so observers fire. --- src/Time/light.cxx | 7 ++++--- src/Time/light.hxx | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 042919aee..e4e432e4c 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -148,8 +148,9 @@ void FGLight::bind () { prop->tie("/rendering/scene/scattering",SGRawValuePointer(&_scattering)); prop->tie("/rendering/scene/overcast",SGRawValuePointer(&_overcast)); + _sunAngleRad = prop->getNode("/sim/time/sun-angle-rad", true); + // Read Only - prop->tie("/sim/time/sun-angle-rad",SGRawValuePointer(&_sun_angle)); prop->tie("/rendering/scene/ambient/red",SGRawValuePointer(&_scene_ambient[0])); prop->tie("/rendering/scene/ambient/green",SGRawValuePointer(&_scene_ambient[1])); prop->tie("/rendering/scene/ambient/blue",SGRawValuePointer(&_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); } diff --git a/src/Time/light.hxx b/src/Time/light.hxx index 1880c3dea..a7be74786 100644 --- a/src/Time/light.hxx +++ b/src/Time/light.hxx @@ -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 ();