]> git.mxchange.org Git - simgear.git/commitdiff
Add support for "squashing" the billboarding of individual 3D cloud sprites, to allow...
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Sun, 7 Aug 2011 11:56:10 +0000 (12:56 +0100)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Sun, 7 Aug 2011 11:56:10 +0000 (12:56 +0100)
simgear/scene/sky/CloudShaderGeometry.cxx
simgear/scene/sky/CloudShaderGeometry.hxx
simgear/scene/sky/newcloud.cxx
simgear/scene/sky/newcloud.hxx

index 229710db32ba4fa96dad76aa3ec4bf0a59c5820d..ed9e94f6c127cda96b3ba0ffa979b244900dd265 100644 (file)
@@ -116,7 +116,7 @@ void CloudShaderGeometry::drawImplementation(RenderInfo& renderInfo) const
                            (GLfloat) t.cloud_height };
         extensions->glVertexAttrib3fv(USR_ATTR_1, ua1 );
         extensions->glVertexAttrib3fv(USR_ATTR_2, ua2 );
-        glColor4f(t.position.x(), t.position.y(), t.position.z(), 1.0);
+        glColor4f(t.position.x(), t.position.y(), t.position.z(), zscale);
         _geometry->draw(renderInfo);
     }
 }
index cd00da8de7139c8c252563b66e67cd00e83b3f7a..78f245abb3db3fefd1416721b44786e4f80c7e7c 100644 (file)
@@ -52,8 +52,8 @@ class CloudShaderGeometry : public osg::Drawable
             setUseDisplayList(false); 
         }
 
-        CloudShaderGeometry(int vx, int vy, float width, float height) :
-            varieties_x(vx), varieties_y(vy)
+        CloudShaderGeometry(int vx, int vy, float width, float height, float zsc) :
+            varieties_x(vx), varieties_y(vy), zscale(zsc)
         { 
             setUseDisplayList(false); 
             float x = width/2.0f;
@@ -107,13 +107,14 @@ class CloudShaderGeometry : public osg::Drawable
             _geometry = geometry;
         }
         
-    void addSprite(const SGVec3f& p, int tx, int ty, float w, float h,
-                   float s, float cull, float cloud_height);
+        void addSprite(const SGVec3f& p, int tx, int ty, float w, float h,
+                       float s, float cull, float cloud_height);
                 
         osg::ref_ptr<osg::Drawable> _geometry;
 
         int varieties_x;
         int varieties_y;
+        float zscale;
         
         // Bounding box extents.
         osg::BoundingBox _bbox;
index 69aa193c7a1a37db9a27463a36b4df4907c6a61e..0e76ecbe1e106ddc865536e382196343c380b1f5 100644 (file)
@@ -83,6 +83,7 @@ SGNewCloud::SGNewCloud(const SGPath &texture_root, const SGPropertyNode *cld_def
     num_textures_x = cld_def->getIntValue("num-textures-x", 4);
     num_textures_y = cld_def->getIntValue("num-textures-y", 4);
     bottom_shade = cld_def->getDoubleValue("bottom-shade", 1.0);
+    zscale = cld_def->getDoubleValue("z-scale", 1.0);
     texture = cld_def->getStringValue("texture", "cl_cumulus.png");
 
     // Create a new Effect for the texture, if required.
@@ -165,7 +166,7 @@ osg::ref_ptr<EffectGeode> SGNewCloud::genCloud() {
     
     osg::ref_ptr<EffectGeode> geode = new EffectGeode;
         
-    CloudShaderGeometry* sg = new CloudShaderGeometry(num_textures_x, num_textures_y, max_width, max_height);
+    CloudShaderGeometry* sg = new CloudShaderGeometry(num_textures_x, num_textures_y, max_width, max_height, zscale);
     
     // Determine how big this specific cloud instance is. Note that we subtract
     // the sprite size because the width/height is used to define the limits of
index 941b9ba10bc8734847734d01ef8694fd0befb905..eb92c9249daf50ba9b6120176602106d25479bbb 100644 (file)
@@ -70,6 +70,7 @@ private:
         double min_sprite_height;
         double max_sprite_height;
         double bottom_shade;
+        double zscale;
         int num_sprites;
         int num_textures_x;
         int num_textures_y;