Added BlendingPolicy support into osgTerrain::Terrain.

This commit is contained in:
Robert Osfield
2010-03-16 18:43:59 +00:00
parent 1537af6235
commit c4e82f0221
5 changed files with 48 additions and 10 deletions

View File

@@ -39,7 +39,8 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
/** Set the sample ratio hint that TerrainTile should use when building geometry.
* Defaults to 1.0, which means use all original sample points.*/
void setSampleRatio(float ratio)
{
{
if (_sampleRatio == ratio) return;
_sampleRatio = ratio;
dirtyRegisteredTiles();
}
@@ -50,14 +51,31 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
/** Set the vertical scale hint.*/
void setVerticalScale(float scale)
{
{
if (_verticalScale == scale) return;
_verticalScale = scale;
dirtyRegisteredTiles();
}
/** Get the vertical scale hint.*/
float getVerticalScale() const { return _verticalScale; }
/** 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
* TerrainTile's that have their policy set to INHERIT. INHERIT is the default BlendingPolicy for both
* Terrain and TerrainTile, and if both are left to INERHIT then the policy used is ENABLE_BLENDING_WHEN_ALPHA_PRESENT. */
void setBlendingPolicy(TerrainTile::BlendingPolicy policy)
{
if (_blendingPolicy == policy) return;
_blendingPolicy = policy;
dirtyRegisteredTiles();
}
/** Get the default policy to use when deciding whether to enable/disable blending and use of transparent bin.*/
TerrainTile::BlendingPolicy getBlendingPolicy() const { return _blendingPolicy; }
/** Get the TerrainTile for a given TileID.*/
TerrainTile* getTile(const TileID& tileID);
@@ -89,6 +107,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
float _sampleRatio;
float _verticalScale;
TerrainTile::BlendingPolicy _blendingPolicy;
mutable OpenThreads::Mutex _mutex;
TerrainTileSet _terrainTileSet;

View File

@@ -159,9 +159,10 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
enum BlendingPolicy
{
INHERIT, /** Default - check for the any BlendingPolicy set on the enclosing osgTerrain::Terrain node, and if it's also INHERIT then assume ENABLE_BLENDING_WHEN_ALPHA_PRESENT. */
DO_NOT_SET_BLENDING,
ENABLE_BLENDING,
ENABLE_BLENDING_WHEN_ALPHA_PRESENT /** Default - check colour layers for alpha value and if present enable blending. */
ENABLE_BLENDING_WHEN_ALPHA_PRESENT /** check colour layers for alpha value and if present enable blending. */
};
/** Set the policy to use when deciding whether to enable/disable blending and use of transparent bin.*/