本文整理汇总了C++中osgga::GUIActionAdapter::requestContinuousUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ GUIActionAdapter::requestContinuousUpdate方法的具体用法?C++ GUIActionAdapter::requestContinuousUpdate怎么用?C++ GUIActionAdapter::requestContinuousUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgga::GUIActionAdapter
的用法示例。
在下文中一共展示了GUIActionAdapter::requestContinuousUpdate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleMouseWheel
bool OrbitCameraManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
// TODO: increase scroll factor when eye is far away from model bounding sphere
double scroll_distance_factor = ( m_eye - m_rotate_center ).length()*0.1;
switch( sm )
{
// mouse scroll up event
case osgGA::GUIEventAdapter::SCROLL_UP:
{
// perform zoom
zoomCamera( m_wheel_zoom_factor*scroll_distance_factor );
aa.requestRedraw();
aa.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// mouse scroll down event
case osgGA::GUIEventAdapter::SCROLL_DOWN:
{
// perform zoom
zoomCamera( -m_wheel_zoom_factor*scroll_distance_factor );
aa.requestRedraw();
aa.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// unhandled mouse scrolling motion
default:
return false;
}
}
示例2: handleMouseWheel
bool TerrainZoomManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us )
{
// no zooming by intersection is choosed
if (! (_flags & 0x08))
{
setCenterByMousePointer(ea, us);
}
switch( ea.getScrollingMotion() )
{
// mouse scroll up event
case osgGA::GUIEventAdapter::SCROLL_UP:
{
// perform zoom
zoomModel( _wheelZoomFactor, true );
us.requestRedraw();
us.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// mouse scroll down event
case osgGA::GUIEventAdapter::SCROLL_DOWN:
zoomModel( -_wheelZoomFactor, true );
us.requestRedraw();
us.requestContinuousUpdate( false );
return true;
// unhandled mouse scrolling motion
default:
return false;
}
}
示例3:
bool Vwr::CameraManipulator::handleRelease(const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& us) {
if (ea.getButtonMask() == 0) {
double timeSinceLastRecordEvent = _ga_t0.valid() ? (ea.getTime()
- _ga_t0->getTime()) : DBL_MAX;
if (timeSinceLastRecordEvent > 0.02)
flushMouseEventStack();
if (isMouseMoving()) {
if (calcMovement()) {
us.requestRedraw();
us.requestContinuousUpdate(true);
_thrown = _allowThrow;
}
} else {
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement())
us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
}
} else {
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement())
us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
}
return true;
}
示例4: handleMouseRelease
bool OrbitCameraManipulator::handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if( !view ) return false;
if( ea.getButtonMask() == 0 )
{
double timeSinceLastRecordEvent = _ga_t0.valid() ? (ea.getTime() - _ga_t0->getTime()) : DBL_MAX;
if( timeSinceLastRecordEvent > 0.02 )
{
flushMouseEventStack();
}
if( isMouseMoving() )
{
if( performMovement( ea, aa ) && _allowThrow )
{
aa.requestRedraw();
aa.requestContinuousUpdate( true );
_thrown = true;
// TODO: fade out throw animation
}
return true;
}
}
if( !m_pointer_push_drag )
{
// select object
bool intersection_geometry_found = intersectSceneSelect( ea, view );
if( !intersection_geometry_found )
{
// click to background -> unselect all
if( m_system != nullptr )
{
m_system->clearSelection();
}
}
}
m_pointer_push_drag = false;
flushMouseEventStack();
addMouseEvent( ea );
if( performMovement( ea, aa ) )
{
aa.requestRedraw();
}
aa.requestContinuousUpdate( false );
_thrown = false;
return true;
}
示例5:
/*!
*
* \param ea
* Adapter udalosti.
*
* Metoda spomali pohyb na zaklade zdroja prijatej udalosti.
*
*/
bool Vwr::CameraManipulator::handleKeyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter & us)
{
switch( ea.getKey() )
{
case osgGA::GUIEventAdapter::KEY_Space:
{
flushMouseEventStack();
_thrown = false;
_distance = 1.0f;
home(ea,us);
us.requestRedraw();
us.requestContinuousUpdate(false);
stop();
break;
}
case osgGA::GUIEventAdapter::KEY_Up:
case osgGA::GUIEventAdapter::KEY_Down:
decelerateForwardRate = true;
break;
case osgGA::GUIEventAdapter::KEY_Right:
case osgGA::GUIEventAdapter::KEY_Left:
decelerateSideRate = true;
break;
case osgGA::GUIEventAdapter::KEY_Page_Up:
case osgGA::GUIEventAdapter::KEY_Page_Down:
decelerateVerticalRate = true;
break;
}
return true;
}
示例6: handleMouseWheel
bool GISManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us )
{
osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
osg::Vec3d eye, center, up;
getTransformation( eye, center, up );
double altitude = eye[2];
if ( sm == osgGA::GUIEventAdapter::SCROLL_UP ) {
altitude /= 1.41;
}
else if ( sm == osgGA::GUIEventAdapter::SCROLL_DOWN ) {
altitude *= 1.41;
}
else {
return false;
}
eye[2] = altitude;
center[2] = eye[2] - 1.0;
setTransformation( eye, center, up );
us.requestRedraw();
us.requestContinuousUpdate( isAnimating() );
return true;
}
示例7: home
void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us)
{
home(ea.getTime());
us.requestRedraw();
us.requestContinuousUpdate(false);
}
示例8: handleMouseDrag
bool OrbitCameraManipulator::handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
addMouseEvent( ea );
m_pointer_push_drag = true;
if( performMovement( ea, aa ) )
{
aa.requestRedraw();
}
aa.requestContinuousUpdate( false );
_thrown = false;
return true;
}
示例9: performAnimationMovement
bool OrbitCameraManipulator::performAnimationMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
double f = (ea.getTime() - m_animation_data->_startTime) / m_animation_data->_animationTime;
if( f >= 1. )
{
f = 1.;
m_animation_data->_isAnimating = false;
if( !_thrown )
aa.requestContinuousUpdate( false );
}
applyAnimationStep( f, m_animation_data->_phase );
m_animation_data->_phase = f;
aa.requestRedraw();
return m_animation_data->_isAnimating;
}
示例10: handleMousePush
// mouse button has been pushed down
bool OrbitCameraManipulator::handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if( !view )
{
return false;
}
m_pointer_push_drag = false;
flushMouseEventStack();
addMouseEvent( ea );
m_ga_pointer_push = &ea;
intersectSceneRotateCenter( ea, view );
int buttonMask = ea.getButtonMask();
if( buttonMask == osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON || buttonMask == (osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON | osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON) )
{
m_pan_point.set( m_pointer_intersection );
}
if( buttonMask == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON )
{
osg::Vec3d distance_intersect_eye( m_pointer_intersection - m_eye );
//double distance_eye_intersection = distance_intersect_eye.length();
// rotate the intersection cone into mouse ray direction
if( m_intersect_hit_geometry )
{
}
}
aa.requestRedraw();
aa.requestContinuousUpdate( false );
_thrown = false;
return false;
}
示例11: handle
bool AnimationPathManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us)
{
if( !valid() ) return false;
switch( ea.getEventType() )
{
case GUIEventAdapter::FRAME:
if( _isPaused )
{
handleFrame( _pauseTime );
}
else
{
handleFrame( ea.getTime() );
}
return false;
case GUIEventAdapter::KEYDOWN:
if (ea.getKey()==' ')
{
_isPaused = false;
_timeScale = 1.0;
home(ea,us);
us.requestRedraw();
us.requestContinuousUpdate(false);
return true;
}
else if (ea.getKey()=='>')
{
double time = _isPaused ? _pauseTime : ea.getTime();
double animationTime = (time+_timeOffset)*_timeScale;
_timeScale *= 1.1;
osg::notify(osg::NOTICE)<<"Animation speed = "<<_timeScale*100<<"%"<<std::endl;
// adjust timeOffset so the current animationTime does change.
_timeOffset = animationTime/_timeScale - time;
return true;
}
else if (ea.getKey()=='<')
{
double time = _isPaused ? _pauseTime : ea.getTime();
double animationTime = (time+_timeOffset)*_timeScale;
_timeScale /= 1.1;
osg::notify(osg::NOTICE)<<"Animation speed = "<<_timeScale*100<<"%"<<std::endl;
// adjust timeOffset so the current animationTime does change.
_timeOffset = animationTime/_timeScale - time;
return true;
}
else if(ea.getKey() == 'p')
{
if( _isPaused )
{
_isPaused = false;
_timeOffset -= ea.getTime() - _pauseTime;
}
else
{
_isPaused = true;
_pauseTime = ea.getTime();
}
us.requestRedraw();
us.requestContinuousUpdate(false);
return true;
}
break;
default:
break;
}
return false;
}