Changeset 11291
- Timestamp:
- 03/25/10 18:50:29 (3 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 6 modified
-
include/osgAnimation/Animation (modified) (5 diffs)
-
include/osgAnimation/Channel (modified) (5 diffs)
-
include/osgAnimation/Keyframe (modified) (2 diffs)
-
include/osgAnimation/Sampler (modified) (4 diffs)
-
include/osgAnimation/Target (modified) (1 diff)
-
src/osgAnimation/Animation.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgAnimation/Animation
r10556 r11291 13 13 */ 14 14 15 #ifndef OSGANIMATION_ANIMATION _H16 #define OSGANIMATION_ANIMATION _H15 #ifndef OSGANIMATION_ANIMATION 16 #define OSGANIMATION_ANIMATION 1 17 17 18 18 #include <osg/Object> … … 66 66 void computeDuration(); 67 67 68 floatgetDuration() const;68 double getDuration() const; 69 69 70 70 … … 72 72 float getWeight() const; 73 73 74 bool update ( floattime, int priority = 0);74 bool update (double time, int priority = 0); 75 75 void resetTargets(); 76 76 … … 78 78 PlayMode getPlayMode() const { return _playmode; } 79 79 80 void setStartTime( floattime) { _startTime = time;}81 floatgetStartTime() const { return _startTime;}80 void setStartTime(double time) { _startTime = time;} 81 double getStartTime() const { return _startTime;} 82 82 83 83 protected: … … 90 90 double _originalDuration; 91 91 float _weight; 92 float_startTime;92 double _startTime; 93 93 PlayMode _playmode; 94 94 ChannelList _channels; -
OpenSceneGraph/trunk/include/osgAnimation/Channel
r11009 r11291 17 17 */ 18 18 19 #ifndef OSGANIMATION_CHANNEL _H20 #define OSGANIMATION_CHANNEL _H19 #ifndef OSGANIMATION_CHANNEL 20 #define OSGANIMATION_CHANNEL 1 21 21 22 22 #include <osgAnimation/Export> … … 38 38 virtual Channel* clone() const = 0; 39 39 40 virtual void update( floattime, float weight, int priority) = 0;40 virtual void update(double time, float weight, int priority) = 0; 41 41 virtual void reset() = 0; 42 42 virtual Target* getTarget() = 0; … … 46 46 void setName(const std::string& name); 47 47 48 virtual floatgetStartTime() const = 0;49 virtual floatgetEndTime() const = 0;48 virtual double getStartTime() const = 0; 49 virtual double getEndTime() const = 0; 50 50 51 51 const std::string& getTargetName() const; … … 114 114 115 115 virtual ~TemplateChannel() {} 116 virtual void update( floattime, float weight, int priority)116 virtual void update(double time, float weight, int priority) 117 117 { 118 118 // skip if weight == 0 … … 149 149 void setTarget(TargetType* target) { _target = target; } 150 150 151 virtual floatgetStartTime() const { return _sampler->getStartTime(); }152 virtual floatgetEndTime() const { return _sampler->getEndTime(); }151 virtual double getStartTime() const { return _sampler->getStartTime(); } 152 virtual double getEndTime() const { return _sampler->getEndTime(); } 153 153 154 154 protected: -
OpenSceneGraph/trunk/include/osgAnimation/Keyframe
r11009 r11291 32 32 { 33 33 public: 34 floatgetTime() const { return _time; }35 void setTime( floattime) { _time = time; }34 double getTime() const { return _time; } 35 void setTime(double time) { _time = time; } 36 36 37 37 protected: 38 float_time;38 double _time; 39 39 40 40 }; … … 49 49 ~TemplateKeyframe () {} 50 50 51 TemplateKeyframe ( floattime, const T& value)51 TemplateKeyframe (double time, const T& value) 52 52 { 53 53 _time = time; -
OpenSceneGraph/trunk/include/osgAnimation/Sampler
r11009 r11291 17 17 */ 18 18 19 #ifndef OSGANIMATION_SAMPLER _H20 #define OSGANIMATION_SAMPLER _H19 #ifndef OSGANIMATION_SAMPLER 20 #define OSGANIMATION_SAMPLER 1 21 21 22 22 #include <vector> … … 51 51 ~TemplateSampler() {} 52 52 53 void getValueAt( floattime, UsingType& result) const { _functor.getValue(*_keyframes, time, result);}53 void getValueAt(double time, UsingType& result) const { _functor.getValue(*_keyframes, time, result);} 54 54 void setKeyframeContainer(KeyframeContainerType* kf) { _keyframes = kf;} 55 55 … … 67 67 } 68 68 69 floatgetStartTime() const69 double getStartTime() const 70 70 { 71 71 if (!_keyframes) 72 return 0.0 f;72 return 0.0; 73 73 return _keyframes->front().getTime(); 74 74 } 75 75 76 floatgetEndTime() const76 double getEndTime() const 77 77 { 78 78 if (!_keyframes) 79 return 0.0 f;79 return 0.0; 80 80 return _keyframes->back().getTime(); 81 81 } … … 102 102 } 103 103 104 void getValueAt( floattime, typename VALUESAMPLERTYPE::FunctorType::UsingType& result)104 void getValueAt(double time, typename VALUESAMPLERTYPE::FunctorType::UsingType& result) 105 105 { 106 floatnewtime;106 double newtime; 107 107 _time.getValueAt(time, newtime); 108 108 _value.getValueAt(newtime, result); -
OpenSceneGraph/trunk/include/osgAnimation/Target
r11009 r11291 14 14 15 15 16 #ifndef OSGANIMATION_TARGET _H17 #define OSGANIMATION_TARGET _H16 #ifndef OSGANIMATION_TARGET 17 #define OSGANIMATION_TARGET 1 18 18 19 19 #include <vector> -
OpenSceneGraph/trunk/src/osgAnimation/Animation.cpp
r11009 r11291 81 81 } 82 82 83 floatAnimation::getDuration() const83 double Animation::getDuration() const 84 84 { 85 85 return _duration; … … 96 96 } 97 97 98 bool Animation::update ( floattime, int priority)98 bool Animation::update (double time, int priority) 99 99 { 100 100 if (!_duration) // if not initialized then do it … … 103 103 double ratio = _originalDuration / _duration; 104 104 105 floatt = (time - _startTime) * ratio;105 double t = (time - _startTime) * ratio; 106 106 switch (_playmode) 107 107 { … … 118 118 t = _startTime; 119 119 else if (t > _duration) 120 t = fmod(t, (float)_duration);120 t = fmod(t, _duration); 121 121 // std::cout << "t " << t << " duration " << _duration << std::endl; 122 122 break;
