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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#ifndef SSR_STRUCTS_H
#define SSR_STRUCTS_H
#include "../util/type.h"
typedef struct {
float x, y;
} Vec2;
typedef union {
struct {
float x, y, z;
};
struct {
float A, B, C; /*重心坐标*/
};
Vec2 xy;
} Vec3;
typedef union {
struct {
float x, y, z, w;
};
struct {
float r, g, b, a;
};
Vec3 xyz;
} Vec4;
typedef union { /*in degree, for visualize quaternion*/
struct {
float x, y, z;
};
struct {
float pitch, yaw, roll;
};
} Euler;
typedef struct {
float x, y, z, w;
} Quat;
typedef union {
float l[16];
float m[4][4];
struct {
float
e00, e10, e20, e30, /*colum 0*/
e01, e11, e21, e31,
e02, e12, e22, e32,
e03, e13, e23, e33;
};
struct {
Vec4 x;/*colum 0*/
Vec4 y;
Vec4 z;
Vec4 w;
} axis; /*轴*/
struct {
Vec4 x;/*colum 0*/
Vec4 y;
Vec4 z;
Vec4 w;
} basis; /*基向量*/
struct {
Vec4 axisx;
Vec4 axisy;
Vec4 axisz;
Vec4 pos;
};
Vec4 colums[4];
} Mat4;
typedef union {
struct {
Vec3 c1, c2, c3;
};
float m[3][3];
struct {
float
e00, e10, e20, /*colum 0*/
e01, e11, e21,
e02, e12, e22;
};
} Mat3;
typedef union {
struct {
float
e00, e10, /*colum 0*/
e01, e11,
e02, e12;
};
} Mat23;
typedef union {
struct {
float
e00, e10, e20, e30, /*colum 0*/
e01, e11, e21, e31,
e02, e12, e22, e32;
};
struct { /*三个齐次裁剪坐标*/
Vec4 p1;
Vec4 p2;
Vec4 p3;
};
} Mat43;
#endif
|