-
Notifications
You must be signed in to change notification settings - Fork 60
/
Vec3.cs
147 lines (134 loc) · 7.98 KB
/
Vec3.cs
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using Godot;
using Vector3Array = Godot.Collections.Array<Godot.Vector3>;
/// <summary>
/// Adds more constants for Vector3.
/// </summary>
/// <remarks>
/// Also includes all of Godot's Vector3 constants.
/// </remarks>
public static partial class Vec3
{
public static readonly Vector3 Zero = new Vector3(0, 0, 0);
public static readonly Vector3 One = new Vector3(1, 1, 1);
public static readonly Vector3 Right = new Vector3(1, 0, 0);
public static readonly Vector3 BackRight = new Vector3(1, 0, 1);
public static readonly Vector3 Back = new Vector3(0, 0, 1);
public static readonly Vector3 BackLeft = new Vector3(-1, 0, 1);
public static readonly Vector3 Left = new Vector3(-1, 0, 0);
public static readonly Vector3 ForwardLeft = new Vector3(-1, 0, -1);
public static readonly Vector3 Forward = new Vector3(0, 0, -1);
public static readonly Vector3 ForwardRight = new Vector3(1, 0, -1);
public static readonly Vector3Array DirCardinal = new Vector3Array{
Right,
Back,
Left,
Forward,
};
public static readonly Vector3Array Dir = new Vector3Array{
Right,
BackRight,
Back,
BackLeft,
Left,
ForwardLeft,
Forward,
ForwardRight,
};
public static readonly Vector3 RightNorm = new Vector3(1, 0, 0);
public static readonly Vector3 BackRightNorm = new Vector3(0.7071067811865475244f, 0, 0.7071067811865475244f);
public static readonly Vector3 BackNorm = new Vector3(0, 0, 1);
public static readonly Vector3 BackLeftNorm = new Vector3(-0.7071067811865475244f, 0, 0.7071067811865475244f);
public static readonly Vector3 LeftNorm = new Vector3(-1, 0, 0);
public static readonly Vector3 ForwardLeftNorm = new Vector3(-0.7071067811865475244f, 0, -0.7071067811865475244f);
public static readonly Vector3 ForwardNorm = new Vector3(0, 0, -1);
public static readonly Vector3 ForwardRightNorm = new Vector3(0.7071067811865475244f, 0, -0.7071067811865475244f);
public static readonly Vector3Array DirNorm = new Vector3Array{
RightNorm,
BackRightNorm,
BackNorm,
BackLeftNorm,
LeftNorm,
ForwardLeftNorm,
ForwardNorm,
ForwardRightNorm,
};
public static readonly Vector3 E = new Vector3(1, 0, 0);
public static readonly Vector3 SE = new Vector3(1, 0, 1);
public static readonly Vector3 S = new Vector3(0, 0, 1);
public static readonly Vector3 SW = new Vector3(-1, 0, 1);
public static readonly Vector3 W = new Vector3(-1, 0, 0);
public static readonly Vector3 NW = new Vector3(-1, 0, -1);
public static readonly Vector3 N = new Vector3(0, 0, -1);
public static readonly Vector3 NE = new Vector3(1, 0, -1);
public static readonly Vector3 ENorm = new Vector3(1, 0, 0);
public static readonly Vector3 SENorm = new Vector3(0.7071067811865475244f, 0, 0.7071067811865475244f);
public static readonly Vector3 SNorm = new Vector3(0, 0, 1);
public static readonly Vector3 SWNorm = new Vector3(-0.7071067811865475244f, 0, 0.7071067811865475244f);
public static readonly Vector3 WNorm = new Vector3(-1, 0, 0);
public static readonly Vector3 NWNorm = new Vector3(-0.7071067811865475244f, 0, -0.7071067811865475244f);
public static readonly Vector3 NNorm = new Vector3(0, 0, -1);
public static readonly Vector3 NENorm = new Vector3(0.7071067811865475244f, 0, -0.7071067811865475244f);
// These are always normalized, because tan(22.5 degrees) is not rational.
public static readonly Vector3 SEE = new Vector3(0.9238795325112867561f, 0, 0.3826834323650897717f);
public static readonly Vector3 SSE = new Vector3(0.3826834323650897717f, 0, 0.9238795325112867561f);
public static readonly Vector3 SSW = new Vector3(-0.3826834323650897717f, 0, 0.9238795325112867561f);
public static readonly Vector3 SWW = new Vector3(-0.9238795325112867561f, 0, 0.3826834323650897717f);
public static readonly Vector3 NWW = new Vector3(-0.9238795325112867561f, 0, -0.3826834323650897717f);
public static readonly Vector3 NNW = new Vector3(-0.3826834323650897717f, 0, -0.9238795325112867561f);
public static readonly Vector3 NNE = new Vector3(0.3826834323650897717f, 0, -0.9238795325112867561f);
public static readonly Vector3 NEE = new Vector3(0.9238795325112867561f, 0, -0.3826834323650897717f);
public static readonly Vector3Array Dir16 = new Vector3Array{
ENorm,
SEE,
SENorm,
SSE,
SNorm,
SSW,
SWNorm,
SWW,
WNorm,
NWW,
NWNorm,
NNW,
NNorm,
NNE,
NENorm,
NEE,
};
public static readonly Vector3 Up = new Vector3(0, 1, 0);
public static readonly Vector3 UpRight = new Vector3(1, 1, 0);
public static readonly Vector3 UpBackRight = new Vector3(1, 1, 1);
public static readonly Vector3 UpBack = new Vector3(0, 1, 1);
public static readonly Vector3 UpBackLeft = new Vector3(-1, 1, 1);
public static readonly Vector3 UpLeft = new Vector3(-1, 1, 0);
public static readonly Vector3 UpForwardLeft = new Vector3(-1, 1, -1);
public static readonly Vector3 UpForward = new Vector3(0, 1, -1);
public static readonly Vector3 UpForwardRight = new Vector3(1, 1, -1);
public static readonly Vector3 Down = new Vector3(0, -1, 0);
public static readonly Vector3 DownRight = new Vector3(1, -1, 0);
public static readonly Vector3 DownBackRight = new Vector3(1, -1, 1);
public static readonly Vector3 DownBack = new Vector3(0, -1, 1);
public static readonly Vector3 DownBackLeft = new Vector3(-1, -1, 1);
public static readonly Vector3 DownLeft = new Vector3(-1, -1, 0);
public static readonly Vector3 DownForwardLeft = new Vector3(-1, -1, -1);
public static readonly Vector3 DownForward = new Vector3(0, -1, -1);
public static readonly Vector3 DownForwardRight = new Vector3(1, -1, -1);
public static readonly Vector3 UpNorm = new Vector3(0, 1, 0);
public static readonly Vector3 UpRightNorm = new Vector3(0.7071067811865475244f, 0.7071067811865475244f, 0);
public static readonly Vector3 UpBackRightNorm = new Vector3(0.5773502691896257645f, 0.5773502691896257645f, 0.5773502691896257645f);
public static readonly Vector3 UpBackNorm = new Vector3(0, 0.7071067811865475244f, 0.7071067811865475244f);
public static readonly Vector3 UpBackLeftNorm = new Vector3(-0.5773502691896257645f, 0.5773502691896257645f, 0.5773502691896257645f);
public static readonly Vector3 UpLeftNorm = new Vector3(-0.7071067811865475244f, 0.7071067811865475244f, 0);
public static readonly Vector3 UpForwardLeftNorm = new Vector3(-0.5773502691896257645f, 0.5773502691896257645f, -0.5773502691896257645f);
public static readonly Vector3 UpForwardNorm = new Vector3(0, 0.7071067811865475244f, -0.7071067811865475244f);
public static readonly Vector3 UpForwardRightNorm = new Vector3(0.5773502691896257645f, 0.5773502691896257645f, -0.5773502691896257645f);
public static readonly Vector3 DownNorm = new Vector3(0, -1, 0);
public static readonly Vector3 DownRightNorm = new Vector3(0.7071067811865475244f, -0.7071067811865475244f, 0);
public static readonly Vector3 DownBackRightNorm = new Vector3(0.5773502691896257645f, -0.5773502691896257645f, 0.5773502691896257645f);
public static readonly Vector3 DownBackNorm = new Vector3(0, -0.7071067811865475244f, 0.7071067811865475244f);
public static readonly Vector3 DownBackLeftNorm = new Vector3(-0.5773502691896257645f, -0.5773502691896257645f, 0.5773502691896257645f);
public static readonly Vector3 DownLeftNorm = new Vector3(-0.7071067811865475244f, -0.7071067811865475244f, 0);
public static readonly Vector3 DownForwardLeftNorm = new Vector3(-0.5773502691896257645f, -0.5773502691896257645f, -0.5773502691896257645f);
public static readonly Vector3 DownForwardNorm = new Vector3(0, -0.7071067811865475244f, -0.7071067811865475244f);
public static readonly Vector3 DownForwardRightNorm = new Vector3(0.5773502691896257645f, -0.5773502691896257645f, -0.5773502691896257645f);
}