SGMutex _mutex;
- typedef boost::tuple<std::string, Uniform::Type, std::string> UniformCacheKey;
+ typedef boost::tuple<std::string, Uniform::Type, std::string, std::string> UniformCacheKey;
typedef boost::tuple<ref_ptr<Uniform>, SGPropertyChangeListener*> UniformCacheValue;
std::map<UniformCacheKey,ref_ptr<Uniform> > uniformCache;
}
}
- UniformCacheKey key = boost::make_tuple(name, uniformType, val);
+ UniformCacheKey key = boost::make_tuple(name, uniformType, val, effect->getName());
ref_ptr<Uniform> uniform = uniformCache[key];
if (uniform.valid()) {
// Not sure what to do with "name". At one point I wanted to use it to
// order the passes, but I do support render bin and stuff too...
+// Clément de l'Hamaide 10/2014: "name" is now used in the UniformCacheKey
struct NameBuilder : public PassAttributeBuilder
{
{
void doUpdate(osg::Node* node, osg::NodeVisitor* nv);
};
+
+ std::string getName(){return _name;}
+ void setName(std::string name){_name = name;}
protected:
~Effect();
// Support for a cache of effects that inherit from this one, so
friend Effect* makeEffect(SGPropertyNode* prop, bool realizeTechniques,
const SGReaderWriterOptions* options);
bool _isRealized;
+ std::string _name;
};
// Automatic support for boost hash function
size_t hash_value(const Effect::Key&);
}
}
ref_ptr<Effect> effect;
+ if(!prop->hasChild("name")){
+ setValue(prop->getChild("name", 0, true), "noname");
+ }
+ SGPropertyNode_ptr nameProp = prop->getChild("name");
// Merge with the parent effect, if any
SGPropertyNode_ptr inheritProp = prop->getChild("inherits-from");
Effect* parent = 0;
}
if (!effect.valid()) {
effect = new Effect;
+ effect->setName(nameProp->getStringValue());
effect->root = new SGPropertyNode;
mergePropertyTrees(effect->root, prop, parent->root);
effect->parametersProp = effect->root->getChild("parameters");
}
} else {
effect = new Effect;
+ effect->setName(nameProp->getStringValue());
effect->root = prop;
effect->parametersProp = effect->root->getChild("parameters");
}