]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/cloudfield.hxx
Merge branch 'ehofman/sound'
[simgear.git] / simgear / scene / sky / cloudfield.hxx
index f5027b43157bdc256d97b63221ec7e957d325693..1b2f97f187bdaf5ed5a76bd4cdab2de803179e8f 100644 (file)
@@ -26,7 +26,7 @@
 #include <plib/sg.h>
 #include <simgear/compiler.h>
 #include <vector>
-#include <osgSim/Impostor>
+
 #include <osgDB/ReaderWriter>
 
 #include <osg/ref_ptr>
 #include <osg/Geometry>
 #include <osg/Group>
 #include <osg/Switch>
-#include <osg/Billboard>
+
+namespace osg
+{
+        class Fog;
+        class StateSet;
+        class Vec4f;
+}
 
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/structure/Singleton.hxx>
 
 using std::vector;
 
@@ -67,6 +74,7 @@ private:
 
         osg::ref_ptr<osg::Group> field_root;
         osg::ref_ptr<osg::MatrixTransform> field_transform;
+        osg::ref_ptr<osg::PositionAttitudeTransform> altitude_transform;
         osg::ref_ptr<osg::Switch> field_group[QUADTREE_SIZE][QUADTREE_SIZE];
         osg::ref_ptr<osg::LOD> quad[BRANCH_SIZE][BRANCH_SIZE];
         
@@ -75,9 +83,15 @@ private:
        double deltax, deltay, alt;
         double last_course;
         sgSphere field_sphere;
-       float   last_coverage;
+       float last_coverage;
+        float coverage;
         SGGeoc cld_pos;
         int reposition_count;
+        struct CloudFog : public simgear::Singleton<CloudFog>
+        {
+                CloudFog();
+                osg::ref_ptr<osg::Fog> fog;
+        };
 public:
 
        SGCloudField();
@@ -108,21 +122,26 @@ public:
 
        static sgVec3 view_vec, view_X, view_Y;
 
-       static float coverage;
         static float view_distance;
         static double timer_dt;
        static float fieldSize;
        
         bool defined3D;
 
-       static float getCoverage(void) { return coverage; }
-       static void setCoverage(float coverage) { coverage = coverage; }
+       float getCoverage(void) { return coverage; }
+       void setCoverage(float c) { coverage = c; }
 
         static float getVisRange(void) { return view_distance; }
         static void setVisRange(float d) { view_distance = d; }
         
         void applyCoverage(void);
         void applyVisRange(void);
+        
+        static osg::Fog* getFog()
+        {
+                return CloudFog::instance()->fog.get();
+        }
+        static void updateFog(double visibility, const osg::Vec4f& color);
 };
 
 #endif // _CLOUDFIELD_HXX