materials.xml defined vegetation Effect.

This commit is contained in:
Stuart Buchanan
2015-02-17 21:47:51 +00:00
parent ce7f78e0ca
commit 6f15bb415f
5 changed files with 17 additions and 1 deletions

View 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);

View 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

View 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();

View 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)

View 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); }