本文整理汇总了C++中osg::NodeVisitor::getEyePoint方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVisitor::getEyePoint方法的具体用法?C++ NodeVisitor::getEyePoint怎么用?C++ NodeVisitor::getEyePoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeVisitor
的用法示例。
在下文中一共展示了NodeVisitor::getEyePoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SilverLiningNode::traverse(osg::NodeVisitor& nv)
{
if ( _SL->ready() )
{
if ( nv.getVisitorType() == nv.UPDATE_VISITOR )
{
_SL->updateLocation();
_SL->getAtmosphere()->UpdateSkyAndClouds();
_SL->updateLight();
_skyDrawable->dirtyBound();
_cloudsDrawable->dirtyBound();
}
else if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
// TODO: make this multi-camera safe
_SL->setCameraPosition( nv.getEyePoint() );
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
_SL->getAtmosphere()->SetCameraMatrix( cv->getModelViewMatrix()->ptr() );
_SL->getAtmosphere()->SetProjectionMatrix( cv->getProjectionMatrix()->ptr() );
_SL->getAtmosphere()->CullObjects();
}
}
osgEarth::Util::EnvironmentNode::traverse( nv );
}
示例2: if
void
SilverLiningContextNode::traverse(osg::NodeVisitor& nv)
{
if ( _SL && _SL->ready() )
{
if ( nv.getVisitorType() == nv.UPDATE_VISITOR )
{
int frameNumber = nv.getFrameStamp()->getFrameNumber();
_skyDrawable->dirtyBound();
if( _cloudsDrawable )
{
if ( _lastAltitude <= *_options.cloudsMaxAltitude() )
{
if ( _cloudsDrawable->getNumParents() == 0 )
_geode->addDrawable( _cloudsDrawable.get() );
_cloudsDrawable->dirtyBound();
}
else
{
if ( _cloudsDrawable->getNumParents() > 0 )
_geode->removeDrawable( _cloudsDrawable.get() );
}
}
}
else if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
osg::Camera* camera = cv->getCurrentCamera();
if ( camera )
{
#ifndef SL_USE_CULL_MASK
//Check if this is the target camera for this context
if(getTargetCamera() == camera)
#endif
{
// TODO: make this multi-camera safe
_SL->setCameraPosition( nv.getEyePoint() );
_lastAltitude = _SL->getSRS()->isGeographic() ?
cv->getEyePoint().length() - _SL->getSRS()->getEllipsoid()->getRadiusEquator() :
cv->getEyePoint().z();
_SL->updateLocation();
_SL->updateLight();
}
}
}
}
if ( _geode.valid() )
{
_geode->accept(nv);
}
}
示例3: traverse
void Impostor::traverse(osg::NodeVisitor& nv)
{
if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR)
{
LOD::traverse(nv);
return;
}
osgUtil::CullVisitor* cv = nv.asCullVisitor();
if (!cv)
{
LOD::traverse(nv);
return;
}
osg::Vec3 eyeLocal = nv.getEyePoint();
const BoundingSphere& bs = getBound();
unsigned int contextID = cv->getState() ? cv->getState()->getContextID() : 0;
float distance2 = (eyeLocal-bs.center()).length2();
float LODScale = cv->getLODScale();
if (!cv->getImpostorsActive() ||
distance2*LODScale*LODScale<osg::square(getImpostorThreshold()) ||
distance2<bs.radius2()*2.0f)
{
// outwith the impostor distance threshold therefore simple
// traverse the appropriate child of the LOD.
LOD::traverse(nv);
}
else
{
// within the impostor distance threshold therefore attempt
// to use impostor instead.
RefMatrix& matrix = *cv->getModelViewMatrix();
// search for the best fit ImpostorSprite;
ImpostorSprite* impostorSprite = findBestImpostorSprite(contextID,eyeLocal);
if (impostorSprite)
{
// impostor found, now check to see if it is good enough to use
float error = impostorSprite->calcPixelError(*(cv->getMVPW()));
if (error>cv->getImpostorPixelErrorThreshold())
{
// chosen impostor sprite pixel error is too great to use
// from this eye point, therefore invalidate it.
impostorSprite=NULL;
}
}
// need to think about sprite reuse and support for multiple context's.
if (impostorSprite==NULL)
{
// no appropriate sprite has been found therefore need to create
// one for use
// create the impostor sprite.
impostorSprite = createImpostorSprite(cv);
//if (impostorSprite) impostorSprite->_color.set(0.0f,0.0f,1.0f,1.0f);
}
//else impostorSprite->_color.set(1.0f,1.0f,1.0f,1.0f);
if (impostorSprite)
{
// update frame number to show that impostor is in action.
impostorSprite->setLastFrameUsed(cv->getTraversalNumber());
if (cv->getComputeNearFarMode()) cv->updateCalculatedNearFar(matrix,*impostorSprite, false);
StateSet* stateset = impostorSprite->getStateSet();
if (stateset) cv->pushStateSet(stateset);
cv->addDrawableAndDepth(impostorSprite, &matrix, distance(getCenter(),matrix));
if (stateset) cv->popStateSet();
}
else
{
// no impostor has been selected or created so default to
// traversing the usual LOD selected child.
LOD::traverse(nv);
}
}
}
示例4: if
void
SilverLiningNode::traverse(osg::NodeVisitor& nv)
{
if ( _SL && _SL->ready() )
{
if ( nv.getVisitorType() == nv.UPDATE_VISITOR )
{
int frameNumber = nv.getFrameStamp()->getFrameNumber();
_skyDrawable->dirtyBound();
if( _cloudsDrawable )
{
if ( _lastAltitude <= *_options.cloudsMaxAltitude() )
{
if ( _cloudsDrawable->getNumParents() == 0 )
_geode->addDrawable( _cloudsDrawable.get() );
_cloudsDrawable->dirtyBound();
}
else
{
if ( _cloudsDrawable->getNumParents() > 0 )
_geode->removeDrawable( _cloudsDrawable.get() );
}
}
}
else if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
// TODO: make this multi-camera safe
_SL->setCameraPosition( nv.getEyePoint() );
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
_SL->getAtmosphere()->SetCameraMatrix( cv->getModelViewMatrix()->ptr() );
_SL->getAtmosphere()->SetProjectionMatrix( cv->getProjectionMatrix()->ptr() );
_lastAltitude = _SL->getSRS()->isGeographic() ?
cv->getEyePoint().length() - _SL->getSRS()->getEllipsoid()->getRadiusEquator() :
cv->getEyePoint().z();
//if (_lastAltitude <= *_options.cloudsMaxAltitude() )
{
_SL->updateLocation();
_SL->updateLight();
_SL->getAtmosphere()->UpdateSkyAndClouds();
_SL->getAtmosphere()->CullObjects();
}
}
}
osgEarth::Util::SkyNode::traverse( nv );
if ( _geode.valid() )
{
_geode->accept(nv);
}
if ( _lightSource.valid() )
{
_lightSource->accept(nv);
}
}