14#ifndef OSG_ANIMATIONPATH
15#define OSG_ANIMATIONPATH 1
41 _timeControlPointMap(ap._timeControlPointMap),
42 _loopMode(ap._loopMode) {}
50 _scale(1.0,1.0,1.0) {}
55 _scale(1.0,1.0,1.0) {}
60 _scale(1.0,1.0,1.0) {}
78 float one_minus_ratio = 1.0f-ratio;
81 _scale = first.
_scale*one_minus_ratio + second.
_scale*ratio;
86 double one_minus_ratio = 1.0-ratio;
89 _scale = first.
_scale*one_minus_ratio + second.
_scale*ratio;
133 if (!getInterpolatedControlPoint(time,cp))
return false;
142 if (!getInterpolatedControlPoint(time,cp))
return false;
151 if (!getInterpolatedControlPoint(time,cp))
return false;
159 if (!getInterpolatedControlPoint(time,cp))
return false;
170 double getFirstTime()
const {
if (!_timeControlPointMap.empty())
return _timeControlPointMap.begin()->first;
else return 0.0;}
171 double getLastTime()
const {
if (!_timeControlPointMap.empty())
return _timeControlPointMap.rbegin()->first;
else return 0.0;}
172 double getPeriod()
const {
return getLastTime()-getFirstTime();}
194 bool empty()
const {
return _timeControlPointMap.empty(); }
196 void clear() { _timeControlPointMap.clear(); }
202 void write(std::ostream& out)
const;
205 void write(TimeControlPointMap::const_iterator itr, std::ostream& out)
const;
222 _pivotPoint(0.0,0.0,0.0),
223 _useInverseMatrix(false),
225 _timeMultiplier(1.0),
235 _animationPath(apc._animationPath),
236 _pivotPoint(apc._pivotPoint),
237 _useInverseMatrix(apc._useInverseMatrix),
238 _timeOffset(apc._timeOffset),
239 _timeMultiplier(apc._timeMultiplier),
240 _firstTime(apc._firstTime),
241 _latestTime(apc._latestTime),
243 _pauseTime(apc._pauseTime) {}
251 _pivotPoint(0.0,0.0,0.0),
252 _useInverseMatrix(false),
253 _timeOffset(timeOffset),
254 _timeMultiplier(timeMultiplier),
Definition AnimationPath:218
bool getUseInverseMatrix() const
Definition AnimationPath:272
void setPause(bool pause)
double _pauseTime
Definition AnimationPath:306
AnimationPath * getAnimationPath()
Definition AnimationPath:265
AnimationPathCallback()
Definition AnimationPath:221
double _latestTime
Definition AnimationPath:304
const AnimationPath * getAnimationPath() const
Definition AnimationPath:266
virtual double getAnimationTime() const
double _timeOffset
Definition AnimationPath:301
ref_ptr< AnimationPath > _animationPath
Definition AnimationPath:298
osg::Vec3d _pivotPoint
Definition AnimationPath:299
void setTimeOffset(double offset)
Definition AnimationPath:274
void setPivotPoint(const Vec3d &pivot)
Definition AnimationPath:268
AnimationPathCallback(const osg::Vec3d &pivot, const osg::Vec3d &axis, float angularVelocity)
bool getPause() const
Definition AnimationPath:284
bool _useInverseMatrix
Definition AnimationPath:300
void setAnimationPath(AnimationPath *path)
Definition AnimationPath:264
bool _pause
Definition AnimationPath:305
double getTimeMultiplier() const
Definition AnimationPath:278
AnimationPathCallback(AnimationPath *ap, double timeOffset=0.0, double timeMultiplier=1.0)
Definition AnimationPath:249
~AnimationPathCallback()
Definition AnimationPath:310
virtual void operator()(Node *node, NodeVisitor *nv)
double getTimeOffset() const
Definition AnimationPath:275
void update(osg::Node &node)
void setUseInverseMatrix(bool useInverseMatrix)
Definition AnimationPath:271
META_Object(osg, AnimationPathCallback)
double _firstTime
Definition AnimationPath:303
AnimationPathCallback(const AnimationPathCallback &apc, const CopyOp ©op)
Definition AnimationPath:231
const Vec3d & getPivotPoint() const
Definition AnimationPath:269
double _timeMultiplier
Definition AnimationPath:302
void setTimeMultiplier(double multiplier)
Definition AnimationPath:277
Definition AnimationPath:47
osg::Quat _rotation
Definition AnimationPath:123
osg::Vec3d _position
Definition AnimationPath:122
void interpolate(double ratio, const ControlPoint &first, const ControlPoint &second)
Definition AnimationPath:84
const osg::Vec3d & getScale() const
Definition AnimationPath:74
const osg::Vec3d & getPosition() const
Definition AnimationPath:68
ControlPoint(const osg::Vec3d &position, const osg::Quat &rotation)
Definition AnimationPath:57
osg::Vec3d _scale
Definition AnimationPath:124
void interpolate(float ratio, const ControlPoint &first, const ControlPoint &second)
Definition AnimationPath:76
void getInverse(Matrixf &matrix) const
Definition AnimationPath:106
void setRotation(const osg::Quat &rotation)
Definition AnimationPath:70
void getMatrix(Matrixf &matrix) const
Definition AnimationPath:92
void getInverse(Matrixd &matrix) const
Definition AnimationPath:113
void setScale(const osg::Vec3d &scale)
Definition AnimationPath:73
ControlPoint(const osg::Vec3d &position, const osg::Quat &rotation, const osg::Vec3d &scale)
Definition AnimationPath:62
ControlPoint()
Definition AnimationPath:49
const osg::Quat & getRotation() const
Definition AnimationPath:71
ControlPoint(const osg::Vec3d &position)
Definition AnimationPath:52
void getMatrix(Matrixd &matrix) const
Definition AnimationPath:99
void setPosition(const osg::Vec3d &position)
Definition AnimationPath:67
Definition AnimationPath:34
bool empty() const
Definition AnimationPath:194
virtual bool getInterpolatedControlPoint(double time, ControlPoint &controlPoint) const
META_Object(osg, AnimationPath)
TimeControlPointMap _timeControlPointMap
Definition AnimationPath:211
void write(std::ostream &out) const
std::map< double, ControlPoint > TimeControlPointMap
Definition AnimationPath:186
bool getMatrix(double time, Matrixf &matrix) const
Definition AnimationPath:130
bool getInverse(double time, Matrixf &matrix) const
Definition AnimationPath:148
AnimationPath()
Definition AnimationPath:37
void setTimeControlPointMap(TimeControlPointMap &tcpm)
Definition AnimationPath:188
void clear()
Definition AnimationPath:196
const TimeControlPointMap & getTimeControlPointMap() const
Definition AnimationPath:192
void insert(double time, const ControlPoint &controlPoint)
bool getInverse(double time, Matrixd &matrix) const
Definition AnimationPath:156
void setLoopMode(LoopMode lm)
Definition AnimationPath:181
bool getMatrix(double time, Matrixd &matrix) const
Definition AnimationPath:139
void read(std::istream &in)
LoopMode getLoopMode() const
Definition AnimationPath:183
LoopMode _loopMode
Definition AnimationPath:212
LoopMode
Definition AnimationPath:175
@ SWING
Definition AnimationPath:176
@ LOOP
Definition AnimationPath:177
TimeControlPointMap & getTimeControlPointMap()
Definition AnimationPath:190
void write(TimeControlPointMap::const_iterator itr, std::ostream &out) const
virtual ~AnimationPath()
Definition AnimationPath:209
AnimationPath(const AnimationPath &ap, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition AnimationPath:39
double getPeriod() const
Definition AnimationPath:172
double getFirstTime() const
Definition AnimationPath:170
double getLastTime() const
Definition AnimationPath:171
void preMultScale(const Vec3d &v)
Definition Matrixd:747
void postMultScale(const Vec3d &v)
Definition Matrixd:761
void preMultTranslate(const Vec3d &v)
Definition Matrixd:691
void postMultTranslate(const Vec3d &v)
Definition Matrixd:719
void makeRotate(const Vec3f &from, const Vec3f &to)
void postMultTranslate(const Vec3d &v)
Definition Matrixf:823
void preMultScale(const Vec3d &v)
Definition Matrixf:851
void preMultTranslate(const Vec3d &v)
Definition Matrixf:795
void makeRotate(const Vec3f &from, const Vec3f &to)
void postMultScale(const Vec3d &v)
Definition Matrixf:865
Definition NodeVisitor:82
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39