]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/cloud.hxx
Added some OSG headers for the correct evaluation of the OSG_VERSION_LESS_THAN macro.
[simgear.git] / simgear / scene / sky / cloud.hxx
index 9e38687c7ecb526c713cef63560dd4bf269fa956..fb4cf3c55fe06e408dd292fb6c7d3ab594deaf66 100644 (file)
@@ -32,8 +32,7 @@
 #include <simgear/math/SGMath.hxx>
 #include <simgear/structure/SGReferenced.hxx>
 
-#include STL_STRING
-SG_USING_STD(string);
+#include <string>
 
 #include <osg/ref_ptr>
 #include <osg/Array>
@@ -63,11 +62,18 @@ public:
        SG_MAX_CLOUD_COVERAGES
     };
 
+    static const std::string SG_CLOUD_OVERCAST_STRING; // "overcast"
+    static const std::string SG_CLOUD_BROKEN_STRING; // "broken"
+    static const std::string SG_CLOUD_SCATTERED_STRING; // "scattered"
+    static const std::string SG_CLOUD_FEW_STRING; // "few"
+    static const std::string SG_CLOUD_CIRRUS_STRING; // "cirrus"
+    static const std::string SG_CLOUD_CLEAR_STRING; // "clear"
+
     /**
      * Constructor
      * @param tex_path the path to the set of cloud textures
      */
-    SGCloudLayer( const string &tex_path );
+    SGCloudLayer( const std::string &tex_path );
 
     /**
      * Destructor
@@ -101,6 +107,16 @@ public:
      */
     void setThickness_m (float thickness_m);
 
+    /** get the layer visibility */
+    float getVisibility_m() const;
+    /**
+     * set the layer visibility 
+     * @param visibility_m the layer minimum visibility in meters.
+     */
+    void setVisibility_m(float visibility_m);
+
+
+
     /**
      * get the transition/boundary layer depth in meters.  This
      * allows gradual entry/exit from the cloud layer via adjusting
@@ -123,6 +139,18 @@ public:
      */
     void setCoverage (Coverage coverage);
 
+    /** get coverage as string */
+    const std::string & getCoverageString() const;
+
+    /** get coverage as string */
+    static const std::string & getCoverageString( Coverage coverage );
+
+    /** get coverage type from string */
+    static Coverage getCoverageType( const std::string & coverage );
+
+    /** set coverage as string */
+    void setCoverageString( const std::string & coverage );
+
     /**
      * set the cloud movement direction
      * @param dir the cloud movement direction
@@ -155,13 +183,26 @@ public:
      */
     inline void setAlpha( float alpha ) {
         if ( alpha < 0.0 ) { alpha = 0.0; }
-        if ( alpha > 1.0 ) { alpha = 1.0; }
+        if ( alpha > max_alpha ) { alpha = max_alpha; }
         cloud_alpha = alpha;
     }
 
+    inline void setMaxAlpha( float alpha ) {
+        if ( alpha < 0.0 ) { alpha = 0.0; }
+        if ( alpha > 1.0 ) { alpha = 1.0; }
+        max_alpha = alpha;
+    }
+
+    inline float getMaxAlpha() const {
+        return max_alpha;
+    }
+
     /** build the cloud object */
     void rebuild();
 
+    /** Enable/disable 3D clouds in this layer */
+    void set_enable3dClouds(bool enable);
+
     /**
      * repaint the cloud colors based on the specified fog_color
      * @param fog_color the fog color
@@ -173,25 +214,26 @@ public:
      * orientation.
      * @param p position vector
      * @param up the local up vector
-     * @param lon specifies a rotation about the Z axis
-     * @param lat specifies a rotation about the new Y axis
-     * @param spin specifies a rotation about the new Z axis
-     *        (and orients the sunrise/set effects)
+     * @param lon TODO
+     * @param lat TODO
+     * @param alt TODO
      * @param dt the time elapsed since the last call
      */
-    bool reposition( const SGVec3f& p, const SGVec3f& up,
+    bool reposition( const SGVec3f& p,
+                     const SGVec3f& up,
                      double lon, double lat, double alt,
                      double dt = 0.0 );
 
-    osg::Switch* getNode() { return layer_root.get(); }
-
-    static bool enable_bump_mapping;
+    osg::Switch* getNode() { return cloud_root.get(); }
 
     /** return the 3D layer cloud associated with this 2D layer */
     SGCloudField *get_layer3D(void) { return layer3D; }
 
+protected:
+    void setTextureOffset(const osg::Vec2& offset);
 private:
 
+    osg::ref_ptr<osg::Switch> cloud_root;
     osg::ref_ptr<osg::Switch> layer_root;
     osg::ref_ptr<osg::Group> group_top, group_bottom;
     osg::ref_ptr<osg::MatrixTransform> layer_transform;
@@ -210,6 +252,7 @@ private:
     float layer_asl;
     float layer_thickness;
     float layer_transition;
+    float layer_visibility;
     Coverage layer_coverage;
     float scale;
     float speed;
@@ -219,11 +262,14 @@ private:
     // from winds, and to simulate the clouds being tied to ground
     // position, not view position
     // double xoff, yoff;
-    double last_lon, last_lat, last_course;
+    SGGeod last_pos;
+    double last_course;
+    double max_alpha;
 
     osg::Vec2 base;
 
     SGCloudField *layer3D;
+
 };
 
 #endif // _SG_CLOUD_HXX_