1 //****************************************************************************// 2 // corebone.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_COREBONE_H 12 #define CAL_COREBONE_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 CalCoreSkeleton; 22 class CalCoreModel; 23 24 25 class CAL3D_API CalCoreBone 26 { 27 public: 28 CalCoreBone(const std::string& name); ~CalCoreBone()29 ~CalCoreBone() { } 30 31 bool addChildId(int childId); 32 void calculateState(); 33 std::list<int>& getListChildId(); 34 const std::string& getName() const; 35 int getParentId() const; 36 CalCoreSkeleton *getCoreSkeleton(); 37 const CalQuaternion& getRotation() const; 38 const CalQuaternion& getRotationAbsolute() const; 39 const CalQuaternion& getRotationBoneSpace() const; 40 const CalVector& getTranslation() const; 41 const CalVector& getTranslationAbsolute() const; 42 const CalVector& getTranslationBoneSpace() const; 43 Cal::UserData getUserData(); 44 void setCoreSkeleton(CalCoreSkeleton *pCoreSkeleton); 45 void setParentId(int parentId); 46 void setRotation(const CalQuaternion& rotation); 47 void setRotationBoneSpace(const CalQuaternion& rotation); 48 void setTranslation(const CalVector& translation); 49 void setTranslationBoneSpace(const CalVector& translation); 50 void setUserData(Cal::UserData userData); 51 52 void calculateBoundingBox(CalCoreModel * pCoreModel); 53 CalBoundingBox & getBoundingBox(); 54 void getBoundingData(int planeId,CalVector & position); 55 bool isBoundingBoxPrecomputed() const; 56 void scale(float factor); 57 58 private: 59 std::string m_strName; 60 CalCoreSkeleton *m_pCoreSkeleton; 61 int m_parentId; 62 std::list<int> m_listChildId; 63 CalVector m_translation; 64 CalQuaternion m_rotation; 65 CalVector m_translationAbsolute; 66 CalQuaternion m_rotationAbsolute; 67 CalVector m_translationBoneSpace; 68 CalQuaternion m_rotationBoneSpace; 69 Cal::UserData m_userData; 70 71 CalBoundingBox m_boundingBox; 72 CalVector m_boundingPosition[6]; 73 bool m_boundingBoxPrecomputed; 74 }; 75 76 #endif 77 78 //****************************************************************************// 79