]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/EffectBuilder.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / material / EffectBuilder.hxx
index 3447024f1b564f8f2abbbb2581f1c0af5246ca6b..06b8ba9f4ab32b054bb9f45583fb16a3c1333e37 100644 (file)
@@ -167,7 +167,7 @@ EffectPropertyMap<T>::EffectPropertyMap(const EffectNameValue<T> (&attrs)[N])
 template<typename T>
 struct SimplePropertyMap
 {
-    typedef std::map<string, T> map_type;
+    typedef std::map<std::string, T> map_type;
     map_type _map;
     template<int N>
     SimplePropertyMap(const EffectNameValue<T> (&attrs)[N])
@@ -197,8 +197,8 @@ void findAttr(const effect::EffectPropertyMap<T>& pMap,
     typename EffectPropertyMap<T>::BMap::iterator itr
         = pMap._map.template get<from>().find(name);
     if (itr == pMap._map.end()) {
-        throw effect::BuilderException(string("findAttr: could not find attribute ")
-                               string(name));
+        throw effect::BuilderException(std::string("findAttr: could not find attribute ")
+                                       + std::string(name));
     } else {
         result = itr->second;
     }
@@ -316,7 +316,7 @@ getVectorProperties(const SGPropertyNode* prop,
     PropertyList useProps = prop->getChildren("use");
     if (useProps.size() == 1) {
         string parentName = useProps[0]->getStringValue();
-        if (parentName.size() == 0 || parentName[0] != '/')
+        if (parentName.empty() || parentName[0] != '/')
             parentName = options->getPropertyNode()->getPath() + "/" + parentName;
         if (parentName[parentName.size() - 1] != '/')
             parentName.append("/");
@@ -331,7 +331,7 @@ getVectorProperties(const SGPropertyNode* prop,
              itr != end;
              ++itr) {
             string childName = (*itr)->getStringValue();
-            if (childName.size() == 0 || childName[0] != '/')
+            if (childName.empty() || childName[0] != '/')
                 result.push_back(parentName + childName);
             else
                 result.push_back(childName);
@@ -373,7 +373,7 @@ public:
 template<typename T>
 struct InstallAttributeBuilder
 {
-    InstallAttributeBuilder(const string& name)
+    InstallAttributeBuilder(const std::string& name)
     {
         PassAttributeBuilder::PassAttrMapSingleton::instance()
             ->passAttrMap.insert(make_pair(name, new T));
@@ -614,10 +614,10 @@ initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj,
     const SGPropertyNode* valProp = getEffectPropertyNode(effect, prop);
     if (!valProp)
         return;
-    setDynamicVariance(obj);
     if (valProp->nChildren() == 0) {
         setter(obj, valProp->getValue<OSGParamType>());
     } else {
+        setDynamicVariance(obj);
         std::string propName = getGlobalProperty(valProp, options);
         ScalarChangeListener<OSGParamType, ObjType, F>* listener
             = new ScalarChangeListener<OSGParamType, ObjType, F>(obj, setter,
@@ -667,10 +667,10 @@ initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj,
     const SGPropertyNode* valProp = getEffectPropertyNode(effect, prop);
     if (!valProp)
         return;
-    setDynamicVariance(obj);
     if (valProp->nChildren() == 0) { // Has <use>?
         setter(obj, Bridge<OSGParamType>::get(valProp->getValue<sg_type>()));
     } else {
+        setDynamicVariance(obj);
         std::vector<std::string> paramNames
             = getVectorProperties(valProp, options,numComponents, nameItr);
         if (paramNames.empty())