Changeset 3295

Show
Ignore:
Timestamp:
08/17/04 09:58:32 (10 years ago)
Author:
robert
Message:

From David Fries, "I added code to also check the local up vector, but
only if one of the rotation modes is selected, because autoscale isn't
affected by the camera rotations. "

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/AutoTransform

    r3245 r3295  
    120120        mutable bool        _firstTimeToInitEyePoint; 
    121121        mutable osg::Vec3   _previousEyePoint; 
     122        mutable osg::Vec3   _previousLocalUp; 
    122123        mutable int         _previousWidth; 
    123124        mutable int         _previousHeight;         
     
    130131        mutable bool        _matrixDirty; 
    131132        mutable osg::Matrix _cachedMatrix; 
    132          
    133         
    134          
    135133}; 
    136134 
  • OpenSceneGraph/trunk/src/osg/AutoTransform.cpp

    r3245 r3295  
    114114 
    115115            osg::Vec3 eyePoint = cs->getEyeLocal();  
     116            osg::Vec3 localUp = cs->getUpLocal();  
    116117            osg::Vec3 position = getPosition(); 
    117118 
     
    123124                osg::Vec3 dv = _previousEyePoint-eyePoint; 
    124125                if (dv.length2()>getAutoUpdateEyeMovementTolerance()*(eyePoint-getPosition()).length2()) 
     126                { 
     127                    doUpdate = true; 
     128                } 
     129                osg::Vec3 dupv = _previousLocalUp-localUp; 
     130                // rotating the camera only affects ROTATE_TO_* 
     131                if (_autoRotateMode && 
     132                    dupv.length2()>getAutoUpdateEyeMovementTolerance()) 
    125133                { 
    126134                    doUpdate = true; 
     
    160168                    osg::Vec3 PosToEye = _position - eyePoint; 
    161169                    osg::Matrix lookto = osg::Matrix::lookAt( 
    162                         osg::Vec3(0,0,0), PosToEye, cs->getUpLocal()); 
     170                        osg::Vec3(0,0,0), PosToEye, localUp); 
    163171                    Quat q; 
    164172                    q.set(osg::Matrix::inverse(lookto)); 
     
    167175 
    168176                _previousEyePoint = eyePoint; 
     177                _previousLocalUp = localUp; 
    169178                _previousWidth = width; 
    170179                _previousHeight = height;