- Cal3D 0.11 API Reference -

bone.h

00001 //****************************************************************************//
00002 // bone.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_BONE_H
00012 #define CAL_BONE_H
00013 
00014 
00015 #include "cal3d/global.h"
00016 #include "cal3d/vector.h"
00017 #include "cal3d/quaternion.h"
00018 #include "cal3d/matrix.h"
00019 #include "cal3d/corebone.h"
00020 
00021 
00022 //class CalCoreBone;
00023 class CalSkeleton;
00024 class CalModel;
00025 class CalCoreModel;
00026 
00027 
00028 class CAL3D_API CalBone
00029 {
00030 public:
00031   CalBone(CalCoreBone *coreBone);
00032   ~CalBone() { }
00033 
00034   void blendState(float unrampedWeight, const CalVector& translation, 
00035     const CalQuaternion & rotation, float scale = 1.0f,
00036     bool replace = false, float rampValue = 1.0f,
00037     bool absoluteTranslation = true);
00038   void calculateState();
00039   void clearState();
00040   CalCoreBone *getCoreBone();
00041   const CalCoreBone *getCoreBone() const;
00042   void setCoreTransformStateVariables();
00043   void setCoreState();
00044   void setCoreStateRecursive();
00045   void setRotation(const CalQuaternion& rotation);
00046   const CalQuaternion& getRotation() const;
00047   const CalQuaternion& getRotationAbsolute() const;
00048   const CalQuaternion& getRotationBoneSpace() const;
00049   void setTranslation(const CalVector& translation);
00050   const CalVector& getTranslation() const;
00051   const CalVector& getTranslationAbsolute() const;
00052   inline void setMeshScaleAbsolute( CalVector const & sv ) {
00053     m_meshScaleAbsolute = sv; }
00054   inline const CalVector& getTranslationBoneSpace() const{
00055     return m_translationBoneSpace;
00056   }
00057   inline const CalMatrix& getTransformMatrix() const{
00058     return m_transformMatrix;
00059   }
00060   void lockState();
00061   void setSkeleton(CalSkeleton *pSkeleton);
00062   void calculateBoundingBox();
00063   CalBoundingBox & getBoundingBox();
00064   const CalBoundingBox & getBoundingBox() const;
00065 
00066 private:
00067   CalCoreBone   *m_pCoreBone;
00068   CalSkeleton   *m_pSkeleton;
00069   float          m_accumulatedWeight;
00070   float          m_accumulatedWeightAbsolute;
00071   float          m_accumulatedReplacementAttenuation;
00072   float          m_firstBlendScale;
00073   CalVector      m_meshScaleAbsolute; // w.r.t. absolute coord system in 3dsMax (Z up), not local coord of bone.
00074   CalVector      m_translation;
00075   CalQuaternion  m_rotation;
00076   CalVector      m_translationAbsolute;
00077   CalQuaternion  m_rotationAbsolute;
00078   CalVector      m_translationBoneSpace;
00079   CalQuaternion  m_rotationBoneSpace;
00080   CalMatrix      m_transformMatrix;  
00081   CalBoundingBox m_boundingBox;
00082 };
00083 
00084 #endif
00085 
00086 //****************************************************************************//

Generated by The Cal3D Team with Doxygen 1.7.3