#include <simgear/math/sg_random.h>
#include <simgear/scene/util/RenderConstants.hxx>
+#include <simgear/sg_inlines.h>
#include <osg/StateSet>
#include <osg/Depth>
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();
}
#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