]> git.mxchange.org Git - simgear.git/commitdiff
Make tree textures consistent across runs by replacing rand() call with
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Thu, 15 Sep 2011 20:11:00 +0000 (21:11 +0100)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Thu, 15 Sep 2011 20:11:00 +0000 (21:11 +0100)
something deterministic.

simgear/scene/tgdb/TreeBin.cxx

index 56c5d41588d3616dfc288a2d8b8dcd079a15c3d0..17da8374231b5d06fe559edf76808dc8adb3d1ca 100644 (file)
@@ -253,7 +253,7 @@ struct AddTreesLeafObject
 {
     void operator() (LOD* lod, const TreeBin::Tree& tree) const
     {
-        Geode* geode = static_cast<Geode*>(lod->getChild(rand() % SG_TREE_FADE_OUT_LEVELS));
+        Geode* geode = static_cast<Geode*>(lod->getChild(int(tree.position.x() * 10.0f) % lod->getNumChildren()));
         addTreeToLeafGeode(geode, tree.position);
     }
 };