23 #ifndef QGLVIEWER_KEY_FRAME_INTERPOLATOR_H
24 #define QGLVIEWER_KEY_FRAME_INTERPOLATOR_H
29 #include "quaternion.h"
162 void addKeyFrame(
const Frame& frame);
163 void addKeyFrame(
const Frame& frame,
float time);
165 void addKeyFrame(
const Frame*
const frame);
166 void addKeyFrame(
const Frame*
const frame,
float time);
183 void setFrame(
Frame*
const frame);
189 Frame keyFrame(
int index)
const;
190 float keyFrameTime(
int index)
const;
193 float duration()
const;
194 float firstTime()
const;
195 float lastTime()
const;
268 void startInterpolation(
int period = -1);
269 void stopInterpolation();
270 void resetInterpolation();
272 void toggleInterpolation() {
if (interpolationIsStarted()) stopInterpolation();
else startInterpolation(); }
273 virtual void interpolateAtTime(
float time);
279 virtual void drawPath(
int mask=1,
int nbFrames=6,
float scale=1.0f);
285 virtual QDomElement domElement(
const QString& name, QDomDocument& document)
const;
286 virtual void initFromDOMElement(
const QDomElement& element);
290 virtual void update();
291 virtual void invalidateValues() { valuesAreValid_ =
false; pathIsValid_ =
false; splineCacheIsValid_ =
false; }
299 void updateCurrentKeyFrameForTime(
float time);
300 void updateModifiedFrameValues();
301 void updateSplineCache();
308 KeyFrame(
const Frame& fr,
float t);
309 KeyFrame(
const Frame* fr,
float t);
311 Vec position()
const {
return p_; }
312 Quaternion orientation()
const {
return q_; }
313 Vec tgP()
const {
return tgP_; }
314 Quaternion tgQ()
const {
return tgQ_; }
315 float time()
const {
return time_; }
316 const Frame* frame()
const {
return frame_; }
317 void updateValuesFromPointer();
318 void flipOrientationIfNeeded(
const Quaternion& prev);
319 void computeTangent(
const KeyFrame*
const prev,
const KeyFrame*
const next);
324 const Frame*
const frame_;
329 mutable QList<KeyFrame*> keyFrame_;
330 QMutableListIterator<KeyFrame*>* currentFrame_[4];
339 float interpolationTime_;
340 float interpolationSpeed_;
341 bool interpolationStarted_;
345 bool loopInterpolation_;
349 bool valuesAreValid_;
350 bool currentFrameValid_;
351 bool splineCacheIsValid_;
357 #endif // QGLVIEWER_KEY_FRAME_INTERPOLATOR_H