forked from huxingyi/dust3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jointnodetree.h
36 lines (33 loc) · 958 Bytes
/
jointnodetree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef DUST3D_JOINT_NODE_TREE_H
#define DUST3D_JOINT_NODE_TREE_H
#include <QMatrix4x4>
#include <vector>
#include <QQuaternion>
#include "rigger.h"
struct JointNode
{
int parentIndex;
QString name;
QVector3D position;
QVector3D bindTranslation;
QVector3D translation;
QQuaternion rotation;
QMatrix4x4 transformMatrix;
QMatrix4x4 inverseBindMatrix;
std::vector<int> children;
};
class JointNodeTree
{
public:
const std::vector<JointNode> &nodes() const;
JointNodeTree(const std::vector<RiggerBone> *resultRigBones);
void updateRotation(int index, QQuaternion rotation);
void updateTranslation(int index, QVector3D translation);
void addTranslation(int index, QVector3D translation);
void reset();
void recalculateTransformMatrices();
static JointNodeTree slerp(const JointNodeTree &first, const JointNodeTree &second, float t);
private:
std::vector<JointNode> m_boneNodes;
};
#endif