blob: f6478193a40d802ae82149d68d9d8f693c78fc4e (
plain)
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
|
#include "../math/math.h"
typedef struct Transform Transform;
/*
** TransformҪעÒâ°´ scale -> rotation -> position ˳Ðò¼ÆËã
*/
typedef struct Transform {
/*local*/
Vec3 localposition;
Vec3 localscale;
Quat localrotation;
/*global*/
Transform* parent;
Vec3 position;
Vec3 scale;
Quat rotation;
} Transform;
void transform_translate(Transform* trans, Vec3* v);
void transform_getrotation(Transform* trans, Quat* out); /*get global rotation*/
void transform_getposition(Transform* trans, Vec3* out);
void transform_getscale(Vec3* out);
void transform_getpositionandrotation(Transform* trans, Vec3* pos, Quat* rot);
void transform_setdirty(Transform* trans);
/*get world to local matrix(no scale)*/
void transform_getinvmatrixnoscale(Transform* transform, Mat4* worldToLocal);
|