From John Vidar Larring, "Added vertical scale as a property of osgTerrain::Terrain. Lets you configure vertical scale when initializing the terrain model. E.g:

osgTerrain::Terrain* terrain = findTopMostNodeOfType<osgTerrain::Terrain>(model.get());
  if (!terrain)
  {
      terrain = new osgTerrain::Terrain;
      terrain->addChild(model.get());
      terrain->setVerticalScale(2.0f);
      model = terrain;
  }
  viewerWindow->setSceneData(model.get());
"
This commit is contained in:
Robert Osfield
2008-05-27 13:11:47 +00:00
parent b41404546e
commit 1519d0d546
3 changed files with 45 additions and 7 deletions

View File

@@ -278,7 +278,7 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
float minHeight = 0.0;
float scaleHeight = 1.0;
float scaleHeight = _terrainTile->getTerrain() ? _terrainTile->getTerrain()->getVerticalScale() : 1.0f;
// allocate and assign tex coords
typedef std::pair< osg::ref_ptr<osg::Vec2Array>, Locator* > TexCoordLocatorPair;
@@ -341,7 +341,7 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
float value = 0.0f;
validValue = elevationLayer->getValidValue(i_equiv,j_equiv, value);
// osg::notify(osg::INFO)<<"i="<<i<<" j="<<j<<" z="<<value<<std::endl;
ndc.z() = value;
ndc.z() = value*scaleHeight;
}
if (validValue)
@@ -373,7 +373,7 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
if (elevations.valid())
{
(*elevations).push_back((ndc.z()-minHeight)*scaleHeight);
(*elevations).push_back(ndc.z());
}
// compute the local normal