summaryrefslogtreecommitdiff
path: root/src/extend/transform.h
blob: 16b7c7f91c5b3d87a3c0c642c4ec89b06df19bc2 (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
#include "../math/math.h"

/*
** TransformҪעÒâ°´ scale -> rotation -> position ˳Ðò¼ÆËã
*/
typedef struct Transform {
	/*local*/
	Vec3 localposition;
	Vec3 localscale;
	Quat localrotation;
	/*global*/
	Transform* parent;
	Vec3 position;
	Vec3 scale; 
	Quat rotation;
	bool isdirty;
} Transform;

void transform_translate(Transform* trans, Vec4* v, Vec4* out);

Vec4 transform_translate(Transform* trans, Vec4* v);

void transform_getrotation(Quat* out); /*get global rotation*/
void transform_getposition(Vec3* out);
void transform_getscale(Vec3* out);

void transform_setdirty(Transform* trans);