CSEngine
Loading...
Searching...
No Matches
Joint.h
1//
2// Created by ounols on 19. 1. 20.
3//
4
5#pragma once
6
7#include <string>
8#include <vector>
9
10#include "../../MacroDef.h"
11#include "../Matrix.h"
12
13namespace CSE {
14
15 class Joint {
16 public:
17 Joint(int m_index, std::string m_nameID, mat4 m_bindLocalTransform)
18 : m_index(m_index), m_nameID(m_nameID), m_bindLocalTransform(m_bindLocalTransform) {
19
20 }
21
22 ~Joint() {
23 for (auto child : m_children) {
24 SAFE_DELETE(child);
25 }
26
27 m_children.clear();
28 }
29
30 void addChild(Joint* child) {
31 if (child == nullptr) return;
32 m_children.push_back(child);
33 }
34
35 const std::string& GetName() const {
36 return m_nameID;
37 }
38
39 int GetIndex() const {
40 return m_index;
41 }
42
43 const mat4 GetBindLocalTransform() const {
44 return m_bindLocalTransform;
45 }
46
47 const std::vector<Joint*>& GetChildren() const {
48 return m_children;
49 }
50
51 private:
52 int m_index;
53 std::string m_nameID;
54 mat4 m_bindLocalTransform;
55
56 std::vector<Joint*> m_children;
57
58 };
59
60}