- Cal3D 0.11 API Reference -

coretrack.h
1 //****************************************************************************//
2 // coretrack.h //
3 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4 //****************************************************************************//
5 // This library is free software; you can redistribute it and/or modify it //
6 // under the terms of the GNU Lesser General Public License as published by //
7 // the Free Software Foundation; either version 2.1 of the License, or (at //
8 // your option) any later version. //
9 //****************************************************************************//
10 
11 #ifndef CAL_CORETRACK_H
12 #define CAL_CORETRACK_H
13 
14 
15 #include "cal3d/global.h"
16 #include "cal3d/matrix.h"
17 #include "cal3d/vector.h"
18 #include "cal3d/quaternion.h"
19 
20 
21 class CalCoreBone;
22 class CalCoreKeyframe;
23 class CalCoreSkeleton;
24 
25 
26 class CAL3D_API CalCoreTrack
27 {
28 private:
30  int m_coreBoneId;
31 
32  // If translationRequired is false, then the translations are the same as the
33  // skeleton's translations.
34  bool m_translationRequired;
35  bool m_highRangeRequired;
36  bool m_translationIsDynamic;
37  static int m_translationRequiredCount;
38  static int m_translationNotRequiredCount;
39 
41  std::vector<CalCoreKeyframe*> m_keyframes;
42 
43 // constructors/destructor
44 public:
45  CalCoreTrack();
46  ~CalCoreTrack();
47 
48  void create();
49  void destroy();
50  unsigned int size();
51 
52  bool getState(float time, CalVector& translation, CalQuaternion& rotation) const;
53 
54  /*****************************************************************************/
64  inline int getCoreBoneId() const
65  {
66  return m_coreBoneId;
67  }
68 
69  bool setCoreBoneId(int coreBoneId);
70 
71  int getCoreKeyframeCount() const;
72  CalCoreKeyframe *getCoreKeyframe(int idx);
73  const CalCoreKeyframe *getCoreKeyframe(int idx) const;
74 
75  static int translationRequiredCount() { return m_translationRequiredCount; }
76  static int translationNotRequiredCount() { return m_translationNotRequiredCount; }
77 
78  bool addCoreKeyframe(CalCoreKeyframe *pCoreKeyframe);
79  void removeCoreKeyFrame(int _i) { m_keyframes.erase( m_keyframes.begin() + _i); }
80  bool getTranslationRequired() { return m_translationRequired; }
81  void setTranslationRequired( bool p ) { m_translationRequired = p; }
82  bool getTranslationIsDynamic() { return m_translationIsDynamic; }
83  void setTranslationIsDynamic( bool p ) { m_translationIsDynamic = p; }
84  bool getHighRangeRequired() { return m_highRangeRequired; }
85  void setHighRangeRequired( bool p ) { m_highRangeRequired = p; }
86  void fillInvalidTranslations( CalVector const & trans );
87 
88  void scale(float factor);
89  void compress( double translationTolerance, double rotationToleranceDegrees, CalCoreSkeleton * skelOrNull );
90  bool roundTranslation( CalCoreKeyframe const * prev, CalCoreKeyframe * p, double translationTolerance );
91  void translationCompressibility(
92  bool * transRequiredResult, bool * transDynamicResult, bool * highRangeRequiredResult,
93  float threshold, float highRangeThreshold, CalCoreSkeleton * skel );
94  void collapseSequences( double translationTolerance, double rotationToleranceDegrees );
95 
96 private:
97  std::vector<CalCoreKeyframe *>::const_iterator getUpperBound(float time) const;
98  bool keyframeEliminatable( CalCoreKeyframe * prev, CalCoreKeyframe * p, CalCoreKeyframe * next,
99  double translationTolerance, double rotationToleranceDegrees);
100 };
101 
102 #endif
int getCoreBoneId() const
Returns the ID of the core bone.
Definition: coretrack.h:64
Definition: corebone.h:34
Definition: coreskeleton.h:24
The vector class.
Definition: vector.h:36
Definition: coretrack.h:26
The core keyframe class.
Definition: corekeyframe.h:31
The quaternion class.
Definition: quaternion.h:35

Generated by The Cal3D Team with Doxygen 1.8.14