]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/newcloud.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / sky / newcloud.hxx
index 76ded5e93f6df839d0d82a4938e549d82c0b2c53..88edf19c4bba181683b57d8f16cf449733db3494 100644 (file)
 #ifndef _NEWCLOUD_HXX
 #define _NEWCLOUD_HXX
 
-#include <plib/sg.h>
 #include <simgear/compiler.h>
 #include <string>
 #include <vector>
 #include <osg/Fog>
 
-#include "bbcache.hxx"
+#include <simgear/math/sg_random.h>
+#include <simgear/scene/material/Effect.hxx>
+#include <simgear/scene/material/EffectGeode.hxx>
 
 using std::string;
 using std::vector;
@@ -40,49 +41,73 @@ using std::vector;
 class SGNewCloud {
 
 public:
-        SGNewCloud(const SGPath &tex_path, 
-                    string tex,
-                    double min_w,
-                    double max_w,
-                    double min_h,
-                    double max_h,
-                    double min_sprite_w,
-                    double max_sprite_w,
-                    double min_sprite_h,
-                    double max_sprite_h,
-                    double b,
-                    int n,
-                    int nt_x,
-                    int nt_y);
-        
-       ~SGNewCloud();
+        SGNewCloud(const SGPath &texture_root, const SGPropertyNode *cld_def, mt* s);
+
+        ~SGNewCloud();
 
         // Generate a Cloud
-        osg::ref_ptr<osg::Geode> genCloud ();
+        osg::ref_ptr<simgear::EffectGeode> genCloud ();
+
+        static float getDensity(void)
+        {
+            return sprite_density;
+        }
+    
+        // Set the sprite density
+        static void setDensity(double d)
+        {
+            sprite_density = d;
+        }
+        
 
 private:
 
-        double min_width;
-        double max_width;
-        double min_height;
-        double max_height;
-        double min_sprite_width;
-        double max_sprite_width;
-        double min_sprite_height;
-        double max_sprite_height;
-        double bottom_shade;
+        float min_width;
+        float max_width;
+        float min_height;
+        float max_height;
+        float min_sprite_width;
+        float max_sprite_width;
+        float min_sprite_height;
+        float max_sprite_height;
+        
+        // Minimum and maximum bottom, middle, top, sunny, shade lighting
+        // factors. For individual clouds we choose a bottom/middle/top
+        // shade from between each min/max value
+        float min_bottom_lighting_factor;
+        float max_bottom_lighting_factor;
+        float min_middle_lighting_factor;
+        float max_middle_lighting_factor;
+        float min_top_lighting_factor;
+        float max_top_lighting_factor;
+        float min_shade_lighting_factor;
+        float max_shade_lighting_factor;
+        
+        // The density of the cloud is the shading applied
+        // to cloud sprites on the opposite side of the cloud
+        // from the sun. For an individual cloud instance a value
+        // between min_density and max_density is chosen.
+        float min_density;
+        float max_density;
+        
+        // zscale indicates how sprites should be scaled vertically
+        // after billboarding. 
+        float zscale;
+        bool height_map_texture;
         int num_sprites;
         int num_textures_x;
         int num_textures_y;
-        const string texture;
+        string texture;
         osg::Geometry* quad;
-        osg::ref_ptr<osg::StateSet> stateSet;
+        osg::ref_ptr<simgear::Effect> effect;
+        static float sprite_density;
+        
+        // RNG seed for this cloud
+        mt* seed;
 
         osg::Geometry* createOrthQuad(float w, float h, int varieties_x, int varieties_y);
-
-public:
-
 };
 
 
+
 #endif // _NEWCLOUD_HXX