A game about forced loneliness, made by TACStudios
1//------------------------------------------------------------------------------
2// <auto-generated>
3// This code was generated by a tool.
4//
5// Changes to this file may cause incorrect behavior and will be lost if
6// the code is regenerated. To update the generation of this file, modify and re-run Unity.Mathematics.CodeGen.
7// </auto-generated>
8//------------------------------------------------------------------------------
9using System;
10using System.Runtime.CompilerServices;
11using System.Diagnostics;
12using Unity.IL2CPP.CompilerServices;
13
14#pragma warning disable 0660, 0661
15
16namespace Unity.Mathematics
17{
18 /// <summary>A 2 component vector of floats.</summary>
19 [DebuggerTypeProxy(typeof(float2.DebuggerProxy))]
20 [System.Serializable]
21 [Il2CppEagerStaticClassConstruction]
22 public partial struct float2 : System.IEquatable<float2>, IFormattable
23 {
24 /// <summary>x component of the vector.</summary>
25 public float x;
26 /// <summary>y component of the vector.</summary>
27 public float y;
28
29 /// <summary>float2 zero value.</summary>
30 public static readonly float2 zero;
31
32 /// <summary>Constructs a float2 vector from two float values.</summary>
33 /// <param name="x">The constructed vector's x component will be set to this value.</param>
34 /// <param name="y">The constructed vector's y component will be set to this value.</param>
35 [MethodImpl(MethodImplOptions.AggressiveInlining)]
36 public float2(float x, float y)
37 {
38 this.x = x;
39 this.y = y;
40 }
41
42 /// <summary>Constructs a float2 vector from a float2 vector.</summary>
43 /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
44 [MethodImpl(MethodImplOptions.AggressiveInlining)]
45 public float2(float2 xy)
46 {
47 this.x = xy.x;
48 this.y = xy.y;
49 }
50
51 /// <summary>Constructs a float2 vector from a single float value by assigning it to every component.</summary>
52 /// <param name="v">float to convert to float2</param>
53 [MethodImpl(MethodImplOptions.AggressiveInlining)]
54 public float2(float v)
55 {
56 this.x = v;
57 this.y = v;
58 }
59
60 /// <summary>Constructs a float2 vector from a single bool value by converting it to float and assigning it to every component.</summary>
61 /// <param name="v">bool to convert to float2</param>
62 [MethodImpl(MethodImplOptions.AggressiveInlining)]
63 public float2(bool v)
64 {
65 this.x = v ? 1.0f : 0.0f;
66 this.y = v ? 1.0f : 0.0f;
67 }
68
69 /// <summary>Constructs a float2 vector from a bool2 vector by componentwise conversion.</summary>
70 /// <param name="v">bool2 to convert to float2</param>
71 [MethodImpl(MethodImplOptions.AggressiveInlining)]
72 public float2(bool2 v)
73 {
74 this.x = v.x ? 1.0f : 0.0f;
75 this.y = v.y ? 1.0f : 0.0f;
76 }
77
78 /// <summary>Constructs a float2 vector from a single int value by converting it to float and assigning it to every component.</summary>
79 /// <param name="v">int to convert to float2</param>
80 [MethodImpl(MethodImplOptions.AggressiveInlining)]
81 public float2(int v)
82 {
83 this.x = v;
84 this.y = v;
85 }
86
87 /// <summary>Constructs a float2 vector from a int2 vector by componentwise conversion.</summary>
88 /// <param name="v">int2 to convert to float2</param>
89 [MethodImpl(MethodImplOptions.AggressiveInlining)]
90 public float2(int2 v)
91 {
92 this.x = v.x;
93 this.y = v.y;
94 }
95
96 /// <summary>Constructs a float2 vector from a single uint value by converting it to float and assigning it to every component.</summary>
97 /// <param name="v">uint to convert to float2</param>
98 [MethodImpl(MethodImplOptions.AggressiveInlining)]
99 public float2(uint v)
100 {
101 this.x = v;
102 this.y = v;
103 }
104
105 /// <summary>Constructs a float2 vector from a uint2 vector by componentwise conversion.</summary>
106 /// <param name="v">uint2 to convert to float2</param>
107 [MethodImpl(MethodImplOptions.AggressiveInlining)]
108 public float2(uint2 v)
109 {
110 this.x = v.x;
111 this.y = v.y;
112 }
113
114 /// <summary>Constructs a float2 vector from a single half value by converting it to float and assigning it to every component.</summary>
115 /// <param name="v">half to convert to float2</param>
116 [MethodImpl(MethodImplOptions.AggressiveInlining)]
117 public float2(half v)
118 {
119 this.x = v;
120 this.y = v;
121 }
122
123 /// <summary>Constructs a float2 vector from a half2 vector by componentwise conversion.</summary>
124 /// <param name="v">half2 to convert to float2</param>
125 [MethodImpl(MethodImplOptions.AggressiveInlining)]
126 public float2(half2 v)
127 {
128 this.x = v.x;
129 this.y = v.y;
130 }
131
132 /// <summary>Constructs a float2 vector from a single double value by converting it to float and assigning it to every component.</summary>
133 /// <param name="v">double to convert to float2</param>
134 [MethodImpl(MethodImplOptions.AggressiveInlining)]
135 public float2(double v)
136 {
137 this.x = (float)v;
138 this.y = (float)v;
139 }
140
141 /// <summary>Constructs a float2 vector from a double2 vector by componentwise conversion.</summary>
142 /// <param name="v">double2 to convert to float2</param>
143 [MethodImpl(MethodImplOptions.AggressiveInlining)]
144 public float2(double2 v)
145 {
146 this.x = (float)v.x;
147 this.y = (float)v.y;
148 }
149
150
151 /// <summary>Implicitly converts a single float value to a float2 vector by assigning it to every component.</summary>
152 /// <param name="v">float to convert to float2</param>
153 /// <returns>Converted value.</returns>
154 [MethodImpl(MethodImplOptions.AggressiveInlining)]
155 public static implicit operator float2(float v) { return new float2(v); }
156
157 /// <summary>Explicitly converts a single bool value to a float2 vector by converting it to float and assigning it to every component.</summary>
158 /// <param name="v">bool to convert to float2</param>
159 /// <returns>Converted value.</returns>
160 [MethodImpl(MethodImplOptions.AggressiveInlining)]
161 public static explicit operator float2(bool v) { return new float2(v); }
162
163 /// <summary>Explicitly converts a bool2 vector to a float2 vector by componentwise conversion.</summary>
164 /// <param name="v">bool2 to convert to float2</param>
165 /// <returns>Converted value.</returns>
166 [MethodImpl(MethodImplOptions.AggressiveInlining)]
167 public static explicit operator float2(bool2 v) { return new float2(v); }
168
169 /// <summary>Implicitly converts a single int value to a float2 vector by converting it to float and assigning it to every component.</summary>
170 /// <param name="v">int to convert to float2</param>
171 /// <returns>Converted value.</returns>
172 [MethodImpl(MethodImplOptions.AggressiveInlining)]
173 public static implicit operator float2(int v) { return new float2(v); }
174
175 /// <summary>Implicitly converts a int2 vector to a float2 vector by componentwise conversion.</summary>
176 /// <param name="v">int2 to convert to float2</param>
177 /// <returns>Converted value.</returns>
178 [MethodImpl(MethodImplOptions.AggressiveInlining)]
179 public static implicit operator float2(int2 v) { return new float2(v); }
180
181 /// <summary>Implicitly converts a single uint value to a float2 vector by converting it to float and assigning it to every component.</summary>
182 /// <param name="v">uint to convert to float2</param>
183 /// <returns>Converted value.</returns>
184 [MethodImpl(MethodImplOptions.AggressiveInlining)]
185 public static implicit operator float2(uint v) { return new float2(v); }
186
187 /// <summary>Implicitly converts a uint2 vector to a float2 vector by componentwise conversion.</summary>
188 /// <param name="v">uint2 to convert to float2</param>
189 /// <returns>Converted value.</returns>
190 [MethodImpl(MethodImplOptions.AggressiveInlining)]
191 public static implicit operator float2(uint2 v) { return new float2(v); }
192
193 /// <summary>Implicitly converts a single half value to a float2 vector by converting it to float and assigning it to every component.</summary>
194 /// <param name="v">half to convert to float2</param>
195 /// <returns>Converted value.</returns>
196 [MethodImpl(MethodImplOptions.AggressiveInlining)]
197 public static implicit operator float2(half v) { return new float2(v); }
198
199 /// <summary>Implicitly converts a half2 vector to a float2 vector by componentwise conversion.</summary>
200 /// <param name="v">half2 to convert to float2</param>
201 /// <returns>Converted value.</returns>
202 [MethodImpl(MethodImplOptions.AggressiveInlining)]
203 public static implicit operator float2(half2 v) { return new float2(v); }
204
205 /// <summary>Explicitly converts a single double value to a float2 vector by converting it to float and assigning it to every component.</summary>
206 /// <param name="v">double to convert to float2</param>
207 /// <returns>Converted value.</returns>
208 [MethodImpl(MethodImplOptions.AggressiveInlining)]
209 public static explicit operator float2(double v) { return new float2(v); }
210
211 /// <summary>Explicitly converts a double2 vector to a float2 vector by componentwise conversion.</summary>
212 /// <param name="v">double2 to convert to float2</param>
213 /// <returns>Converted value.</returns>
214 [MethodImpl(MethodImplOptions.AggressiveInlining)]
215 public static explicit operator float2(double2 v) { return new float2(v); }
216
217
218 /// <summary>Returns the result of a componentwise multiplication operation on two float2 vectors.</summary>
219 /// <param name="lhs">Left hand side float2 to use to compute componentwise multiplication.</param>
220 /// <param name="rhs">Right hand side float2 to use to compute componentwise multiplication.</param>
221 /// <returns>float2 result of the componentwise multiplication.</returns>
222 [MethodImpl(MethodImplOptions.AggressiveInlining)]
223 public static float2 operator * (float2 lhs, float2 rhs) { return new float2 (lhs.x * rhs.x, lhs.y * rhs.y); }
224
225 /// <summary>Returns the result of a componentwise multiplication operation on a float2 vector and a float value.</summary>
226 /// <param name="lhs">Left hand side float2 to use to compute componentwise multiplication.</param>
227 /// <param name="rhs">Right hand side float to use to compute componentwise multiplication.</param>
228 /// <returns>float2 result of the componentwise multiplication.</returns>
229 [MethodImpl(MethodImplOptions.AggressiveInlining)]
230 public static float2 operator * (float2 lhs, float rhs) { return new float2 (lhs.x * rhs, lhs.y * rhs); }
231
232 /// <summary>Returns the result of a componentwise multiplication operation on a float value and a float2 vector.</summary>
233 /// <param name="lhs">Left hand side float to use to compute componentwise multiplication.</param>
234 /// <param name="rhs">Right hand side float2 to use to compute componentwise multiplication.</param>
235 /// <returns>float2 result of the componentwise multiplication.</returns>
236 [MethodImpl(MethodImplOptions.AggressiveInlining)]
237 public static float2 operator * (float lhs, float2 rhs) { return new float2 (lhs * rhs.x, lhs * rhs.y); }
238
239
240 /// <summary>Returns the result of a componentwise addition operation on two float2 vectors.</summary>
241 /// <param name="lhs">Left hand side float2 to use to compute componentwise addition.</param>
242 /// <param name="rhs">Right hand side float2 to use to compute componentwise addition.</param>
243 /// <returns>float2 result of the componentwise addition.</returns>
244 [MethodImpl(MethodImplOptions.AggressiveInlining)]
245 public static float2 operator + (float2 lhs, float2 rhs) { return new float2 (lhs.x + rhs.x, lhs.y + rhs.y); }
246
247 /// <summary>Returns the result of a componentwise addition operation on a float2 vector and a float value.</summary>
248 /// <param name="lhs">Left hand side float2 to use to compute componentwise addition.</param>
249 /// <param name="rhs">Right hand side float to use to compute componentwise addition.</param>
250 /// <returns>float2 result of the componentwise addition.</returns>
251 [MethodImpl(MethodImplOptions.AggressiveInlining)]
252 public static float2 operator + (float2 lhs, float rhs) { return new float2 (lhs.x + rhs, lhs.y + rhs); }
253
254 /// <summary>Returns the result of a componentwise addition operation on a float value and a float2 vector.</summary>
255 /// <param name="lhs">Left hand side float to use to compute componentwise addition.</param>
256 /// <param name="rhs">Right hand side float2 to use to compute componentwise addition.</param>
257 /// <returns>float2 result of the componentwise addition.</returns>
258 [MethodImpl(MethodImplOptions.AggressiveInlining)]
259 public static float2 operator + (float lhs, float2 rhs) { return new float2 (lhs + rhs.x, lhs + rhs.y); }
260
261
262 /// <summary>Returns the result of a componentwise subtraction operation on two float2 vectors.</summary>
263 /// <param name="lhs">Left hand side float2 to use to compute componentwise subtraction.</param>
264 /// <param name="rhs">Right hand side float2 to use to compute componentwise subtraction.</param>
265 /// <returns>float2 result of the componentwise subtraction.</returns>
266 [MethodImpl(MethodImplOptions.AggressiveInlining)]
267 public static float2 operator - (float2 lhs, float2 rhs) { return new float2 (lhs.x - rhs.x, lhs.y - rhs.y); }
268
269 /// <summary>Returns the result of a componentwise subtraction operation on a float2 vector and a float value.</summary>
270 /// <param name="lhs">Left hand side float2 to use to compute componentwise subtraction.</param>
271 /// <param name="rhs">Right hand side float to use to compute componentwise subtraction.</param>
272 /// <returns>float2 result of the componentwise subtraction.</returns>
273 [MethodImpl(MethodImplOptions.AggressiveInlining)]
274 public static float2 operator - (float2 lhs, float rhs) { return new float2 (lhs.x - rhs, lhs.y - rhs); }
275
276 /// <summary>Returns the result of a componentwise subtraction operation on a float value and a float2 vector.</summary>
277 /// <param name="lhs">Left hand side float to use to compute componentwise subtraction.</param>
278 /// <param name="rhs">Right hand side float2 to use to compute componentwise subtraction.</param>
279 /// <returns>float2 result of the componentwise subtraction.</returns>
280 [MethodImpl(MethodImplOptions.AggressiveInlining)]
281 public static float2 operator - (float lhs, float2 rhs) { return new float2 (lhs - rhs.x, lhs - rhs.y); }
282
283
284 /// <summary>Returns the result of a componentwise division operation on two float2 vectors.</summary>
285 /// <param name="lhs">Left hand side float2 to use to compute componentwise division.</param>
286 /// <param name="rhs">Right hand side float2 to use to compute componentwise division.</param>
287 /// <returns>float2 result of the componentwise division.</returns>
288 [MethodImpl(MethodImplOptions.AggressiveInlining)]
289 public static float2 operator / (float2 lhs, float2 rhs) { return new float2 (lhs.x / rhs.x, lhs.y / rhs.y); }
290
291 /// <summary>Returns the result of a componentwise division operation on a float2 vector and a float value.</summary>
292 /// <param name="lhs">Left hand side float2 to use to compute componentwise division.</param>
293 /// <param name="rhs">Right hand side float to use to compute componentwise division.</param>
294 /// <returns>float2 result of the componentwise division.</returns>
295 [MethodImpl(MethodImplOptions.AggressiveInlining)]
296 public static float2 operator / (float2 lhs, float rhs) { return new float2 (lhs.x / rhs, lhs.y / rhs); }
297
298 /// <summary>Returns the result of a componentwise division operation on a float value and a float2 vector.</summary>
299 /// <param name="lhs">Left hand side float to use to compute componentwise division.</param>
300 /// <param name="rhs">Right hand side float2 to use to compute componentwise division.</param>
301 /// <returns>float2 result of the componentwise division.</returns>
302 [MethodImpl(MethodImplOptions.AggressiveInlining)]
303 public static float2 operator / (float lhs, float2 rhs) { return new float2 (lhs / rhs.x, lhs / rhs.y); }
304
305
306 /// <summary>Returns the result of a componentwise modulus operation on two float2 vectors.</summary>
307 /// <param name="lhs">Left hand side float2 to use to compute componentwise modulus.</param>
308 /// <param name="rhs">Right hand side float2 to use to compute componentwise modulus.</param>
309 /// <returns>float2 result of the componentwise modulus.</returns>
310 [MethodImpl(MethodImplOptions.AggressiveInlining)]
311 public static float2 operator % (float2 lhs, float2 rhs) { return new float2 (lhs.x % rhs.x, lhs.y % rhs.y); }
312
313 /// <summary>Returns the result of a componentwise modulus operation on a float2 vector and a float value.</summary>
314 /// <param name="lhs">Left hand side float2 to use to compute componentwise modulus.</param>
315 /// <param name="rhs">Right hand side float to use to compute componentwise modulus.</param>
316 /// <returns>float2 result of the componentwise modulus.</returns>
317 [MethodImpl(MethodImplOptions.AggressiveInlining)]
318 public static float2 operator % (float2 lhs, float rhs) { return new float2 (lhs.x % rhs, lhs.y % rhs); }
319
320 /// <summary>Returns the result of a componentwise modulus operation on a float value and a float2 vector.</summary>
321 /// <param name="lhs">Left hand side float to use to compute componentwise modulus.</param>
322 /// <param name="rhs">Right hand side float2 to use to compute componentwise modulus.</param>
323 /// <returns>float2 result of the componentwise modulus.</returns>
324 [MethodImpl(MethodImplOptions.AggressiveInlining)]
325 public static float2 operator % (float lhs, float2 rhs) { return new float2 (lhs % rhs.x, lhs % rhs.y); }
326
327
328 /// <summary>Returns the result of a componentwise increment operation on a float2 vector.</summary>
329 /// <param name="val">Value to use when computing the componentwise increment.</param>
330 /// <returns>float2 result of the componentwise increment.</returns>
331 [MethodImpl(MethodImplOptions.AggressiveInlining)]
332 public static float2 operator ++ (float2 val) { return new float2 (++val.x, ++val.y); }
333
334
335 /// <summary>Returns the result of a componentwise decrement operation on a float2 vector.</summary>
336 /// <param name="val">Value to use when computing the componentwise decrement.</param>
337 /// <returns>float2 result of the componentwise decrement.</returns>
338 [MethodImpl(MethodImplOptions.AggressiveInlining)]
339 public static float2 operator -- (float2 val) { return new float2 (--val.x, --val.y); }
340
341
342 /// <summary>Returns the result of a componentwise less than operation on two float2 vectors.</summary>
343 /// <param name="lhs">Left hand side float2 to use to compute componentwise less than.</param>
344 /// <param name="rhs">Right hand side float2 to use to compute componentwise less than.</param>
345 /// <returns>bool2 result of the componentwise less than.</returns>
346 [MethodImpl(MethodImplOptions.AggressiveInlining)]
347 public static bool2 operator < (float2 lhs, float2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
348
349 /// <summary>Returns the result of a componentwise less than operation on a float2 vector and a float value.</summary>
350 /// <param name="lhs">Left hand side float2 to use to compute componentwise less than.</param>
351 /// <param name="rhs">Right hand side float to use to compute componentwise less than.</param>
352 /// <returns>bool2 result of the componentwise less than.</returns>
353 [MethodImpl(MethodImplOptions.AggressiveInlining)]
354 public static bool2 operator < (float2 lhs, float rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
355
356 /// <summary>Returns the result of a componentwise less than operation on a float value and a float2 vector.</summary>
357 /// <param name="lhs">Left hand side float to use to compute componentwise less than.</param>
358 /// <param name="rhs">Right hand side float2 to use to compute componentwise less than.</param>
359 /// <returns>bool2 result of the componentwise less than.</returns>
360 [MethodImpl(MethodImplOptions.AggressiveInlining)]
361 public static bool2 operator < (float lhs, float2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
362
363
364 /// <summary>Returns the result of a componentwise less or equal operation on two float2 vectors.</summary>
365 /// <param name="lhs">Left hand side float2 to use to compute componentwise less or equal.</param>
366 /// <param name="rhs">Right hand side float2 to use to compute componentwise less or equal.</param>
367 /// <returns>bool2 result of the componentwise less or equal.</returns>
368 [MethodImpl(MethodImplOptions.AggressiveInlining)]
369 public static bool2 operator <= (float2 lhs, float2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
370
371 /// <summary>Returns the result of a componentwise less or equal operation on a float2 vector and a float value.</summary>
372 /// <param name="lhs">Left hand side float2 to use to compute componentwise less or equal.</param>
373 /// <param name="rhs">Right hand side float to use to compute componentwise less or equal.</param>
374 /// <returns>bool2 result of the componentwise less or equal.</returns>
375 [MethodImpl(MethodImplOptions.AggressiveInlining)]
376 public static bool2 operator <= (float2 lhs, float rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
377
378 /// <summary>Returns the result of a componentwise less or equal operation on a float value and a float2 vector.</summary>
379 /// <param name="lhs">Left hand side float to use to compute componentwise less or equal.</param>
380 /// <param name="rhs">Right hand side float2 to use to compute componentwise less or equal.</param>
381 /// <returns>bool2 result of the componentwise less or equal.</returns>
382 [MethodImpl(MethodImplOptions.AggressiveInlining)]
383 public static bool2 operator <= (float lhs, float2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
384
385
386 /// <summary>Returns the result of a componentwise greater than operation on two float2 vectors.</summary>
387 /// <param name="lhs">Left hand side float2 to use to compute componentwise greater than.</param>
388 /// <param name="rhs">Right hand side float2 to use to compute componentwise greater than.</param>
389 /// <returns>bool2 result of the componentwise greater than.</returns>
390 [MethodImpl(MethodImplOptions.AggressiveInlining)]
391 public static bool2 operator > (float2 lhs, float2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
392
393 /// <summary>Returns the result of a componentwise greater than operation on a float2 vector and a float value.</summary>
394 /// <param name="lhs">Left hand side float2 to use to compute componentwise greater than.</param>
395 /// <param name="rhs">Right hand side float to use to compute componentwise greater than.</param>
396 /// <returns>bool2 result of the componentwise greater than.</returns>
397 [MethodImpl(MethodImplOptions.AggressiveInlining)]
398 public static bool2 operator > (float2 lhs, float rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
399
400 /// <summary>Returns the result of a componentwise greater than operation on a float value and a float2 vector.</summary>
401 /// <param name="lhs">Left hand side float to use to compute componentwise greater than.</param>
402 /// <param name="rhs">Right hand side float2 to use to compute componentwise greater than.</param>
403 /// <returns>bool2 result of the componentwise greater than.</returns>
404 [MethodImpl(MethodImplOptions.AggressiveInlining)]
405 public static bool2 operator > (float lhs, float2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
406
407
408 /// <summary>Returns the result of a componentwise greater or equal operation on two float2 vectors.</summary>
409 /// <param name="lhs">Left hand side float2 to use to compute componentwise greater or equal.</param>
410 /// <param name="rhs">Right hand side float2 to use to compute componentwise greater or equal.</param>
411 /// <returns>bool2 result of the componentwise greater or equal.</returns>
412 [MethodImpl(MethodImplOptions.AggressiveInlining)]
413 public static bool2 operator >= (float2 lhs, float2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
414
415 /// <summary>Returns the result of a componentwise greater or equal operation on a float2 vector and a float value.</summary>
416 /// <param name="lhs">Left hand side float2 to use to compute componentwise greater or equal.</param>
417 /// <param name="rhs">Right hand side float to use to compute componentwise greater or equal.</param>
418 /// <returns>bool2 result of the componentwise greater or equal.</returns>
419 [MethodImpl(MethodImplOptions.AggressiveInlining)]
420 public static bool2 operator >= (float2 lhs, float rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
421
422 /// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float2 vector.</summary>
423 /// <param name="lhs">Left hand side float to use to compute componentwise greater or equal.</param>
424 /// <param name="rhs">Right hand side float2 to use to compute componentwise greater or equal.</param>
425 /// <returns>bool2 result of the componentwise greater or equal.</returns>
426 [MethodImpl(MethodImplOptions.AggressiveInlining)]
427 public static bool2 operator >= (float lhs, float2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
428
429
430 /// <summary>Returns the result of a componentwise unary minus operation on a float2 vector.</summary>
431 /// <param name="val">Value to use when computing the componentwise unary minus.</param>
432 /// <returns>float2 result of the componentwise unary minus.</returns>
433 [MethodImpl(MethodImplOptions.AggressiveInlining)]
434 public static float2 operator - (float2 val) { return new float2 (-val.x, -val.y); }
435
436
437 /// <summary>Returns the result of a componentwise unary plus operation on a float2 vector.</summary>
438 /// <param name="val">Value to use when computing the componentwise unary plus.</param>
439 /// <returns>float2 result of the componentwise unary plus.</returns>
440 [MethodImpl(MethodImplOptions.AggressiveInlining)]
441 public static float2 operator + (float2 val) { return new float2 (+val.x, +val.y); }
442
443
444 /// <summary>Returns the result of a componentwise equality operation on two float2 vectors.</summary>
445 /// <param name="lhs">Left hand side float2 to use to compute componentwise equality.</param>
446 /// <param name="rhs">Right hand side float2 to use to compute componentwise equality.</param>
447 /// <returns>bool2 result of the componentwise equality.</returns>
448 [MethodImpl(MethodImplOptions.AggressiveInlining)]
449 public static bool2 operator == (float2 lhs, float2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
450
451 /// <summary>Returns the result of a componentwise equality operation on a float2 vector and a float value.</summary>
452 /// <param name="lhs">Left hand side float2 to use to compute componentwise equality.</param>
453 /// <param name="rhs">Right hand side float to use to compute componentwise equality.</param>
454 /// <returns>bool2 result of the componentwise equality.</returns>
455 [MethodImpl(MethodImplOptions.AggressiveInlining)]
456 public static bool2 operator == (float2 lhs, float rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
457
458 /// <summary>Returns the result of a componentwise equality operation on a float value and a float2 vector.</summary>
459 /// <param name="lhs">Left hand side float to use to compute componentwise equality.</param>
460 /// <param name="rhs">Right hand side float2 to use to compute componentwise equality.</param>
461 /// <returns>bool2 result of the componentwise equality.</returns>
462 [MethodImpl(MethodImplOptions.AggressiveInlining)]
463 public static bool2 operator == (float lhs, float2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
464
465
466 /// <summary>Returns the result of a componentwise not equal operation on two float2 vectors.</summary>
467 /// <param name="lhs">Left hand side float2 to use to compute componentwise not equal.</param>
468 /// <param name="rhs">Right hand side float2 to use to compute componentwise not equal.</param>
469 /// <returns>bool2 result of the componentwise not equal.</returns>
470 [MethodImpl(MethodImplOptions.AggressiveInlining)]
471 public static bool2 operator != (float2 lhs, float2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
472
473 /// <summary>Returns the result of a componentwise not equal operation on a float2 vector and a float value.</summary>
474 /// <param name="lhs">Left hand side float2 to use to compute componentwise not equal.</param>
475 /// <param name="rhs">Right hand side float to use to compute componentwise not equal.</param>
476 /// <returns>bool2 result of the componentwise not equal.</returns>
477 [MethodImpl(MethodImplOptions.AggressiveInlining)]
478 public static bool2 operator != (float2 lhs, float rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
479
480 /// <summary>Returns the result of a componentwise not equal operation on a float value and a float2 vector.</summary>
481 /// <param name="lhs">Left hand side float to use to compute componentwise not equal.</param>
482 /// <param name="rhs">Right hand side float2 to use to compute componentwise not equal.</param>
483 /// <returns>bool2 result of the componentwise not equal.</returns>
484 [MethodImpl(MethodImplOptions.AggressiveInlining)]
485 public static bool2 operator != (float lhs, float2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
486
487
488
489
490 /// <summary>Swizzles the vector.</summary>
491 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
492 public float4 xxxx
493 {
494 [MethodImpl(MethodImplOptions.AggressiveInlining)]
495 get { return new float4(x, x, x, x); }
496 }
497
498
499 /// <summary>Swizzles the vector.</summary>
500 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
501 public float4 xxxy
502 {
503 [MethodImpl(MethodImplOptions.AggressiveInlining)]
504 get { return new float4(x, x, x, y); }
505 }
506
507
508 /// <summary>Swizzles the vector.</summary>
509 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
510 public float4 xxyx
511 {
512 [MethodImpl(MethodImplOptions.AggressiveInlining)]
513 get { return new float4(x, x, y, x); }
514 }
515
516
517 /// <summary>Swizzles the vector.</summary>
518 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
519 public float4 xxyy
520 {
521 [MethodImpl(MethodImplOptions.AggressiveInlining)]
522 get { return new float4(x, x, y, y); }
523 }
524
525
526 /// <summary>Swizzles the vector.</summary>
527 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
528 public float4 xyxx
529 {
530 [MethodImpl(MethodImplOptions.AggressiveInlining)]
531 get { return new float4(x, y, x, x); }
532 }
533
534
535 /// <summary>Swizzles the vector.</summary>
536 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
537 public float4 xyxy
538 {
539 [MethodImpl(MethodImplOptions.AggressiveInlining)]
540 get { return new float4(x, y, x, y); }
541 }
542
543
544 /// <summary>Swizzles the vector.</summary>
545 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
546 public float4 xyyx
547 {
548 [MethodImpl(MethodImplOptions.AggressiveInlining)]
549 get { return new float4(x, y, y, x); }
550 }
551
552
553 /// <summary>Swizzles the vector.</summary>
554 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
555 public float4 xyyy
556 {
557 [MethodImpl(MethodImplOptions.AggressiveInlining)]
558 get { return new float4(x, y, y, y); }
559 }
560
561
562 /// <summary>Swizzles the vector.</summary>
563 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
564 public float4 yxxx
565 {
566 [MethodImpl(MethodImplOptions.AggressiveInlining)]
567 get { return new float4(y, x, x, x); }
568 }
569
570
571 /// <summary>Swizzles the vector.</summary>
572 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
573 public float4 yxxy
574 {
575 [MethodImpl(MethodImplOptions.AggressiveInlining)]
576 get { return new float4(y, x, x, y); }
577 }
578
579
580 /// <summary>Swizzles the vector.</summary>
581 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
582 public float4 yxyx
583 {
584 [MethodImpl(MethodImplOptions.AggressiveInlining)]
585 get { return new float4(y, x, y, x); }
586 }
587
588
589 /// <summary>Swizzles the vector.</summary>
590 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
591 public float4 yxyy
592 {
593 [MethodImpl(MethodImplOptions.AggressiveInlining)]
594 get { return new float4(y, x, y, y); }
595 }
596
597
598 /// <summary>Swizzles the vector.</summary>
599 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
600 public float4 yyxx
601 {
602 [MethodImpl(MethodImplOptions.AggressiveInlining)]
603 get { return new float4(y, y, x, x); }
604 }
605
606
607 /// <summary>Swizzles the vector.</summary>
608 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
609 public float4 yyxy
610 {
611 [MethodImpl(MethodImplOptions.AggressiveInlining)]
612 get { return new float4(y, y, x, y); }
613 }
614
615
616 /// <summary>Swizzles the vector.</summary>
617 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
618 public float4 yyyx
619 {
620 [MethodImpl(MethodImplOptions.AggressiveInlining)]
621 get { return new float4(y, y, y, x); }
622 }
623
624
625 /// <summary>Swizzles the vector.</summary>
626 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
627 public float4 yyyy
628 {
629 [MethodImpl(MethodImplOptions.AggressiveInlining)]
630 get { return new float4(y, y, y, y); }
631 }
632
633
634 /// <summary>Swizzles the vector.</summary>
635 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
636 public float3 xxx
637 {
638 [MethodImpl(MethodImplOptions.AggressiveInlining)]
639 get { return new float3(x, x, x); }
640 }
641
642
643 /// <summary>Swizzles the vector.</summary>
644 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
645 public float3 xxy
646 {
647 [MethodImpl(MethodImplOptions.AggressiveInlining)]
648 get { return new float3(x, x, y); }
649 }
650
651
652 /// <summary>Swizzles the vector.</summary>
653 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
654 public float3 xyx
655 {
656 [MethodImpl(MethodImplOptions.AggressiveInlining)]
657 get { return new float3(x, y, x); }
658 }
659
660
661 /// <summary>Swizzles the vector.</summary>
662 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
663 public float3 xyy
664 {
665 [MethodImpl(MethodImplOptions.AggressiveInlining)]
666 get { return new float3(x, y, y); }
667 }
668
669
670 /// <summary>Swizzles the vector.</summary>
671 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
672 public float3 yxx
673 {
674 [MethodImpl(MethodImplOptions.AggressiveInlining)]
675 get { return new float3(y, x, x); }
676 }
677
678
679 /// <summary>Swizzles the vector.</summary>
680 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
681 public float3 yxy
682 {
683 [MethodImpl(MethodImplOptions.AggressiveInlining)]
684 get { return new float3(y, x, y); }
685 }
686
687
688 /// <summary>Swizzles the vector.</summary>
689 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
690 public float3 yyx
691 {
692 [MethodImpl(MethodImplOptions.AggressiveInlining)]
693 get { return new float3(y, y, x); }
694 }
695
696
697 /// <summary>Swizzles the vector.</summary>
698 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
699 public float3 yyy
700 {
701 [MethodImpl(MethodImplOptions.AggressiveInlining)]
702 get { return new float3(y, y, y); }
703 }
704
705
706 /// <summary>Swizzles the vector.</summary>
707 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
708 public float2 xx
709 {
710 [MethodImpl(MethodImplOptions.AggressiveInlining)]
711 get { return new float2(x, x); }
712 }
713
714
715 /// <summary>Swizzles the vector.</summary>
716 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
717 public float2 xy
718 {
719 [MethodImpl(MethodImplOptions.AggressiveInlining)]
720 get { return new float2(x, y); }
721 [MethodImpl(MethodImplOptions.AggressiveInlining)]
722 set { x = value.x; y = value.y; }
723 }
724
725
726 /// <summary>Swizzles the vector.</summary>
727 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
728 public float2 yx
729 {
730 [MethodImpl(MethodImplOptions.AggressiveInlining)]
731 get { return new float2(y, x); }
732 [MethodImpl(MethodImplOptions.AggressiveInlining)]
733 set { y = value.x; x = value.y; }
734 }
735
736
737 /// <summary>Swizzles the vector.</summary>
738 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
739 public float2 yy
740 {
741 [MethodImpl(MethodImplOptions.AggressiveInlining)]
742 get { return new float2(y, y); }
743 }
744
745
746
747 /// <summary>Returns the float element at a specified index.</summary>
748 unsafe public float this[int index]
749 {
750 get
751 {
752#if ENABLE_UNITY_COLLECTIONS_CHECKS
753 if ((uint)index >= 2)
754 throw new System.ArgumentException("index must be between[0...1]");
755#endif
756 fixed (float2* array = &this) { return ((float*)array)[index]; }
757 }
758 set
759 {
760#if ENABLE_UNITY_COLLECTIONS_CHECKS
761 if ((uint)index >= 2)
762 throw new System.ArgumentException("index must be between[0...1]");
763#endif
764 fixed (float* array = &x) { array[index] = value; }
765 }
766 }
767
768 /// <summary>Returns true if the float2 is equal to a given float2, false otherwise.</summary>
769 /// <param name="rhs">Right hand side argument to compare equality with.</param>
770 /// <returns>The result of the equality comparison.</returns>
771 [MethodImpl(MethodImplOptions.AggressiveInlining)]
772 public bool Equals(float2 rhs) { return x == rhs.x && y == rhs.y; }
773
774 /// <summary>Returns true if the float2 is equal to a given float2, false otherwise.</summary>
775 /// <param name="o">Right hand side argument to compare equality with.</param>
776 /// <returns>The result of the equality comparison.</returns>
777 public override bool Equals(object o) { return o is float2 converted && Equals(converted); }
778
779
780 /// <summary>Returns a hash code for the float2.</summary>
781 /// <returns>The computed hash code.</returns>
782 [MethodImpl(MethodImplOptions.AggressiveInlining)]
783 public override int GetHashCode() { return (int)math.hash(this); }
784
785
786 /// <summary>Returns a string representation of the float2.</summary>
787 /// <returns>String representation of the value.</returns>
788 [MethodImpl(MethodImplOptions.AggressiveInlining)]
789 public override string ToString()
790 {
791 return string.Format("float2({0}f, {1}f)", x, y);
792 }
793
794 /// <summary>Returns a string representation of the float2 using a specified format and culture-specific format information.</summary>
795 /// <param name="format">Format string to use during string formatting.</param>
796 /// <param name="formatProvider">Format provider to use during string formatting.</param>
797 /// <returns>String representation of the value.</returns>
798 [MethodImpl(MethodImplOptions.AggressiveInlining)]
799 public string ToString(string format, IFormatProvider formatProvider)
800 {
801 return string.Format("float2({0}f, {1}f)", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
802 }
803
804 internal sealed class DebuggerProxy
805 {
806 public float x;
807 public float y;
808 public DebuggerProxy(float2 v)
809 {
810 x = v.x;
811 y = v.y;
812 }
813 }
814
815 }
816
817 public static partial class math
818 {
819 /// <summary>Returns a float2 vector constructed from two float values.</summary>
820 /// <param name="x">The constructed vector's x component will be set to this value.</param>
821 /// <param name="y">The constructed vector's y component will be set to this value.</param>
822 /// <returns>float2 constructed from arguments.</returns>
823 [MethodImpl(MethodImplOptions.AggressiveInlining)]
824 public static float2 float2(float x, float y) { return new float2(x, y); }
825
826 /// <summary>Returns a float2 vector constructed from a float2 vector.</summary>
827 /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
828 /// <returns>float2 constructed from arguments.</returns>
829 [MethodImpl(MethodImplOptions.AggressiveInlining)]
830 public static float2 float2(float2 xy) { return new float2(xy); }
831
832 /// <summary>Returns a float2 vector constructed from a single float value by assigning it to every component.</summary>
833 /// <param name="v">float to convert to float2</param>
834 /// <returns>Converted value.</returns>
835 [MethodImpl(MethodImplOptions.AggressiveInlining)]
836 public static float2 float2(float v) { return new float2(v); }
837
838 /// <summary>Returns a float2 vector constructed from a single bool value by converting it to float and assigning it to every component.</summary>
839 /// <param name="v">bool to convert to float2</param>
840 /// <returns>Converted value.</returns>
841 [MethodImpl(MethodImplOptions.AggressiveInlining)]
842 public static float2 float2(bool v) { return new float2(v); }
843
844 /// <summary>Return a float2 vector constructed from a bool2 vector by componentwise conversion.</summary>
845 /// <param name="v">bool2 to convert to float2</param>
846 /// <returns>Converted value.</returns>
847 [MethodImpl(MethodImplOptions.AggressiveInlining)]
848 public static float2 float2(bool2 v) { return new float2(v); }
849
850 /// <summary>Returns a float2 vector constructed from a single int value by converting it to float and assigning it to every component.</summary>
851 /// <param name="v">int to convert to float2</param>
852 /// <returns>Converted value.</returns>
853 [MethodImpl(MethodImplOptions.AggressiveInlining)]
854 public static float2 float2(int v) { return new float2(v); }
855
856 /// <summary>Return a float2 vector constructed from a int2 vector by componentwise conversion.</summary>
857 /// <param name="v">int2 to convert to float2</param>
858 /// <returns>Converted value.</returns>
859 [MethodImpl(MethodImplOptions.AggressiveInlining)]
860 public static float2 float2(int2 v) { return new float2(v); }
861
862 /// <summary>Returns a float2 vector constructed from a single uint value by converting it to float and assigning it to every component.</summary>
863 /// <param name="v">uint to convert to float2</param>
864 /// <returns>Converted value.</returns>
865 [MethodImpl(MethodImplOptions.AggressiveInlining)]
866 public static float2 float2(uint v) { return new float2(v); }
867
868 /// <summary>Return a float2 vector constructed from a uint2 vector by componentwise conversion.</summary>
869 /// <param name="v">uint2 to convert to float2</param>
870 /// <returns>Converted value.</returns>
871 [MethodImpl(MethodImplOptions.AggressiveInlining)]
872 public static float2 float2(uint2 v) { return new float2(v); }
873
874 /// <summary>Returns a float2 vector constructed from a single half value by converting it to float and assigning it to every component.</summary>
875 /// <param name="v">half to convert to float2</param>
876 /// <returns>Converted value.</returns>
877 [MethodImpl(MethodImplOptions.AggressiveInlining)]
878 public static float2 float2(half v) { return new float2(v); }
879
880 /// <summary>Return a float2 vector constructed from a half2 vector by componentwise conversion.</summary>
881 /// <param name="v">half2 to convert to float2</param>
882 /// <returns>Converted value.</returns>
883 [MethodImpl(MethodImplOptions.AggressiveInlining)]
884 public static float2 float2(half2 v) { return new float2(v); }
885
886 /// <summary>Returns a float2 vector constructed from a single double value by converting it to float and assigning it to every component.</summary>
887 /// <param name="v">double to convert to float2</param>
888 /// <returns>Converted value.</returns>
889 [MethodImpl(MethodImplOptions.AggressiveInlining)]
890 public static float2 float2(double v) { return new float2(v); }
891
892 /// <summary>Return a float2 vector constructed from a double2 vector by componentwise conversion.</summary>
893 /// <param name="v">double2 to convert to float2</param>
894 /// <returns>Converted value.</returns>
895 [MethodImpl(MethodImplOptions.AggressiveInlining)]
896 public static float2 float2(double2 v) { return new float2(v); }
897
898 /// <summary>Returns a uint hash code of a float2 vector.</summary>
899 /// <param name="v">Vector value to hash.</param>
900 /// <returns>uint hash of the argument.</returns>
901 [MethodImpl(MethodImplOptions.AggressiveInlining)]
902 public static uint hash(float2 v)
903 {
904 return csum(asuint(v) * uint2(0xFA3A3285u, 0xAD55999Du)) + 0xDCDD5341u;
905 }
906
907 /// <summary>
908 /// Returns a uint2 vector hash code of a float2 vector.
909 /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
910 /// that are only reduced to a narrow uint hash at the very end instead of at every step.
911 /// </summary>
912 /// <param name="v">Vector value to hash.</param>
913 /// <returns>uint2 hash of the argument.</returns>
914 [MethodImpl(MethodImplOptions.AggressiveInlining)]
915 public static uint2 hashwide(float2 v)
916 {
917 return (asuint(v) * uint2(0x94DDD769u, 0xA1E92D39u)) + 0x4583C801u;
918 }
919
920 /// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float value.</summary>
921 /// <param name="left">float2 to use as the left argument of the shuffle operation.</param>
922 /// <param name="right">float2 to use as the right argument of the shuffle operation.</param>
923 /// <param name="x">The ShuffleComponent to use when setting the resulting float.</param>
924 /// <returns>float result of the shuffle operation.</returns>
925 [MethodImpl(MethodImplOptions.AggressiveInlining)]
926 public static float shuffle(float2 left, float2 right, ShuffleComponent x)
927 {
928 return select_shuffle_component(left, right, x);
929 }
930
931 /// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float2 vector.</summary>
932 /// <param name="left">float2 to use as the left argument of the shuffle operation.</param>
933 /// <param name="right">float2 to use as the right argument of the shuffle operation.</param>
934 /// <param name="x">The ShuffleComponent to use when setting the resulting float2 x component.</param>
935 /// <param name="y">The ShuffleComponent to use when setting the resulting float2 y component.</param>
936 /// <returns>float2 result of the shuffle operation.</returns>
937 [MethodImpl(MethodImplOptions.AggressiveInlining)]
938 public static float2 shuffle(float2 left, float2 right, ShuffleComponent x, ShuffleComponent y)
939 {
940 return float2(
941 select_shuffle_component(left, right, x),
942 select_shuffle_component(left, right, y));
943 }
944
945 /// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float3 vector.</summary>
946 /// <param name="left">float2 to use as the left argument of the shuffle operation.</param>
947 /// <param name="right">float2 to use as the right argument of the shuffle operation.</param>
948 /// <param name="x">The ShuffleComponent to use when setting the resulting float3 x component.</param>
949 /// <param name="y">The ShuffleComponent to use when setting the resulting float3 y component.</param>
950 /// <param name="z">The ShuffleComponent to use when setting the resulting float3 z component.</param>
951 /// <returns>float3 result of the shuffle operation.</returns>
952 [MethodImpl(MethodImplOptions.AggressiveInlining)]
953 public static float3 shuffle(float2 left, float2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
954 {
955 return float3(
956 select_shuffle_component(left, right, x),
957 select_shuffle_component(left, right, y),
958 select_shuffle_component(left, right, z));
959 }
960
961 /// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float4 vector.</summary>
962 /// <param name="left">float2 to use as the left argument of the shuffle operation.</param>
963 /// <param name="right">float2 to use as the right argument of the shuffle operation.</param>
964 /// <param name="x">The ShuffleComponent to use when setting the resulting float4 x component.</param>
965 /// <param name="y">The ShuffleComponent to use when setting the resulting float4 y component.</param>
966 /// <param name="z">The ShuffleComponent to use when setting the resulting float4 z component.</param>
967 /// <param name="w">The ShuffleComponent to use when setting the resulting float4 w component.</param>
968 /// <returns>float4 result of the shuffle operation.</returns>
969 [MethodImpl(MethodImplOptions.AggressiveInlining)]
970 public static float4 shuffle(float2 left, float2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
971 {
972 return float4(
973 select_shuffle_component(left, right, x),
974 select_shuffle_component(left, right, y),
975 select_shuffle_component(left, right, z),
976 select_shuffle_component(left, right, w));
977 }
978
979 [MethodImpl(MethodImplOptions.AggressiveInlining)]
980 internal static float select_shuffle_component(float2 a, float2 b, ShuffleComponent component)
981 {
982 switch(component)
983 {
984 case ShuffleComponent.LeftX:
985 return a.x;
986 case ShuffleComponent.LeftY:
987 return a.y;
988 case ShuffleComponent.RightX:
989 return b.x;
990 case ShuffleComponent.RightY:
991 return b.y;
992 default:
993 throw new System.ArgumentException("Invalid shuffle component: " + component);
994 }
995 }
996
997 }
998}