00001 #include "Bone.h" 00002 00003 using namespace model; 00004 00029 Bone::Bone(Bone* parent, IvVector3* vDirection, float fLength, string name) { 00030 setParent(parent); 00031 setDirection(vDirection); 00032 setLength(fLength); 00033 setName(name); 00034 } 00035 00054 Bone::Bone(const Bone& other) { 00055 m_parent = other.m_parent; 00056 m_vDirection = other.m_vDirection; 00057 m_fLength = other.m_fLength; 00058 m_lConstraints = other.m_lConstraints; 00059 m_lMapping = other.m_lMapping; 00060 m_vChilds = other.m_vChilds; 00061 m_sName = other.m_sName; 00062 } 00063 00085 Bone& Bone::operator=(const Bone& other) 00086 { 00087 // if same object 00088 if ( this == &other ) 00089 return *this; 00090 00091 m_parent = other.m_parent; 00092 m_vDirection = other.m_vDirection; 00093 m_fLength = other.m_fLength; 00094 m_lConstraints = other.m_lConstraints; 00095 m_lMapping = other.m_lMapping; 00096 m_vChilds = other.m_vChilds; 00097 m_sName = other.m_sName; 00098 00099 return *this; 00100 } 00101 00119 IvVector3* Bone::getDirection() { 00120 return m_vDirection; 00121 } 00122 00140 float Bone::getLength() { 00141 return m_fLength; 00142 } 00143 00161 vector<Constraint*> Bone::getConstraints() { 00162 return m_lConstraints; 00163 } 00164 00182 vector<Mapping*> Bone::getMapping() { 00183 return m_lMapping; 00184 } 00185 00197 void Bone::setParent(Bone* bone) { 00198 m_parent = bone; 00199 } 00200 00218 void Bone::setDirection(IvVector3* vDirection) { 00219 m_vDirection = vDirection; 00220 } 00221 00240 void Bone::setLength(float fLength) { 00241 m_fLength = fLength; 00242 } 00243 00261 void Bone::setConstraints(vector<Constraint*> lConstraints) { 00262 m_lConstraints = lConstraints; 00263 } 00264 00282 void Bone::setMapping(vector<Mapping*> lMapping) { 00283 m_lMapping = lMapping; 00284 } 00285 00303 void Bone::addConstraint(Constraint* constraint) { 00304 00305 } 00306 00324 void Bone::addMapping(Mapping* mapping) { 00325 00326 } 00327 00328 void Bone::addChild(Bone* bone) { 00329 m_vChilds.push_back(bone); 00330 } 00331 00349 void Bone::removeConstraint(Constraint* constraint) { 00350 00351 } 00352 00371 void Bone::removeMapping(Mapping* mapping) { 00372 00373 } 00374 00375 void Bone::removeChild(string name) { 00376 00377 } 00378 00400 bool Bone::operator==( const Bone& other ) const 00401 { 00402 00403 if(m_vDirection == other.m_vDirection 00404 && m_fLength == other.m_fLength 00405 && m_lConstraints == other.m_lConstraints 00406 && m_lMapping == other.m_lMapping 00407 && m_sName.compare(other.m_sName)) { 00408 return true; 00409 } 00410 return false; 00411 } 00412 00434 bool Bone::operator!=( const Bone& other ) const 00435 { 00436 if(m_vDirection == other.m_vDirection 00437 && m_fLength == other.m_fLength 00438 && m_lConstraints == other.m_lConstraints 00439 && m_lMapping == other.m_lMapping 00440 && m_sName.compare(other.m_sName)) { 00441 return false; 00442 } 00443 return true; 00444 } 00445 00464 void Bone::setName(string name) { 00465 m_sName = name; 00466 } 00467 00486 string Bone::getName() { 00487 return m_sName; 00488 } 00489