Added dirty count support to osgTerrain::Layer clases.

Added LayerHandler to osgterrain example that modifies the layers in 
response to pressing the 's' and 'q' keys
This commit is contained in:
Robert Osfield
2007-07-06 16:47:08 +00:00
parent c4c165099c
commit 2b84aa7760
3 changed files with 119 additions and 3 deletions

View File

@@ -141,6 +141,15 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
return false;
}
/** increment the modified count."*/
virtual void dirty() {};
/** Set the modified count value. */
virtual void setModifiedCount(unsigned int /*value*/) {};
/** Get modified count value. */
virtual unsigned int getModifiedCount() const { return 0; }
virtual osg::BoundingSphere computeBound() const;
protected:
@@ -176,6 +185,10 @@ class OSGTERRAIN_EXPORT ImageLayer : public Layer
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
virtual void dirty();
virtual void setModifiedCount(unsigned int value);
virtual unsigned int getModifiedCount() const;
protected:
virtual ~ImageLayer() {}
@@ -207,11 +220,16 @@ class OSGTERRAIN_EXPORT HeightFieldLayer : public Layer
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
virtual void dirty();
virtual void setModifiedCount(unsigned int value);
virtual unsigned int getModifiedCount() const;
protected:
virtual ~HeightFieldLayer() {}
osg::ref_ptr<osg::HeightField> _heightField;
unsigned int _modifiedCount;
osg::ref_ptr<osg::HeightField> _heightField;
};