Show
Ignore:
Timestamp:
01/31/10 13:55:29 (3 years ago)
Author:
robert
Message:

From Jan Peciva, "I am sending improved version of Inventor plugin. Attaching just
modified files, while GroupSoLOD.h and .cpp was deleted. Please, delete
it from repository, it is not used any longer and I doubt if it is
probably not used for anything meaningful for a while. In the new code,
there is no GroupSoLOD. Please, delete it.

I am using new plugin version for about 1.5 month so I consider it
stable by myself.

List of changes:
- rewritten Inventor state stack
- shaders support
- light attenuation support
- support for reading from stream (readNode(std::istream& fin, options))
- improved grouping node handling (SoSeparator?, SoGroup?,...)
- fixed transformation bug when two SoShapes/Drawables? with different transformations are placed bellow one grouping node
- introduced preprocessing to handle more advanced usage schemes of SoLOD and SoSwitch? nodes
- unused code clean up
- improved notify messages
- animation callbacks fixes
- FindInventor?.cmake improved finding routines, support for Coin3 and Coin4"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/Inventor/PendulumCallback.cpp

    r6051 r11032  
    33#include "PendulumCallback.h" 
    44 
    5 PendulumCallback::PendulumCallback(const osg::Vec3& axis,  
     5PendulumCallback::PendulumCallback(const osg::Vec3& axis, 
    66                                         float startAngle, float endAngle, 
    77                                         float frequency) 
     
    1111    _endAngle = endAngle; 
    1212    _frequency = frequency; 
    13      
     13 
    1414    _previousTraversalNumber = -1; 
    1515    _previousTime = -1.0; 
     
    2727 
    2828    const osg::FrameStamp* fs = nv->getFrameStamp(); 
    29     if (!fs)  
    30         return;  
    31      
     29    if (!fs) 
     30        return; 
     31 
    3232    // ensure that we do not operate on this node more than 
    3333    // once during this traversal.  This is an issue since node 
     
    3636    { 
    3737        double currentTime = fs->getSimulationTime(); 
     38        if (_previousTime == -1.) 
     39            _previousTime = currentTime; 
    3840        _angle += (currentTime - _previousTime) * 2 * osg::PI * _frequency; 
    39          
    40         double frac = 0.5 + 0.5 * sin(_angle); 
    41         double rotAngle = _endAngle  - _startAngle - osg::PI  
     41 
     42        double frac = 0.5 - 0.5 * cos(_angle); 
     43        double rotAngle = //_endAngle  - _startAngle - osg::PI 
    4244                + (1.0 - frac) * _startAngle + frac * _endAngle; 
    4345 
    4446        // update the specified transform 
    4547        transform->setMatrix(osg::Matrix::rotate(rotAngle, _axis)); 
    46              
     48 
    4749        _previousTraversalNumber = nv->getTraversalNumber(); 
    4850        _previousTime = currentTime; 
     
    5355 
    5456} 
     57