From Jannik Heller, "I noticed the rotation in the OrbitManipulator depends on the framerate. To reproduce this issue, start the osganimate example, rotate the model with the left mouse button, then let go of the mouse button while still moving. You will notice that with V-Sync enabled, the model rotates slower.

The OrbitManipulator calculates a scale to counteract the framerate dependency, but it turns out this scale wasn't used for the rotation yet."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14743 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-03-01 11:08:51 +00:00
parent 95853370e1
commit 4c9e17fcc7
2 changed files with 10 additions and 3 deletions

View File

@@ -379,12 +379,12 @@ void OrbitManipulator::OrbitAnimationData::start( const osg::Vec3d& movement, co
Scale parameter is useful, for example, when manipulator is thrown.
It scales the amount of rotation based, for example, on the current frame time.*/
void OrbitManipulator::rotateTrackball( const float px0, const float py0,
const float px1, const float py1, const float /*scale*/ )
const float px1, const float py1, const float scale )
{
osg::Vec3d axis;
float angle;
trackball( axis, angle, px1, py1, px0, py0 );
trackball( axis, angle, px0 + (px1-px0)*scale, py0 + (py1-py0)*scale, px0, py0 );
Quat new_rotate;
new_rotate.makeRotate( angle, axis );

View File

@@ -154,6 +154,8 @@ bool StandardManipulator::isAnimating() const
/// Finishes the animation by performing a step that moves it to its final position.
void StandardManipulator::finishAnimation()
{
_thrown = false;
if( !isAnimating() )
return;
@@ -586,7 +588,12 @@ void StandardManipulator::setAllowThrow( bool allowThrow )
events that started the animation.*/
float StandardManipulator::getThrowScale( const double eventTimeDelta ) const
{
if( _thrown ) return float( _delta_frame_time / eventTimeDelta );
if( _thrown )
{
if (eventTimeDelta == 0.f)
return 0.f;
return float( _delta_frame_time / eventTimeDelta );
}
else return 1.f;
}