Reorginized the TerrainTile/TerrainTechnique dirty mechanism so that TerrainTile
now holds the dirty flag and enables/disables event traversal in response dirty being set/unset. This allows terrain to be automatically updated in response to Terrain scale and sample ratio changes.
This commit is contained in:
@@ -57,10 +57,6 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique
|
||||
|
||||
virtual void cleanSceneGraph();
|
||||
|
||||
virtual void dirty();
|
||||
|
||||
|
||||
|
||||
void setFilterBias(float filterBias);
|
||||
float getFilterBias() const { return _filterBias; }
|
||||
|
||||
|
||||
@@ -51,20 +51,15 @@ class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
|
||||
/** Traverse the terrain subgraph.*/
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
/** Dirty so that cached data structures will be updated on next use.*/
|
||||
virtual void dirty();
|
||||
|
||||
/** Return true if cached data structures need updating.*/
|
||||
virtual bool isDirty() const { return _dirty; }
|
||||
|
||||
protected:
|
||||
|
||||
void setDirty(bool dirty);
|
||||
|
||||
virtual ~TerrainTechnique();
|
||||
|
||||
friend class osgTerrain::TerrainTile;
|
||||
|
||||
TerrainTile* _terrainTile;
|
||||
bool _dirty;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -160,6 +160,11 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
|
||||
/** Get whether the TeatBoundariesToValidDataAsDefaultValue hint.*/
|
||||
bool getTreatBoundariesToValidDataAsDefaultValue() const { return _treatBoundariesToValidDataAsDefaultValue; }
|
||||
|
||||
/** Set the dirty flag on/off.*/
|
||||
void setDirty(bool dirty);
|
||||
|
||||
/** return true if the tile is dirty and needs to be updated,*/
|
||||
bool getDirty() const { return _dirty; }
|
||||
|
||||
/** Compute the bounding volume of the terrain by computing the union of the bounding volumes of all layers.*/
|
||||
virtual osg::BoundingSphere computeBound() const;
|
||||
@@ -168,12 +173,14 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
|
||||
|
||||
virtual ~TerrainTile();
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<Layer> > Layers;
|
||||
|
||||
friend class Terrain;
|
||||
|
||||
Terrain* _terrain;
|
||||
|
||||
|
||||
bool _dirty;
|
||||
bool _hasBeenTraversal;
|
||||
|
||||
TileID _tileID;
|
||||
|
||||
Reference in New Issue
Block a user