Changeset 13041 for OpenSceneGraph/trunk/include/osg/AnimationPath
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/AnimationPath (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/AnimationPath
r11790 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 34 34 { 35 35 public: 36 36 37 37 AnimationPath():_loopMode(LOOP) {} 38 38 … … 64 64 _rotation(rotation), 65 65 _scale(scale) {} 66 66 67 67 void setPosition(const osg::Vec3d& position) { _position = position; } 68 68 const osg::Vec3d& getPosition() const { return _position; } … … 81 81 _scale = first._scale*one_minus_ratio + second._scale*ratio; 82 82 } 83 83 84 84 inline void interpolate(double ratio,const ControlPoint& first, const ControlPoint& second) 85 85 { … … 125 125 126 126 }; 127 127 128 128 129 129 /** Given a specific time, return the transformation matrix for a point. */ … … 153 153 return true; 154 154 } 155 155 156 156 bool getInverse(double time,Matrixd& matrix) const 157 157 { … … 164 164 /** Given a specific time, return the local ControlPoint frame for a point. */ 165 165 virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const; 166 166 167 167 /** Insert a control point into the AnimationPath.*/ 168 168 void insert(double time,const ControlPoint& controlPoint); 169 169 170 170 double getFirstTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.begin()->first; else return 0.0;} 171 171 double getLastTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.rbegin()->first; else return 0.0;} 172 172 double getPeriod() const { return getLastTime()-getFirstTime();} 173 173 174 174 enum LoopMode 175 175 { … … 178 178 NO_LOOPING 179 179 }; 180 180 181 181 void setLoopMode(LoopMode lm) { _loopMode = lm; } 182 182 183 183 LoopMode getLoopMode() const { return _loopMode; } 184 184 185 185 186 186 typedef std::map<double,ControlPoint> TimeControlPointMap; 187 187 188 188 void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; } 189 189 190 190 TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; } 191 191 192 192 const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; } 193 193 194 194 bool empty() const { return _timeControlPointMap.empty(); } 195 195 196 196 void clear() { _timeControlPointMap.clear(); } 197 197 … … 206 206 207 207 protected: 208 208 209 209 virtual ~AnimationPath() {} 210 210 … … 241 241 _pauseTime(apc._pauseTime) {} 242 242 243 243 244 244 META_Object(osg,AnimationPathCallback); 245 245 … … 258 258 /** Construct an AnimationPathCallback and automatically create an animation path to produce a rotation about a point.*/ 259 259 AnimationPathCallback(const osg::Vec3d& pivot,const osg::Vec3d& axis,float angularVelocity); 260 261 260 261 262 262 void setAnimationPath(AnimationPath* path) { _animationPath = path; } 263 263 AnimationPath* getAnimationPath() { return _animationPath.get(); } … … 272 272 void setTimeOffset(double offset) { _timeOffset = offset; } 273 273 double getTimeOffset() const { return _timeOffset; } 274 274 275 275 void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; } 276 276 double getTimeMultiplier() const { return _timeMultiplier; } … … 289 289 /** Implements the callback. */ 290 290 virtual void operator()(Node* node, NodeVisitor* nv); 291 291 292 292 void update(osg::Node& node); 293 293 … … 305 305 306 306 protected: 307 307 308 308 ~AnimationPathCallback(){} 309 309
