]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/cloudfield.cxx
accomodate changes to osgDB::DatabasePager interface
[simgear.git] / simgear / scene / sky / cloudfield.cxx
index e861442868f4417d1b0ab57759b610af3fad85f7..7d738563f5ac936e2ccdf5e160033c0dd7e464fc 100644 (file)
 
 #include <simgear/compiler.h>
 
-#include <plib/sg.h>
 #include <simgear/math/sg_random.h>
 #include <simgear/math/sg_geodesy.hxx>
-#include <simgear/math/polar3d.hxx>
 
 #include <algorithm>
 #include <vector>
@@ -63,15 +61,10 @@ using std::vector;
 using namespace simgear;
 
 
-#if defined (__CYGWIN__)
-#include <ieeefp.h>
-#endif
-
 float SGCloudField::fieldSize = 50000.0f;
 double SGCloudField::timer_dt = 0.0;
 float SGCloudField::view_distance = 20000.0f;
-sgVec3 SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
-SGCloudField::StateSetMap SGCloudField::cloudTextureMap;
+SGVec3f SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
 
 // reposition the cloud layer at the specified origin and orientation
 bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon, double lat,
@@ -96,7 +89,7 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
         // First time or very large distance
         SGVec3<double> cart;
         SGGeodesy::SGGeodToCart(SGGeod::fromRad(lon, lat), cart);
-        T.makeTranslate(cart.osg());
+        T.makeTranslate(toOsg(cart));
         
         LON.makeRotate(lon, osg::Vec3(0, 0, 1));
         LAT.makeRotate(90.0 * SGD_DEGREES_TO_RADIANS - lat, osg::Vec3(0, 1, 0));
@@ -129,7 +122,7 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
         
         SGVec3<double> cart;
         SGGeodesy::SGGeodToCart(SGGeod::fromRad(cld_pos.getLongitudeRad(), cld_pos.getLatitudeRad()), cart);
-        T.makeTranslate(cart.osg());
+        T.makeTranslate(toOsg(cart));
         
         LON.makeRotate(cld_pos.getLongitudeRad(), osg::Vec3(0, 0, 1));
         LAT.makeRotate(90.0 * SGD_DEGREES_TO_RADIANS - cld_pos.getLatitudeRad(), osg::Vec3(0, 1, 0));
@@ -137,7 +130,8 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
         field_transform->setMatrix( LAT*LON*T );
     }
     
-    field_root->getStateSet()->setRenderBinDetails(asl, "DepthSortedBin");
+    // Render the clouds in order from farthest away layer to nearest one.
+    field_root->getStateSet()->setRenderBinDetails(CLOUDS_BIN, "DepthSortedBin");
 
     return true;
 }
@@ -151,8 +145,8 @@ SGCloudField::SGCloudField() :
        last_course(0.0),
        last_coverage(0.0),
         coverage(0.0),
-        defined3D(false),
-        reposition_count(0)
+        reposition_count(0),
+        defined3D(false)
 {
     cld_pos = SGGeoc();
     field_root->addChild(field_transform.get());
@@ -274,7 +268,7 @@ void SGCloudField::addCloud( SGVec3f& pos, SGNewCloud *cloud) {
         
         osg::ref_ptr<osg::PositionAttitudeTransform> transform = new osg::PositionAttitudeTransform;
 
-        transform->setPosition(pos.osg());
+        transform->setPosition(toOsg(pos));
         transform->addChild(geode.get());
         
         field_group[x][y]->addChild(transform.get(), true);