]> git.mxchange.org Git - simgear.git/commitdiff
materials.xml defined vegetation Effect.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Tue, 17 Feb 2015 21:47:51 +0000 (21:47 +0000)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Tue, 17 Feb 2015 21:47:51 +0000 (21:47 +0000)
simgear/scene/material/mat.cxx
simgear/scene/material/mat.hxx
simgear/scene/tgdb/SGTileDetailsCallback.hxx
simgear/scene/tgdb/TreeBin.cxx
simgear/scene/tgdb/TreeBin.hxx

index a39c71c153cffa098ce2e6299a99952ca5ab111b..d90a40ed4a06fdd1bfa455b7cab2b2b6cb156fd7 100644 (file)
@@ -323,6 +323,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
         
     // Random vegetation properties
     wood_coverage = props->getDoubleValue("wood-coverage", 0.0);
+    tree_effect = props->getStringValue("tree-effect", "Effects/tree");
     tree_height = props->getDoubleValue("tree-height-m", 0.0);
     tree_width = props->getDoubleValue("tree-width-m", 0.0);
     tree_range = props->getDoubleValue("tree-range-m", 0.0);
index ef420d947552a5efbff9250729814e392fd0e0cd..ee094fa61d2c85d2748e1e99916b259cf8ed08b1 100644 (file)
@@ -273,6 +273,14 @@ public:
    * @return the texture to use for trees.
    */
   inline std::string get_tree_texture () const { return  tree_texture; }
+
+
+  /**
+   * Get the effect file name to use for trees
+   *
+   * @return the effect to use for this set of trees.
+   */
+  inline std::string get_tree_effect () const { return  tree_effect; }
   
   /**
    * Get the cosine of the maximum tree density slope angle. We
@@ -476,6 +484,9 @@ private:
   
   // Tree texture, typically a strip of applicable tree textures
   std::string tree_texture;
+
+  // Tree effect to be used for a particular material
+  std::string tree_effect;
   
   // Object mask, a simple RGB texture used as a mask when placing
   // random vegetation, objects and buildings
index 44c7f86ff7bb178c590862bb999b5233a8bee4d8..ced1403cfc0521496b2b7bfeae691915761960b0 100644 (file)
@@ -723,6 +723,7 @@ public:
             BOOST_FOREACH(bin, randomForest)
             {
                 if ((bin->texture           == mat->get_tree_texture()  ) &&
+                               (bin->teffect           == mat->get_tree_effect()   ) &&
                     (bin->texture_varieties == mat->get_tree_varieties()) &&
                     (bin->range             == mat->get_tree_range()    ) &&
                     (bin->width             == mat->get_tree_width()    ) &&
@@ -736,6 +737,8 @@ public:
                 bin = new TreeBin();
                 bin->texture = mat->get_tree_texture();
                 SG_LOG(SG_INPUT, SG_DEBUG, "Tree texture " << bin->texture);
+                bin->teffect = mat->get_tree_effect();
+                SG_LOG(SG_INPUT, SG_DEBUG, "Tree effect " << bin->teffect);
                 bin->range   = mat->get_tree_range();
                 bin->width   = mat->get_tree_width();
                 bin->height  = mat->get_tree_height();
index 9b8aa3bcb9f613a0f7e2b546916b65d1e095bb53..64928084b3b8556a94aca3b688bac27134aa855f 100644 (file)
@@ -343,7 +343,7 @@ osg::Group* createForest(SGTreeBinList& forestList, const osg::Matrix& transform
             (!iter->second.lock(effect)))
         {
             SGPropertyNode_ptr effectProp = new SGPropertyNode;
-            makeChild(effectProp, "inherits-from")->setStringValue("Effects/tree");
+            makeChild(effectProp, "inherits-from")->setStringValue(forest->teffect);
             SGPropertyNode* params = makeChild(effectProp, "parameters");
             // emphasize n = 0
             params->getChild("texture", 0, true)->getChild("image", 0, true)
index 9b9c3bc91a2e5466bce318d7ed2026b655993a57..80441ec4d05e73bc0d7d0b3be32f16fe92cc2f0e 100644 (file)
@@ -49,6 +49,7 @@ public:
     float height;
     float width;
     std::string texture;
+    std::string teffect;
     
     void insert(const Tree& t)
     { _trees.push_back(t); }