From b5366cbda69f336cff1fc02e9e97903679c51544 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 2 Jun 2004 14:15:08 +0000 Subject: [PATCH] Added DataSet::s/getSkirtRatio() method to allow control of how deep to make the skirts around tiles. --- include/osgTerrain/DataSet | 4 ++++ src/osgTerrain/DataSet.cpp | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/osgTerrain/DataSet b/include/osgTerrain/DataSet index 5916722d0..e1b7991d3 100644 --- a/include/osgTerrain/DataSet +++ b/include/osgTerrain/DataSet @@ -853,6 +853,9 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced void setVerticalScale(float verticalScale) { _verticalScale = verticalScale; } float getVerticalScale() const { return _verticalScale; } + void setSkirtRatio(float skirtRatio) { _skirtRatio = skirtRatio; } + float getSkirtRatio() const { return _skirtRatio; } + void setDefaultColor(const osg::Vec4& defaultColor) { _defaultColor = defaultColor; } const osg::Vec4& getDefaultColor() const { return _defaultColor; } @@ -960,6 +963,7 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced float _maximumVisiableDistanceOfTopLevel; float _radiusToMaxVisibleDistanceRatio; float _verticalScale; + float _skirtRatio; osg::ref_ptr _destinationCoordinateSystem; osg::ref_ptr _intermediateCoordinateSystem; diff --git a/src/osgTerrain/DataSet.cpp b/src/osgTerrain/DataSet.cpp index 7267bc907..de3668ce4 100644 --- a/src/osgTerrain/DataSet.cpp +++ b/src/osgTerrain/DataSet.cpp @@ -2014,7 +2014,7 @@ osg::Node* DataSet::DestinationTile::createPolygonal() osg::ref_ptr n = new osg::Vec3Array(numVertices); // must use ref_ptr so the array isn't removed when smooothvisitor is used - float skirtRatio = 0.01f; + float skirtRatio = _dataSet->getSkirtRatio(); osg::Matrixd localToWorld; osg::Matrixd worldToLocal; osg::Vec3 skirtVector(0.0f,0.0f,0.0f); @@ -2338,6 +2338,14 @@ osg::Node* DataSet::DestinationTile::createPolygonal() geometry->setColorArray(colours); geometry->setColorBinding(osg::Geometry::BIND_OVERALL); } + + + osg::Geode* geode = new osg::Geode; + geode->addDrawable(geometry); + +#if 1 + osgDB::writeNodeFile(*geode,"NodeBeforeSimplification.osg"); +#endif unsigned int targetMaxNumVertices = 2048; float sample_ratio = (numVertices <= targetMaxNumVertices) ? 1.0f : (float)targetMaxNumVertices/(float)numVertices; @@ -2352,8 +2360,6 @@ osg::Node* DataSet::DestinationTile::createPolygonal() tsv.stripify(*geometry); - osg::Geode* geode = new osg::Geode; - geode->addDrawable(geometry); if (useLocalToTileTransform) { @@ -2800,6 +2806,7 @@ DataSet::DataSet() _radiusToMaxVisibleDistanceRatio = 7.0f; _verticalScale = 1.0f; + _skirtRatio = 0.02f; _convertFromGeographicToGeocentric = false;