]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/Effect.cxx
Random buildings - initial commit.
[simgear.git] / simgear / scene / material / Effect.cxx
index a3064fdf1c95833d7a177195797b1f637f6381de..978aa064e7d7f4851842dc4784e9c5eab649bfea 100644 (file)
@@ -839,6 +839,7 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
             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));
@@ -998,8 +999,8 @@ struct UniformBuilder :public PassAttributeBuilder
         // optimize common uniforms
         if (uniformType == Uniform::SAMPLER_2D || uniformType == Uniform::INT)
         {
-            int val;
-            uniform->get(val);
+            int val = 0;
+            uniform->get(val); // 'val' remains unchanged in case of error (Uniform is a non-scalar)
             if (uniformType == Uniform::SAMPLER_2D && val == 0
                 && name == "texture") {
                 uniform = texture0;
@@ -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>