Logo
Transform.h
1#pragma once
2
3namespace XXSharpKmyGfx
4{
5 private ref class Transform
6 {
7 public:
8 Transform(XXSharpKmyMath::Vector3 translate,
9 XXSharpKmyMath::Vector3 rotate,
10 XXSharpKmyMath::Vector3 scale) {
11
12 this->translate = translate;
13 this->rotate = rotate;
14 this->scale = scale;
15 }
16
17 Transform(const kmyMath::Transform &t)
18 {
19 translate.x = t.getTranslate().x;
20 translate.y = t.getTranslate().y;
21 translate.z = t.getTranslate().z;
22
23 rotate.x = t.getRotateEular().x;
24 rotate.y = t.getRotateEular().y;
25 rotate.z = t.getRotateEular().z;
26
27 scale.x = t.getScale().x;
28 scale.y = t.getScale().y;
29 scale.z = t.getScale().z;
30 }
31
32 kmyMath::Transform toNative()
33 {
34 kmyMath::Transform t;
35 t.setTranslate(kmyMath::Vector3(translate.x, translate.y, translate.z));
36 t.setRotate(kmyMath::Vector3(rotate.x, rotate.y, rotate.z));
37 t.setScale(kmyMath::Vector3(scale.x, scale.y, scale.z));
38 return t;
39 }
40
41 void fromNative(const kmyMath::Transform &t)
42 {
43 translate.x = t.getTranslate().x;
44 translate.y = t.getTranslate().y;
45 translate.z = t.getTranslate().z;
46
47 rotate.x = t.getRotateEular().x;
48 rotate.y = t.getRotateEular().y;
49 rotate.z = t.getRotateEular().z;
50
51 scale.x = t.getScale().x;
52 scale.y = t.getScale().y;
53 scale.z = t.getScale().z;
54 }
55
56 void copyFrom(Transform ^t)
57 {
58 translate = t->translate;
59 rotate = t->rotate;
60 scale = t->scale;
61 }
62
63 XXSharpKmyMath::Vector3 translate, rotate, scale;
64 };
65
66}