]> git.mxchange.org Git - simgear.git/commitdiff
Merge branch 'timoore/effects'
authorTim Moore <timoore33@gmail.com>
Sun, 20 Dec 2009 15:07:00 +0000 (16:07 +0100)
committerTim Moore <timoore33@gmail.com>
Sun, 20 Dec 2009 15:07:00 +0000 (16:07 +0100)
Conflicts:
simgear/scene/model/model.cxx
simgear/scene/sky/newcloud.cxx

1  2 
configure.ac
simgear/scene/model/model.cxx
simgear/scene/sky/CloudShaderGeometry.cxx
simgear/scene/sky/newcloud.cxx

diff --cc configure.ac
Simple merge
index d41529ad5c8b8fbf2cdeeabb508d5003c566afe4,9ca65c89d23fb323df12be01845a8c24ad15631b..59f33694956d600a31858e939f93bae7fd17a568
  #include <osgDB/ReadFile>
  #include <osgDB/SharedStateManager>
  
 +#include <simgear/math/SGMath.hxx>
+ #include <simgear/scene/material/Effect.hxx>
+ #include <simgear/scene/material/EffectGeode.hxx>
  #include <simgear/scene/util/SGSceneFeatures.hxx>
+ #include <simgear/scene/util/SGSceneUserData.hxx>
+ #include <simgear/scene/util/CopyOp.hxx>
+ #include <simgear/scene/util/SplicingVisitor.hxx>
  
  #include <simgear/structure/exception.hxx>
+ #include <simgear/structure/Singleton.hxx>
  #include <simgear/props/props.hxx>
  #include <simgear/props/props_io.hxx>
  #include <simgear/props/condition.hxx>
index d641b2c92827c8e49f0a8bb17f764775c95a48c7,1518b13306a2f3b58070c7cf6d3c631c682b2ce5..f4eb8de272c6fb801ca3e4962bf9989798398adf
@@@ -322,38 -219,27 +211,36 @@@ osg::ref_ptr<EffectGeode> SGNewCloud::g
              double elev  = sg_random() * SGD_PI;
              x = width * cos(theta) * 0.5f * sin(elev);
              y = width * sin(theta) * 0.5f * sin(elev);
 -            z = height * cos(elev) * 0.5f; 
 +            z = height * cos(elev) * 0.5f;
          }
          
-         SGVec3f *pos = new SGVec3f(x, y, z); 
-         // Determine the height and width as scaling factors on the minimum size (used to create the quad).
+         // Determine the height and width as scaling factors on the minimum size (used to create the quad)
          float sprite_width = 1.0f + sg_random() * (max_sprite_width - min_sprite_width) / min_sprite_width;
          float sprite_height = 1.0f + sg_random() * (max_sprite_height - min_sprite_height) / min_sprite_height;
 -        
 -        if (i == 2) {
 +
 +        // Sprites are never taller than square.
 +        if (sprite_height * min_sprite_height > sprite_width * min_sprite_width)
 +        {
 +            sprite_height = sprite_width * min_sprite_width / min_sprite_height;
 +        }
 +
 +        if (i == 0) {
              // The center sprite is always maximum size to fill up any holes.
              sprite_width = 1.0f + (max_sprite_width - min_sprite_width) / min_sprite_width;
              sprite_height = 1.0f + (max_sprite_height - min_sprite_height) / min_sprite_height;
          }
 -        
 -        // Determine the sprite texture indexes;
 +
 +        // Determine the sprite texture indexes.
          int index_x = (int) floor(sg_random() * num_textures_x);
          if (index_x == num_textures_x) { index_x--; }
 -        
 -        int index_y = (int) floor(sg_random() * num_textures_y);
 +
 +        // The y index depends on the positing of the sprite within the cloud.
 +        // This allows cloud designers to have particular sprites for the base
 +        // and tops of the cloud.
 +        int index_y = (int) floor((z / height + 0.5f) * num_textures_y);
          if (index_y == num_textures_y) { index_y--; }
          
-         sg->addSprite(*pos
+         sg->addSprite(SGVec3f(x, y, z)
                      index_x, 
                      index_y, 
                      sprite_width,