]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sky/cloud.hxx
Preparation for making dynamic cloud layers -- moved cloud state out
[simgear.git] / simgear / sky / cloud.hxx
index 05961c54af56af73f0d14dc36c9ee5d6f1f5e00a..36746d888ca1f586cacff210e549fd080d6a91e9 100644 (file)
@@ -4,19 +4,20 @@
 //
 // Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
 //
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
 //
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
+// Library General Public License for more details.
 //
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA  02111-1307, USA.
 //
 // $Id$
 
 #ifndef _SG_CLOUD_HXX_
 #define _SG_CLOUD_HXX_
 
+#include <simgear/compiler.h>
 
 #include <plib/ssg.h>
 
-#include <simgear/misc/fgpath.hxx>
-
-
-enum SGCloudType {
-    SG_CLOUD_OVERCAST = 0,
-    SG_CLOUD_MOSTLY_CLOUDY,
-    SG_CLOUD_MOSTLY_SUNNY,
-    SG_CLOUD_CIRRUS,
-};
+#include STL_STRING
+SG_USING_STD(string);
 
 
 class SGCloudLayer {
 
-private:
+public:
 
-    ssgRoot *layer_root;
-    ssgTransform *layer_transform;
-    ssgSimpleState *layer_state;
+    enum Type {
+       SG_CLOUD_OVERCAST = 0,
+       SG_CLOUD_MOSTLY_CLOUDY,
+       SG_CLOUD_MOSTLY_SUNNY,
+       SG_CLOUD_CIRRUS,
+       SG_CLOUD_CLEAR,
+       SG_MAX_CLOUD_TYPES
+    };
 
-    ssgColourArray *cl; 
-    ssgVertexArray *vl;
-    ssgTexCoordArray *tl;
+    // Constructors
+    SGCloudLayer( const string &tex_path );
 
-    // height above sea level (meters)
-    float layer_asl;
-    float layer_thickness;
-    float layer_transition;
-    float size;
-    float scale;
+    // Destructor
+    ~SGCloudLayer( void );
 
-    // 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;
+    float getSpan_m () const;
+    void setSpan_m (float span_m);
 
-public:
+    float getElevation_m () const;
+    void setElevation_m (float elevation_m);
 
-    // Constructor
-    SGCloudLayer( void );
+    float getThickness_m () const;
+    void setThickness_m (float thickness_m);
 
-    // Destructor
-    ~SGCloudLayer( void );
+    float getTransition_m () const;
+    void setTransition_m (float transition_m);
+
+    Type getType () const;
+    void setType (Type type);
 
     // build the cloud object
-    void build( FGPath path, double size, double asl, double thickness,
-               double transition, SGCloudType type );
+    void rebuild();
 
     // repaint the cloud colors based on current value of sun_angle,
     // sky, and fog colors.  This updates the color arrays for
@@ -95,9 +90,34 @@ public:
     // draw the cloud layer
     void draw();
 
-    inline float get_asl() const { return layer_asl; }
-    inline float get_thickness() const { return layer_thickness; }
-    inline float get_transition() const { return layer_transition; }
+private:
+
+    static ssgSimpleState *layer_states[SG_MAX_CLOUD_TYPES];
+    static int layer_sizes[SG_MAX_CLOUD_TYPES];
+
+    ssgRoot *layer_root;
+    ssgTransform *layer_transform;
+    ssgLeaf * layer;
+
+    ssgColourArray *cl; 
+    ssgVertexArray *vl;
+    ssgTexCoordArray *tl;
+
+    // height above sea level (meters)
+    SGPath texture_path;
+    float layer_span;
+    float layer_asl;
+    float layer_thickness;
+    float layer_transition;
+    Type layer_type;
+    float scale;
+
+    // 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;
+
 };