]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/Effect.cxx
Ugly hack to please Boost 1.51.0
[simgear.git] / simgear / scene / material / Effect.cxx
index 1645840725607d68b9f040becee05c15f6461de2..c934815760ced8359c0c3678fde2e9b865544deb 100644 (file)
@@ -74,7 +74,7 @@
 #include <simgear/scene/util/StateAttributeFactory.hxx>
 #include <simgear/structure/OSGUtils.hxx>
 #include <simgear/structure/SGExpression.hxx>
-
+#include <simgear/props/vectorPropTemplates.hxx>
 
 
 namespace simgear
@@ -671,9 +671,9 @@ InstallAttributeBuilder<AlphaTestBuilder> installAlphaTest("alpha-test");
 InstallAttributeBuilder<TextureUnitBuilder> textureUnitBuilder("texture-unit");
 
 // Shader key, used both for shaders with relative and absolute names
-typedef pair<string, Shader::Type> ShaderKey;
+typedef pair<string, int> ShaderKey;
 
-inline ShaderKey makeShaderKey(SGPropertyNode_ptr& ptr, Shader::Type shaderType)
+inline ShaderKey makeShaderKey(SGPropertyNode_ptr& ptr, int shaderType)
 {
     return ShaderKey(ptr->getStringValue(), shaderType);
 }
@@ -815,7 +815,7 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
     BOOST_FOREACH(const ShaderKey& shaderKey, prgKey.shaders)
     {
         const string& shaderName = shaderKey.first;
-        Shader::Type stype = shaderKey.second;
+        Shader::Type stype = (Shader::Type)shaderKey.second;
         string fileName = SGModelLib::findDataFile(shaderName, options);
         if (fileName.empty())
             throw BuilderException(string("couldn't find shader ") +
@@ -833,12 +833,13 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
     BOOST_FOREACH(const ShaderKey& skey, resolvedKey.shaders)
     {
         const string& fileName = skey.first;
-        Shader::Type stype = skey.second;
+        Shader::Type stype = (Shader::Type)skey.second;
         ShaderMap::iterator sitr = shaderMap.find(skey);
         if (sitr != shaderMap.end()) {
             program->addShader(sitr->second.get());
         } else {
             ref_ptr<Shader> shader = new Shader(stype);
+                       shader->setName(fileName);
             if (shader->loadShaderSourceFromFile(fileName)) {
                 program->addShader(shader.get());
                 shaderMap.insert(ShaderMap::value_type(skey, shader));
@@ -1392,10 +1393,11 @@ public:
     
     void valueChanged(SGPropertyNode* node)
     {
-        _tniq->refreshValidity();
+        if (_tniq.valid())
+            _tniq->refreshValidity();
     }
 protected:
-    osg::ref_ptr<Technique> _tniq;
+    osg::observer_ptr<Technique> _tniq;
 };
 
 template<typename T>