]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/sky.cxx
simgear/scene/sky/sky.cxx: Include sg_inlines.h with simgear/ prefix as all other...
[simgear.git] / simgear / scene / sky / sky.cxx
index 21662c66b5cdc574dd27ee56a5c1a36f58cd5504..01f5a2560f7758a3cf7a470a0ae8ed94431ef352 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <simgear/math/sg_random.h>
 #include <simgear/scene/util/RenderConstants.hxx>
+#include <simgear/sg_inlines.h>
 
 #include <osg/StateSet>
 #include <osg/Depth>
@@ -152,7 +153,12 @@ bool SGSky::reposition( const SGSkyState &st, const SGEphemeris& eph, double dt
 
     SGGeod geodZeroViewPos = SGGeod::fromGeodM(st.pos_geod, 0);
     zero_elev = toVec3f( SGVec3d::fromGeod(geodZeroViewPos) );
-    view_up = toVec3f( st.ori.backTransform(SGVec3d::e2()) );
+
+    // calculate the scenery up vector
+    SGQuatd hlOr = SGQuatd::fromLonLat(st.pos_geod);
+    view_up = toVec3f(hlOr.backTransform(-SGVec3d::e3()));
+
+    // viewer location
     lon = st.pos_geod.getLongitudeRad();
     lat = st.pos_geod.getLatitudeRad();
     alt = st.pos_geod.getElevationM();
@@ -354,10 +360,8 @@ void SGSky::modify_vis( float alt, float time_factor ) {
        }
 #endif
 
-        // never let visibility drop below 25 meters
-        if ( effvis <= 25.0 ) {
-            effvis = 25.0;
-        }
+        // never let visibility drop below the layer's configured visibility
+       effvis = SG_MAX2<float>(cloud_layers[i]->getVisibility_m(), effvis );
 
     } // for