Guest User

Untitled

a guest
Feb 8th, 2014
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/simgear/scene/tgdb/obj.cxx b/simgear/scene/tgdb/obj.cxx
  2. index edb35f2..767c930 100644
  3. --- a/simgear/scene/tgdb/obj.cxx
  4. +++ b/simgear/scene/tgdb/obj.cxx
  5. @@ -40,6 +40,7 @@
  6. #include <osg/Referenced>
  7. #include <osg/StateSet>
  8. #include <osg/Switch>
  9. +#include <osgUtil/Simplifier>
  10.  
  11. #include <boost/foreach.hpp>
  12.  
  13. @@ -1213,6 +1214,25 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
  14. terrainGroup->setName("BTGTerrainGroup");
  15.  
  16. osg::Node* node = tileGeometryBin->getSurfaceGeometry(matlib);
  17. +
  18. + bool simplifierState = false;
  19. + double ratio = 0.001;
  20. + double maxLength = 1000.0;
  21. + double maxError = 1000.0;
  22. + if(options){
  23. + SGPropertyNode* propertyNode = options->getPropertyNode().get();
  24. + if (propertyNode) {
  25. + simplifierState = propertyNode->getBoolValue("/sim/rendering/terrain/simplifier/enabled", simplifierStat
  26. + ratio = propertyNode->getDoubleValue("/sim/rendering/terrain/simplifier/ratio", ratio);
  27. + maxLength = propertyNode->getDoubleValue("/sim/rendering/terrain/simplifier/max-length", maxLength);
  28. + maxError = propertyNode->getDoubleValue("/sim/rendering/terrain/simplifier/max-error", maxError);
  29. + }
  30. + }
  31. + if(simplifierState) {
  32. + osgUtil::Simplifier simplifier(ratio, maxError, maxLength);
  33. + node->accept(simplifier);
  34. + }
  35. +
  36. if (node)
  37. terrainGroup->addChild(node);
RAW Paste Data