-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvgen_vector.h
86 lines (67 loc) · 1.93 KB
/
vgen_vector.h
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
// .___
// ___ __ ____ ___ ___ ____ __| _/
// \ \/ // __ \\ \/ // __ \ / __ |
// \ /\ ___/ > <\ ___// /_/ |
// \_/ \___ >__/\_ \\___ >____ |
// \/ \/ \/ \/ __ .__
// ____ ____ ____ ________________ _/ |_|__| ____ ____
// / ___\_/ __ \ / \_/ __ \_ __ \__ \\ __\ |/ _ \ / \
// / /_/ > ___/| | \ ___/| | \// __ \| | | ( <_> ) | \
// \___ / \___ >___| /\___ >__| (____ /__| |__|\____/|___| /
// /_____/ \/ \/ \/ \/ \/
//
// (c) 2016 - 2020 Karsten Schmidt // ASL 2.0 licensed
#ifndef __vgen_vector_h__
#define __vgen_vector_h__
vector2 vg_vec2(float x, y) {
return set(x, y);
}
vector2 vg_vec2(vector3 v) {
return set(v.x, v.y);
}
vector2 vg_vec2(vector4 v) {
return set(v.x, v.y);
}
vector vg_vec3(vector2 v) {
return set(v.x, v.y, 0);
}
vector vg_vec3(vector2 xy; float z) {
return set(xy.x, xy.y, z);
}
vector vg_vec3(vector4 v) {
return set(v.x, v.y, v.z);
}
vector4 vg_vec4(vector2 xy, zw) {
return set(xy.x, xy.y, zw.x, zw.y);
}
vector4 vg_vec4(vector xyz; float w) {
return set(xyz.x, xyz.y, xyz.z, w);
}
vector2 vg_swizzle(vector2 v; int x, y) {
return set(v[x], v[y]);
}
vector vg_swizzle(vector2 v; int x, y, z) {
return set(v[x], v[y], v[z]);
}
vector4 vg_swizzle(vector2 v; int x, y, z, w) {
return set(v[x], v[y], v[z], v[w]);
}
vector2 vg_swizzle(vector v; int x, y) {
return set(v[x], v[y]);
}
vector vg_swizzle(vector v; int x, y, z) {
return set(v[x], v[y], v[z]);
}
vector4 vg_swizzle(vector v; int x, y, z, w) {
return set(v[x], v[y], v[z], v[w]);
}
vector2 vg_swizzle(vector4 v; int x, y) {
return set(v[x], v[y]);
}
vector vg_swizzle(vector4 v; int x, y, z) {
return set(v[x], v[y], v[z]);
}
vector4 vg_swizzle(vector4 v; int x, y, z, w) {
return set(v[x], v[y], v[z], v[w]);
}
#endif