]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/cloud.hxx
Work around a limitation of gc_calc_course_dist(). When the start and end
[simgear.git] / simgear / scene / sky / cloud.hxx
index 3853aeb36032e79c2218549dfa241d38b741fe48..76a3cb881df6245adaa59f229d18ced32bafe046 100644 (file)
 #include STL_STRING
 SG_USING_STD(string);
 
+// #include <iostream>
+// SG_USING_STD(cout);
+// SG_USING_STD(endl);
+
 
 /**
  * A class layer to model a single cloud layer
@@ -81,8 +85,9 @@ public:
      * of the cloud layer.  The elevation of the top of the layer is
      * elevation_m + thickness_m.
      * @param elevation_m the layer elevation in meters
+     * @param set_span defines whether it is allowed to adjust the span
      */
-    void setElevation_m (float elevation_m);
+    void setElevation_m (float elevation_m, bool set_span = true);
 
     /** get the layer thickness */
     float getThickness_m () const;
@@ -98,6 +103,7 @@ public:
      * visibility.
      */
     float getTransition_m () const;
+
     /**
      * set the transition layer size in meters
      * @param transition_m the transition layer size in meters
@@ -106,12 +112,37 @@ public:
 
     /** get coverage type */
     Coverage getCoverage () const;
+
     /**
      * set coverage type
      * @param coverage the coverage type
      */
     void setCoverage (Coverage coverage);
 
+    /**
+     * set the cloud movement direction
+     * @param dir the cloud movement direction
+     */
+    inline void setDirection(float dir) { 
+        // cout << "cloud dir = " << dir << endl;
+        direction = dir;
+    }
+
+    /** get the cloud movement direction */
+    inline float getDirection() { return direction; }
+
+    /**
+     * set the cloud movement speed 
+     * @param sp the cloud movement speed
+     */
+    inline void setSpeed(float sp) {
+        // cout << "cloud speed = " << sp << endl;
+        speed = sp;
+    }
+
+    /** get the cloud movement speed */
+    inline float getSpeed() { return speed; }
+
     /** build the cloud object */
     void rebuild();
 
@@ -130,8 +161,10 @@ public:
      * @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 dt the time elapsed since the last call
      */
-    bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt );
+    bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt,
+                     double dt = 0.0 );
 
     /** draw the cloud layer */
     void draw();
@@ -154,13 +187,14 @@ private:
     float layer_transition;
     Coverage layer_coverage;
     float scale;
+    float speed;
+    float direction;
 
     // for handling texture coordinates to simulate cloud movement
     // from winds, and to simulate the clouds being tied to ground
     // position, not view position
     // double xoff, yoff;
-    double last_lon, last_lat;
-
+    double last_lon, last_lat, last_course;
 };