From Brad Christiansen and Robert Osfield, "I have added the new function as suggested. The change was made against trunk from an hour or so ago. I haven't tested the performance yet (and probably won't get a chance till next week) but I have checked my terrains still work. I defaulted the equalization to off as I thought this was best until we can look into why there is the performance hit.
", note from Robert, tweaked the names and enabled the code path.
This commit is contained in:
parent
5da431a9a6
commit
526b39060c
@ -49,6 +49,14 @@ class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode
|
||||
/** Get the vertical scale hint.*/
|
||||
float getVerticalScale() const { return _verticalScale; }
|
||||
|
||||
/** If set to true the boundaries between adjacent tiles should be equalized.
|
||||
* Note, it is only possible to equalizae boundaries when the TerrainTile's contain properly assigned TileID's,
|
||||
* databases built with VirtualPlanetBuilder-0.9.11 and older do not set the TileID, so databases must be
|
||||
* built with later versions of VirtualPlanetBuilder to take advatange of boundary equalization. */
|
||||
void setEqualizeBoundaries(bool equalizeBoundaries);
|
||||
|
||||
/** If true the boundaries between adjacent tiles will be equalized. */
|
||||
bool getEqualizeBoundaries() const { return _equalizeBoundaries; }
|
||||
|
||||
/** Set the default policy to use when deciding whether to enable/disable blending and use of transparent bin.
|
||||
* Note, the Terrain::BlendingPolicy value only sets the value for the TerrainTiles it encloses for the
|
||||
@ -95,6 +103,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode
|
||||
float _sampleRatio;
|
||||
float _verticalScale;
|
||||
TerrainTile::BlendingPolicy _blendingPolicy;
|
||||
bool _equalizeBoundaries;
|
||||
|
||||
mutable OpenThreads::Mutex _mutex;
|
||||
TerrainTileSet _terrainTileSet;
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
using namespace osgTerrain;
|
||||
|
||||
#define NEW_COORD_CODE
|
||||
|
||||
GeometryTechnique::GeometryTechnique()
|
||||
{
|
||||
setFilterBias(0);
|
||||
@ -880,8 +878,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca
|
||||
//
|
||||
VNG.populateCenter(elevationLayer, layerToTexCoordMap);
|
||||
|
||||
#if 1
|
||||
if (terrain)
|
||||
if (terrain && terrain->getEqualizeBoundaries())
|
||||
{
|
||||
TileID tileID = _terrainTile->getTileID();
|
||||
|
||||
@ -997,7 +994,6 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Vec3Array> skirtVectors = new osg::Vec3Array((*VNG._normals));
|
||||
|
@ -25,7 +25,8 @@ using namespace osgTerrain;
|
||||
Terrain::Terrain():
|
||||
_sampleRatio(1.0),
|
||||
_verticalScale(1.0),
|
||||
_blendingPolicy(TerrainTile::INHERIT)
|
||||
_blendingPolicy(TerrainTile::INHERIT),
|
||||
_equalizeBoundaries(false)
|
||||
{
|
||||
setNumChildrenRequiringUpdateTraversal(1);
|
||||
_terrainTechnique = new GeometryTechnique;
|
||||
@ -36,6 +37,7 @@ Terrain::Terrain(const Terrain& ts, const osg::CopyOp& copyop):
|
||||
_sampleRatio(ts._sampleRatio),
|
||||
_verticalScale(ts._verticalScale),
|
||||
_blendingPolicy(ts._blendingPolicy),
|
||||
_equalizeBoundaries(ts._equalizeBoundaries),
|
||||
_terrainTechnique(ts._terrainTechnique)
|
||||
{
|
||||
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
|
||||
@ -71,6 +73,13 @@ void Terrain::setVerticalScale(float scale)
|
||||
dirtyRegisteredTiles();
|
||||
}
|
||||
|
||||
void Terrain::setEqualizeBoundaries(bool equalizeBoundaries)
|
||||
{
|
||||
if(_equalizeBoundaries == equalizeBoundaries) return;
|
||||
_equalizeBoundaries = equalizeBoundaries;
|
||||
dirtyRegisteredTiles();
|
||||
}
|
||||
|
||||
void Terrain::setBlendingPolicy(TerrainTile::BlendingPolicy policy)
|
||||
{
|
||||
if (_blendingPolicy == policy) return;
|
||||
|
Loading…
Reference in New Issue
Block a user