]> git.mxchange.org Git - simgear.git/commitdiff
Fall back to taking tree textures from Terrain/ if they are not found under
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 10 Feb 2012 22:49:20 +0000 (22:49 +0000)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 10 Feb 2012 22:49:20 +0000 (22:49 +0000)
Terrain.high, consistent with the other textures in materials.xml.

Also fix comment.

simgear/scene/material/mat.cxx
simgear/scene/tgdb/SGTexturedTriangleBin.hxx

index b3914bcd021363f981861a8f8c19f8770eb571c3..5888b8672d17cdf1e3e49cf5acf320817e19f785 100644 (file)
@@ -244,9 +244,21 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
   tree_varieties = props->getIntValue("tree-varieties", 1);
 
   const SGPropertyNode* treeTexNode = props->getChild("tree-texture");
+  
   if (treeTexNode) {
     string treeTexPath = props->getStringValue("tree-texture");
-    tree_texture = SGModelLib::findDataFile(treeTexPath, options);
+    
+    if (! treeTexPath.empty()) {
+      SGPath treePath("Textures.high");
+      treePath.append(treeTexPath);
+      tree_texture = SGModelLib::findDataFile(treePath.str(), options);
+      
+      if (tree_texture.empty()) {
+        treePath = SGPath("Textures");
+        treePath.append(treeTexPath);
+        tree_texture = SGModelLib::findDataFile(treePath.str(), options);
+      }    
+    }
   }
   
   // surface values for use with ground reactions
index 61783ccc1e1abab144e46d529435d95921966810..3e722d9893f5758ce4860e75028050a6f0ba2277 100644 (file)
@@ -275,9 +275,7 @@ public:
           SGVec2f texCoord = a*t0 + b*t1 + c*t2;
           
           // Check this random point against the object mask
-          // blue (for buildings) channel. Also check
-          // that they are more than spacing metres away from
-          // any other point.
+          // blue (for buildings) channel. 
           osg::Image* img = object_mask->getImage();            
           unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
           unsigned int y = (int) (img->t() * texCoord.y()) % img->t();