本文整理汇总了C++中osg::NodeVisitor::validNodeMask方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVisitor::validNodeMask方法的具体用法?C++ NodeVisitor::validNodeMask怎么用?C++ NodeVisitor::validNodeMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeVisitor
的用法示例。
在下文中一共展示了NodeVisitor::validNodeMask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accept
void RigGeometry::accept(osg::NodeVisitor &nv)
{
if (!nv.validNodeMask(*this))
return;
nv.pushOntoNodePath(this);
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
cull(&nv);
else if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
updateBounds(&nv);
else
nv.apply(*this);
nv.popFromNodePath();
}
示例2:
void
PointDrawable::accept(osg::NodeVisitor& nv)
{
if (nv.validNodeMask(*this))
{
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
nv.pushOntoNodePath(this);
// inject our shared stateset into the cull visitor.
if (cv)
cv->pushStateSet(_sharedStateSet.get());
nv.apply(*this);
if (cv)
cv->popStateSet();
nv.popFromNodePath();
}
}
示例3: toScreen
void
PixelAutoTransform::accept( osg::NodeVisitor& nv )
{
// optimization - don't bother with mathing if the node is hidden.
// (this occurs in Node::accept, which we override here)
if ( !nv.validNodeMask(*this) )
return;
bool resetLodScale = false;
double oldLodScale = 1.0;
if ( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR )
{
// re-activate culling now that the first cull traversal has taken place.
this->setCullingActive( true );
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);
if ( cv )
{
osg::Viewport::value_type width = _previousWidth;
osg::Viewport::value_type height = _previousHeight;
osg::Viewport* viewport = cv->getViewport();
if (viewport)
{
width = viewport->width();
height = viewport->height();
}
osg::Vec3d eyePoint = cv->getEyeLocal();
osg::Vec3d localUp = cv->getUpLocal();
osg::Vec3d position = getPosition();
const osg::Matrix& projection = *(cv->getProjectionMatrix());
bool doUpdate = _firstTimeToInitEyePoint || _dirty;
if ( !_firstTimeToInitEyePoint )
{
osg::Vec3d dv = _previousEyePoint - eyePoint;
if (dv.length2() > getAutoUpdateEyeMovementTolerance() * (eyePoint-getPosition()).length2())
{
doUpdate = true;
}
else
{
osg::Vec3d dupv = _previousLocalUp - localUp;
// rotating the camera only affects ROTATE_TO_*
if ((_autoRotateMode && dupv.length2() > getAutoUpdateEyeMovementTolerance()) ||
(width != _previousWidth || height != _previousHeight) ||
(projection != _previousProjection) ||
(position != _previousPosition) )
{
doUpdate = true;
}
}
}
_firstTimeToInitEyePoint = false;
if ( doUpdate )
{
if ( getAutoScaleToScreen() )
{
double radius =
_sizingNode.valid() ? _sizingNode->getBound().radius() :
getNumChildren() > 0 ? getChild(0)->getBound().radius() :
0.48;
double pixels = cv->pixelSize( getPosition(), radius );
double scaledMinPixels = _minPixels * _minimumScale;
double scale = pixels < scaledMinPixels ? scaledMinPixels / pixels : 1.0;
//OE_DEBUG << LC << "Pixels = " << pixels << ", minPix = " << _minPixels << ", scale = " << scale << std::endl;
setScale( scale );
}
_previousEyePoint = eyePoint;
_previousLocalUp = localUp;
_previousWidth = width;
_previousHeight = height;
_previousProjection = projection;
_previousPosition = position;
_matrixDirty = true;
}
if (_rotateInScreenSpace==true)
{
osg::Vec3d translation, scale;
osg::Quat rotation, so;
osg::RefMatrix& mvm = *(cv->getModelViewMatrix());
mvm.decompose( translation, rotation, scale, so );
// this will rotate the object into screen space.
osg::Quat toScreen( rotation.inverse() );
// we need to compensate for the "heading" of the camera, so compute that.
// From (http://goo.gl/9bjM4t).
//.........这里部分代码省略.........