master uint/magnolia / include / mgmath.h
 1#ifndef MGMATH_H
 2#define MGMATH_H
 3
 4#define MG_PI (3.14159265358979323846f)
 5#define MG_DEG_TO_RAD (MG_PI / 180.0f)
 6
 7#define MG_AngleRad(a) (a)
 8#define MG_AngleDeg(a) ((a) * MG_DEG_TO_RAD)
 9
10typedef struct {
11	float x;
12	float y;
13} MGVec2;
14
15typedef struct {
16	float x;
17	float y;
18	float z;
19} MGVec3;
20
21typedef struct {
22	float x;
23	float y;
24	float z;
25	float w;
26} MGVec4;
27
28typedef struct {
29	float Elements[4][4];
30} MGMat4;
31
32float MG_SinF(float angle);
33float MG_CosF(float angle);
34float MG_TanF(float angle);
35float MG_SqrtF(float value);
36
37MGVec2 MG_V2(float x, float y);
38MGVec3 MG_V3(float x, float y, float z);
39MGVec4 MG_V4(float x, float y, float z, float w);
40
41MGVec3 MG_AddV3(MGVec3 left, MGVec3 right);
42MGVec3 MG_SubV3(MGVec3 left, MGVec3 right);
43MGVec3 MG_MulV3F(MGVec3 left, float right);
44float  MG_DotV3(MGVec3 left, MGVec3 right);
45MGVec3 MG_Cross(MGVec3 left, MGVec3 right);
46MGVec3 MG_NormV3(MGVec3 vec);
47
48MGMat4 MG_M4(void);
49MGMat4 MG_M4D(float diagonal);
50MGMat4 MG_MulM4(MGMat4 left, MGMat4 right);
51MGMat4 MG_Translate(MGVec3 translation);
52MGMat4 MG_Perspective_RH_NO(float fov_y, float aspect, float near_z, float far_z);
53MGMat4 MG_LookAt_RH(MGVec3 eye, MGVec3 center, MGVec3 up);
54
55#endif /* MGMATH_H */