本文整理汇总了C++中osg::observer_ptr::lock方法的典型用法代码示例。如果您正苦于以下问题:C++ observer_ptr::lock方法的具体用法?C++ observer_ptr::lock怎么用?C++ observer_ptr::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::observer_ptr
的用法示例。
在下文中一共展示了observer_ptr::lock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timerEvent
void HeartBeat::timerEvent( QTimerEvent */*event*/ )
{
osg::ref_ptr< osgViewer::ViewerBase > viewer;
if( !_viewer.lock( viewer ) )
{
// viewer has been deleted -> stop timer
stopTimer();
return;
}
// limit the frame rate
if( viewer->getRunMaxFrameRate() > 0.0)
{
double dt = _lastFrameStartTime.time_s();
double minFrameTime = 1.0 / viewer->getRunMaxFrameRate();
if (dt < minFrameTime)
OpenThreads::Thread::microSleep(static_cast<unsigned int>(1000000.0*(minFrameTime-dt)));
}
else
{
// avoid excessive CPU loading when no frame is required in ON_DEMAND mode
if( viewer->getRunFrameScheme() == osgViewer::ViewerBase::ON_DEMAND )
{
double dt = _lastFrameStartTime.time_s();
if (dt < 0.01)
OpenThreads::Thread::microSleep(static_cast<unsigned int>(1000000.0*(0.01-dt)));
}
// record start frame time
_lastFrameStartTime.setStartTick();
// make frame
if( viewer->getRunFrameScheme() == osgViewer::ViewerBase::ON_DEMAND )
{
if( viewer->checkNeedToDoFrame() )
{
viewer->frame();
}
}
else
{
viewer->frame();
}
}
}
示例2: apply
void apply(Environment& env, Ocean& ocean)
{
if (chop.isSet())
{
ocean.SetChoppiness(chop.get());
chop.clear();
}
if (seaState.isSet())
{
env.SimulateSeaState(seaState.get(), 0.0);
seaState.clear();
}
osg::ref_ptr<TritonLayer> layer;
if (alpha.isSet() && tritonLayer.lock(layer))
{
layer->setOpacity(alpha.value());
alpha.clear();
}
}
示例3: onMapModelChanged
void onMapModelChanged( const MapModelChange& change )
{
osg::ref_ptr<TerrainEngineNode> safeNode;
if (_node.lock(safeNode))
safeNode->onMapModelChanged( change );
}
示例4: onMapInfoEstablished
void onMapInfoEstablished( const MapInfo& mapInfo )
{
osg::ref_ptr<TerrainEngineNode> safeNode;
if (_node.lock(safeNode))
safeNode->onMapInfoEstablished( mapInfo );
}