Changeset 10419
- Timestamp:
- 06/25/09 20:11:29 (4 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 2 modified
-
include/osgGA/TrackballManipulator (modified) (1 diff)
-
src/osgGA/TrackballManipulator.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgGA/TrackballManipulator
r10002 r10419 150 150 bool _thrown; 151 151 152 153 /** Indicates whether "thrown" display should match rate of motion at time of throw. 154 * This is significant on systems where the delta between mouse events can be radically different 155 * from the delta in display update events. 156 */ 157 bool _rate_sensitive; 158 159 /** The approximate amount of time it is currently taking to draw a frame. 160 * This is used to compute the delta in translation/rotation during a thrown display update. 161 * It allows us to match an delta in position/rotation independent of the rendering frame rate. 162 */ 163 double _delta_frame_time; 164 165 /** The time the last frame started. 166 * Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate. 167 */ 168 double _last_frame_time; 169 152 170 osg::Vec3d _center; 153 171 osg::Quat _rotation; -
OpenSceneGraph/trunk/src/osgGA/TrackballManipulator.cpp
r10209 r10419 13 13 _allowThrow = true; 14 14 _thrown = false; 15 _rate_sensitive = true; 15 16 16 17 _distance = 1.0f; … … 82 83 { 83 84 case(GUIEventAdapter::FRAME): 85 { 86 double current_frame_time = ea.getTime(); 87 88 _delta_frame_time = current_frame_time - _last_frame_time; 89 _last_frame_time = current_frame_time; 90 84 91 if (_thrown && _allowThrow) 85 92 { … … 87 94 } 88 95 return false; 96 } 89 97 default: 90 98 break; … … 322 330 323 331 osg::Quat new_rotate; 324 new_rotate.makeRotate(angle,axis); 332 333 if (_thrown && _rate_sensitive && _ga_t0.valid() && _ga_t1.valid()) 334 { 335 // frame_time / delta_event_time 336 double rate = _delta_frame_time / (_ga_t0->getTime() - _ga_t1->getTime()); 337 new_rotate.makeRotate(angle * rate,axis); 338 } else { 339 new_rotate.makeRotate(angle,axis); 340 } 325 341 326 342 _rotation = _rotation*new_rotate; … … 339 355 osg::Matrix rotation_matrix; 340 356 rotation_matrix.makeRotate(_rotation); 357 358 if (_thrown && _rate_sensitive && _ga_t0.valid() && _ga_t1.valid()) 359 { 360 // frame_time / delta_event_time 361 double rate = _delta_frame_time / (_ga_t0->getTime() - _ga_t1->getTime()); 362 scale *= rate; 363 } 341 364 342 365 osg::Vec3 dv(dx*scale,dy*scale,0.0f);
