Added s/getOverlayBaseHeight methods

This commit is contained in:
Robert Osfield 2007-05-25 16:00:38 +00:00
parent 96f0e8bd54
commit a8cae09c30
2 changed files with 15 additions and 4 deletions

View File

@ -71,6 +71,15 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group
/** Get whether the OverlayNode should update the overlay texture on every frame.*/
bool getContinuousUpdate() const { return _continuousUpdate; }
/** Set the base height that the overlay subgraph will be projected down to.
* Normally you'll set this to just below ground level, if you set it too high
* then the overlay texture can end up being clipped in certain viewing directions,
* while if its too low then there will be a limit to how close you can get to the
* terrain before pixaltion becomes an issue.*/
void setOverlayBaseHeight(double baseHeight) { _overlayBaseHeight = baseHeight; }
/** Get the base height that the overlay subgraph will be projected down to.*/
double getOverlayBaseHeight() const { return _overlayBaseHeight; }
/** Set the clear color to use when rendering the overlay subgraph.*/
void setOverlayClearColor(const osg::Vec4& color) { _overlayClearColor = _overlayClearColor; }
@ -140,6 +149,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group
osg::Vec4 _overlayClearColor;
bool _continuousUpdate;
double _overlayBaseHeight;
bool _updateCamera;
private:

View File

@ -561,6 +561,7 @@ OverlayNode::OverlayNode(OverlayTechnique technique):
_textureSizeHint(1024),
_overlayClearColor(0.0f,0.0f,0.0f,0.0f),
_continuousUpdate(false),
_overlayBaseHeight(-100.0),
_updateCamera(false)
{
setNumChildrenRequiringUpdateTraversal(1);
@ -575,7 +576,8 @@ OverlayNode::OverlayNode(const OverlayNode& copy, const osg::CopyOp& copyop):
_textureUnit(copy._textureUnit),
_textureSizeHint(copy._textureSizeHint),
_overlayClearColor(copy._overlayClearColor),
_continuousUpdate(copy._continuousUpdate)
_continuousUpdate(copy._continuousUpdate),
_overlayBaseHeight(copy._overlayBaseHeight)
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
init();
@ -1027,13 +1029,12 @@ void OverlayNode::traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVis
if (em)
{
double minHeight = -1000.0;
overlayPolytope.insertVertex(osg::Vec3d(0.0,0.0,0.0), em, minHeight);
overlayPolytope.insertVertex(osg::Vec3d(0.0,0.0,0.0), em, _overlayBaseHeight);
}
else
{
double minHeight = -1000.0;
overlayPolytope.projectDowntoBase(osg::Vec3d(0.0,0.0,1.0), minHeight);
overlayPolytope.projectDowntoBase(osg::Vec3d(0.0,0.0,1.0), _overlayBaseHeight);
}