]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/EffectBuilder.hxx
Remove using std:: from the metar header, remove HTTP support, add very basic unit...
[simgear.git] / simgear / scene / material / EffectBuilder.hxx
index e9c7b6a97426c1a6726d671c9b9475115a642893..a30efa5ebd4d7873d4d76399b84400d7379fc38b 100644 (file)
@@ -23,6 +23,7 @@
 #include <string>
 #include <cstring>
 
+#include <osg/Object>
 #include <osgDB/Registry>
 
 #include <boost/bind.hpp>
@@ -121,13 +122,20 @@ struct EffectNameValue
 template<typename FromType,typename ToType>
 struct bidirectional_map
 {
+#if _MSC_VER >= 1600
+    struct value_type {
+        FromType first;
+        ToType second;
+        value_type(FromType f, ToType s) : first(f),second(s){}
+    };
+#else
     typedef std::pair<FromType,ToType> value_type;
+#endif
 
     /* A bidirectional map can be simulated as a multi_index_container
      * of pairs of (FromType,ToType) with two unique indices, one
      * for each member of the pair.
      */
-
     typedef multi_index_container<
         value_type,
         indexed_by<
@@ -314,7 +322,7 @@ getVectorProperties(const SGPropertyNode* prop,
         if (parentName[parentName.size() - 1] != '/')
             parentName.append("/");
         NameItr itr = defaultNames;
-        for (int i = 0; i < vecSize; ++i, ++itr)
+        for (size_t i = 0; i < vecSize; ++i, ++itr)
             result.push_back(parentName + *itr);
     } else if (useProps.size() == vecSize) {
         string parentName = useProps[0]->getStringValue();
@@ -571,6 +579,19 @@ new_EEPropListener(const Func& func, const std::string* propName,
         (func, 0, namesBegin, namesEnd);
 }
 
+/**
+ * Set DYNAMIC data variance on an osg::Object.
+ */
+
+inline void setDynamicVariance(void* obj)
+{
+}
+
+inline void setDynamicVariance(osg::Object* obj)
+{
+    obj->setDataVariance(osg::Object::DYNAMIC);
+}
+
 /**
  * Initialize the value and the possible updating of an effect
  * attribute. If the value is specified directly, set it. Otherwise,
@@ -591,6 +612,7 @@ 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 {
@@ -643,6 +665,7 @@ 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 {