attached objects follow their bones

model space positions are retrieved from bones
supported more than 4 bones
improved global and local orientation methods
improved vector angle method
This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent 73f49e91bc
commit 4f4bc88956
14 changed files with 230 additions and 210 deletions
+9 -2
View File
@@ -5,12 +5,18 @@
#include<string>
namespace vb01{
class Skeleton;
class Bone : public Node{
public:
Bone(std::string,Vector3[3],Vector3=Vector3::VEC_ZERO,Quaternion=Quaternion::QUAT_W,Vector3=Vector3::VEC_ZERO);
Bone(std::string,float,Vector3=Vector3::VEC_ZERO,Quaternion=Quaternion::QUAT_W,Vector3=Vector3::VEC_ZERO);
void setPosePos(Vector3 p);
void setPoseRot(Quaternion r);
void setPoseScale(Vector3 s);
void lookAt(Vector3,Vector3,Node*);
Vector3 getModelSpacePos();
inline float getLength(){return length;}
inline void setSkeleton(Skeleton *sk){this->skeleton = sk;}
inline Vector3 getInitAxis(int i){return initAxis[i];}
inline std::string getName(){return name;}
inline Vector3 getRestPos(){return restPos;}
@@ -20,7 +26,8 @@ namespace vb01{
inline Quaternion getPoseRot(){return poseRot;}
inline Vector3 getPoseScale(){return poseScale;}
private:
std::string name;
float length;
Skeleton *skeleton = nullptr;
Vector3 initAxis[3],restPos,posePos=Vector3::VEC_ZERO,restScale,poseScale=Vector3::VEC_IJK;
Quaternion restRot,poseRot=Quaternion::QUAT_W;
};