osgEarth 2.1.1
|
Classes | |
struct | PerViewData |
Public Member Functions | |
ControlNode (Control *control, float priority=0.0f) | |
Control * | getControl () const |
float | getPriority () const |
optional< osg::Vec2f > & | anchorPoint () |
const optional< osg::Vec2f > & | anchorPoint () const |
virtual void | traverse (osg::NodeVisitor &nv) |
virtual osg::BoundingSphere | computeBound () const |
Protected Types | |
typedef std::map< osg::View *, PerViewData > | PerViewDataMap |
Protected Member Functions | |
PerViewData & | getData (osg::View *view) |
Protected Attributes | |
PerViewDataMap | _perViewData |
osg::ref_ptr< Control > | _control |
float | _priority |
optional< osg::Vec2f > | _anchor |
Friends | |
class | ControlNodeBin |
A control wrapped in a node that you can place anywhere in the scene graph. Its scene location will control its 2D screen position, and it can participate in conflict resolution.
typedef std::map<osg::View*,PerViewData> osgEarth::Util::Controls::ControlNode::PerViewDataMap [protected] |
ControlNode::ControlNode | ( | Control * | control, |
float | priority = 0.0f |
||
) |
Constructs a new control node with an embedded control.
Definition at line 1809 of file Controls.cpp.
optional<osg::Vec2f>& osgEarth::Util::Controls::ControlNode::anchorPoint | ( | ) | [inline] |
const optional<osg::Vec2f>& osgEarth::Util::Controls::ControlNode::anchorPoint | ( | ) | const [inline] |
osg::BoundingSphere ControlNode::computeBound | ( | ) | const [virtual] |
Definition at line 1817 of file Controls.cpp.
{
return osg::BoundingSphere( osg::Vec3(0,0,0), 0.5 );
}
Control* osgEarth::Util::Controls::ControlNode::getControl | ( | ) | const [inline] |
PerViewData& osgEarth::Util::Controls::ControlNode::getData | ( | osg::View * | view | ) | [inline, protected] |
Definition at line 613 of file Controls.
{ return _perViewData[view]; }
float osgEarth::Util::Controls::ControlNode::getPriority | ( | ) | const [inline] |
void ControlNode::traverse | ( | osg::NodeVisitor & | nv | ) | [virtual] |
Definition at line 1823 of file Controls.cpp.
{ if ( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR ) { static osg::Vec3d s_zero(0,0,0); static osg::Vec4d s_zero_w(0,0,0,1); osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>( &nv ); //setCullingActive( true ); //cv->setSmallFeatureCullingPixelSize(0); // pull up the per-view data for this view: PerViewData& data = _perViewData[cv->getCurrentCamera()->getView()]; // if it's uninitialized, find the corresponding control canvas and // cache a reference to its control node bin: if ( !data._canvas.valid() ) { data._canvas = ControlCanvas::get( cv->getCurrentCamera()->getView(), true ); if ( data._canvas.valid() ) { ControlNodeBin* bin = static_cast<ControlCanvas*>(data._canvas.get())->getControlNodeBin(); bin->addNode( this ); } } if ( data._canvas.valid() ) { // calculate its screen position: //data._screenPos = s_zero * (*cv->getMVPW()); osg::Vec4d clip = s_zero_w * (*cv->getModelViewMatrix()) * (*cv->getProjectionMatrix()); osg::Vec3d clip_ndc( clip.x()/clip.w(), clip.y()/clip.w(), clip.z()/clip.w() ); data._screenPos = clip_ndc * cv->getWindowMatrix(); if ( clip_ndc.z() > 1.0 ) // node is behind the near clip plane { data._obscured = true; } else if ( data._obscured == true ) { data._obscured = false; data._visibleTime = cv->getFrameStamp()->getReferenceTime(); } } data._visitFrame = cv->getFrameStamp()->getFrameNumber(); } // ControlNode has no children, so no point in calling traverse. osg::Node::traverse(nv); }
friend class ControlNodeBin [friend] |
optional<osg::Vec2f> osgEarth::Util::Controls::ControlNode::_anchor [protected] |
osg::ref_ptr<Control> osgEarth::Util::Controls::ControlNode::_control [protected] |
float osgEarth::Util::Controls::ControlNode::_priority [protected] |