本文整理汇总了C++中osg::observer_ptr::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ observer_ptr::getStatus方法的具体用法?C++ observer_ptr::getStatus怎么用?C++ observer_ptr::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::observer_ptr
的用法示例。
在下文中一共展示了observer_ptr::getStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* /*nv*/)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::MOVE):
{
if(_currentImageStream.valid() && (ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_SHIFT))
{
float scalar = (ea.getXnormalized()+1) / 2.0;
_currentImageStream->seek(scalar * _currentImageStream->getLength());
}
}
break;
case(osgGA::GUIEventAdapter::RELEASE):
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
osgUtil::LineSegmentIntersector::Intersections intersections;
bool foundIntersection = view==0 ? false : view->computeIntersections(ea, intersections);
if (foundIntersection)
{
// use the nearest intersection
const osgUtil::LineSegmentIntersector::Intersection& intersection = *(intersections.begin());
osg::Drawable* drawable = intersection.drawable.get();
osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0;
if (geometry) {
osg::Texture* tex = geometry->getStateSet() ? dynamic_cast<osg::Texture*>(geometry->getStateSet()->getTextureAttribute(0, osg::StateAttribute::TEXTURE)) : NULL;
if (tex) {
osg::ImageStream* is = dynamic_cast<osg::ImageStream*>(tex->getImage(0));
if (is)
{
setColor(_currentGeometry.get(), osg::Vec4(0.7, 0.7, 0.7, 1.0));
_currentGeometry = geometry;
setColor(_currentGeometry.get(), osg::Vec4(1,1,1,1));
_currentImageStream = is;
if (is->getStatus() == osg::ImageStream::PLAYING)
{
is->pause();
}
else
{
is->play();
}
}
}
}
}
break;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (!_currentImageStream.valid())
return false;
if (ea.getKey()=='p')
{
osg::ImageStream::StreamStatus playToggle = _currentImageStream->getStatus();
if (playToggle != osg::ImageStream::PLAYING)
{
std::cout<< _currentImageStream.get() << " Play"<<std::endl;
_currentImageStream->play();
}
else
{
// playing, so pause
std::cout<< _currentImageStream.get() << " Pause"<<std::endl;
_currentImageStream->pause();
}
return true;
}
else if (ea.getKey()=='r')
{
std::cout<< _currentImageStream.get() << " Restart"<<std::endl;
_currentImageStream->rewind();
_currentImageStream->play();
return true;
}
else if (ea.getKey()=='>')
{
std::cout << _currentImageStream.get() << " Seeking"<<std::endl;
_currentImageStream->seek(_currentImageStream->getCurrentTime() + 1.0);
return true;
}
else if (ea.getKey()=='L')
{
if ( _currentImageStream->getLoopingMode() == osg::ImageStream::LOOPING)
{
std::cout<< _currentImageStream.get() << " Toggle Looping Off"<<std::endl;
_currentImageStream->setLoopingMode( osg::ImageStream::NO_LOOPING );
}
else
{
std::cout<< _currentImageStream.get() << " Toggle Looping On"<<std::endl;
//.........这里部分代码省略.........