- Cal3D 0.11 API Reference -

coretrack.h

00001 //****************************************************************************//
00002 // coretrack.h                                                                //
00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger                       //
00004 //****************************************************************************//
00005 // This library is free software; you can redistribute it and/or modify it    //
00006 // under the terms of the GNU Lesser General Public License as published by   //
00007 // the Free Software Foundation; either version 2.1 of the License, or (at    //
00008 // your option) any later version.                                            //
00009 //****************************************************************************//
00010 
00011 #ifndef CAL_CORETRACK_H
00012 #define CAL_CORETRACK_H
00013 
00014 
00015 #include "cal3d/global.h"
00016 #include "cal3d/matrix.h"
00017 #include "cal3d/vector.h"
00018 #include "cal3d/quaternion.h"
00019 
00020 
00021 class CalCoreBone;
00022 class CalCoreKeyframe;
00023 class CalCoreSkeleton;
00024 
00025 
00026 class CAL3D_API CalCoreTrack
00027 {
00028 private:
00030   int m_coreBoneId;
00031 
00032   // If translationRequired is false, then the translations are the same as the
00033   // skeleton's translations.
00034   bool m_translationRequired;
00035   bool m_highRangeRequired;
00036   bool m_translationIsDynamic;
00037   static int m_translationRequiredCount;
00038   static int m_translationNotRequiredCount;
00039 
00041   std::vector<CalCoreKeyframe*> m_keyframes;
00042 
00043 // constructors/destructor
00044 public:
00045   CalCoreTrack();
00046   ~CalCoreTrack();
00047 
00048   void create();
00049   void destroy();
00050   unsigned int size();
00051 
00052   bool getState(float time, CalVector& translation, CalQuaternion& rotation) const;
00053 
00054   /*****************************************************************************/
00064   inline int getCoreBoneId() const
00065   {
00066       return m_coreBoneId;
00067   }
00068 
00069   bool setCoreBoneId(int coreBoneId);
00070   
00071   int getCoreKeyframeCount() const;
00072   CalCoreKeyframe *getCoreKeyframe(int idx);
00073   const CalCoreKeyframe *getCoreKeyframe(int idx) const;
00074 
00075   static int translationRequiredCount() { return m_translationRequiredCount; }
00076   static int translationNotRequiredCount() { return m_translationNotRequiredCount; }
00077   bool addCoreKeyframe(CalCoreKeyframe *pCoreKeyframe);
00078     void removeCoreKeyFrame(int _i) { m_keyframes.erase( m_keyframes.begin() + _i); }
00079   bool getTranslationRequired() { return m_translationRequired; }
00080   void setTranslationRequired( bool p ) { m_translationRequired = p; }
00081   bool getTranslationIsDynamic() { return m_translationIsDynamic; }
00082   void setTranslationIsDynamic( bool p ) { m_translationIsDynamic = p; }
00083   bool getHighRangeRequired() { return m_highRangeRequired; }
00084   void setHighRangeRequired( bool p ) { m_highRangeRequired = p; }
00085   void fillInvalidTranslations( CalVector const & trans );
00086 
00087   void scale(float factor);
00088   void compress( double translationTolerance, double rotationToleranceDegrees, CalCoreSkeleton * skelOrNull );
00089   bool roundTranslation( CalCoreKeyframe const * prev, CalCoreKeyframe * p, double translationTolerance );
00090   void translationCompressibility( 
00091     bool * transRequiredResult, bool * transDynamicResult, bool * highRangeRequiredResult,
00092     float threshold, float highRangeThreshold, CalCoreSkeleton * skel );
00093   void collapseSequences( double translationTolerance, double rotationToleranceDegrees );
00094 
00095 private:
00096   std::vector<CalCoreKeyframe *>::const_iterator getUpperBound(float time) const;
00097   bool keyframeEliminatable( CalCoreKeyframe * prev, CalCoreKeyframe * p, CalCoreKeyframe * next,
00098        double translationTolerance, double rotationToleranceDegrees);
00099 };
00100 
00101 #endif

Generated by The Cal3D Team with Doxygen 1.7.3