blob: f9d650c9b391c6a2d39a386823b1eca9e2cda126 (
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
31
32
33
34
|
#ifndef _SOFTSHADEROOM_TRANSFORM_H_
#define _SOFTSHADEROOM_TRANSFORM_H_
#include "../math/math.h"
typedef struct Transform Transform;
struct Transform {
/*local*/
Vec3 localposition;
Vec3 localscale;
Quat localrotation;
/*global*/
Transform* parent;
Vec3 cached_position;
Vec3 cached_scale;
Quat cached_rotation;
};
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);
void transform_localtoworlddir(Transform* trans, Vec3* dir, Vec3* out);
#endif
|