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 halfs.</summary>
19 [DebuggerTypeProxy(typeof(half2.DebuggerProxy))]
20 [System.Serializable]
21 [Il2CppEagerStaticClassConstruction]
22 public partial struct half2 : System.IEquatable<half2>, IFormattable
23 {
24 /// <summary>x component of the vector.</summary>
25 public half x;
26 /// <summary>y component of the vector.</summary>
27 public half y;
28
29 /// <summary>half2 zero value.</summary>
30 public static readonly half2 zero;
31
32 /// <summary>Constructs a half2 vector from two half 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 half2(half x, half y)
37 {
38 this.x = x;
39 this.y = y;
40 }
41
42 /// <summary>Constructs a half2 vector from a half2 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 half2(half2 xy)
46 {
47 this.x = xy.x;
48 this.y = xy.y;
49 }
50
51 /// <summary>Constructs a half2 vector from a single half value by assigning it to every component.</summary>
52 /// <param name="v">half to convert to half2</param>
53 [MethodImpl(MethodImplOptions.AggressiveInlining)]
54 public half2(half v)
55 {
56 this.x = v;
57 this.y = v;
58 }
59
60 /// <summary>Constructs a half2 vector from a single float value by converting it to half and assigning it to every component.</summary>
61 /// <param name="v">float to convert to half2</param>
62 [MethodImpl(MethodImplOptions.AggressiveInlining)]
63 public half2(float v)
64 {
65 this.x = (half)v;
66 this.y = (half)v;
67 }
68
69 /// <summary>Constructs a half2 vector from a float2 vector by componentwise conversion.</summary>
70 /// <param name="v">float2 to convert to half2</param>
71 [MethodImpl(MethodImplOptions.AggressiveInlining)]
72 public half2(float2 v)
73 {
74 this.x = (half)v.x;
75 this.y = (half)v.y;
76 }
77
78 /// <summary>Constructs a half2 vector from a single double value by converting it to half and assigning it to every component.</summary>
79 /// <param name="v">double to convert to half2</param>
80 [MethodImpl(MethodImplOptions.AggressiveInlining)]
81 public half2(double v)
82 {
83 this.x = (half)v;
84 this.y = (half)v;
85 }
86
87 /// <summary>Constructs a half2 vector from a double2 vector by componentwise conversion.</summary>
88 /// <param name="v">double2 to convert to half2</param>
89 [MethodImpl(MethodImplOptions.AggressiveInlining)]
90 public half2(double2 v)
91 {
92 this.x = (half)v.x;
93 this.y = (half)v.y;
94 }
95
96
97 /// <summary>Implicitly converts a single half value to a half2 vector by assigning it to every component.</summary>
98 /// <param name="v">half to convert to half2</param>
99 /// <returns>Converted value.</returns>
100 [MethodImpl(MethodImplOptions.AggressiveInlining)]
101 public static implicit operator half2(half v) { return new half2(v); }
102
103 /// <summary>Explicitly converts a single float value to a half2 vector by converting it to half and assigning it to every component.</summary>
104 /// <param name="v">float to convert to half2</param>
105 /// <returns>Converted value.</returns>
106 [MethodImpl(MethodImplOptions.AggressiveInlining)]
107 public static explicit operator half2(float v) { return new half2(v); }
108
109 /// <summary>Explicitly converts a float2 vector to a half2 vector by componentwise conversion.</summary>
110 /// <param name="v">float2 to convert to half2</param>
111 /// <returns>Converted value.</returns>
112 [MethodImpl(MethodImplOptions.AggressiveInlining)]
113 public static explicit operator half2(float2 v) { return new half2(v); }
114
115 /// <summary>Explicitly converts a single double value to a half2 vector by converting it to half and assigning it to every component.</summary>
116 /// <param name="v">double to convert to half2</param>
117 /// <returns>Converted value.</returns>
118 [MethodImpl(MethodImplOptions.AggressiveInlining)]
119 public static explicit operator half2(double v) { return new half2(v); }
120
121 /// <summary>Explicitly converts a double2 vector to a half2 vector by componentwise conversion.</summary>
122 /// <param name="v">double2 to convert to half2</param>
123 /// <returns>Converted value.</returns>
124 [MethodImpl(MethodImplOptions.AggressiveInlining)]
125 public static explicit operator half2(double2 v) { return new half2(v); }
126
127
128 /// <summary>Returns the result of a componentwise equality operation on two half2 vectors.</summary>
129 /// <param name="lhs">Left hand side half2 to use to compute componentwise equality.</param>
130 /// <param name="rhs">Right hand side half2 to use to compute componentwise equality.</param>
131 /// <returns>bool2 result of the componentwise equality.</returns>
132 [MethodImpl(MethodImplOptions.AggressiveInlining)]
133 public static bool2 operator == (half2 lhs, half2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
134
135 /// <summary>Returns the result of a componentwise equality operation on a half2 vector and a half value.</summary>
136 /// <param name="lhs">Left hand side half2 to use to compute componentwise equality.</param>
137 /// <param name="rhs">Right hand side half to use to compute componentwise equality.</param>
138 /// <returns>bool2 result of the componentwise equality.</returns>
139 [MethodImpl(MethodImplOptions.AggressiveInlining)]
140 public static bool2 operator == (half2 lhs, half rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
141
142 /// <summary>Returns the result of a componentwise equality operation on a half value and a half2 vector.</summary>
143 /// <param name="lhs">Left hand side half to use to compute componentwise equality.</param>
144 /// <param name="rhs">Right hand side half2 to use to compute componentwise equality.</param>
145 /// <returns>bool2 result of the componentwise equality.</returns>
146 [MethodImpl(MethodImplOptions.AggressiveInlining)]
147 public static bool2 operator == (half lhs, half2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
148
149
150 /// <summary>Returns the result of a componentwise not equal operation on two half2 vectors.</summary>
151 /// <param name="lhs">Left hand side half2 to use to compute componentwise not equal.</param>
152 /// <param name="rhs">Right hand side half2 to use to compute componentwise not equal.</param>
153 /// <returns>bool2 result of the componentwise not equal.</returns>
154 [MethodImpl(MethodImplOptions.AggressiveInlining)]
155 public static bool2 operator != (half2 lhs, half2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
156
157 /// <summary>Returns the result of a componentwise not equal operation on a half2 vector and a half value.</summary>
158 /// <param name="lhs">Left hand side half2 to use to compute componentwise not equal.</param>
159 /// <param name="rhs">Right hand side half to use to compute componentwise not equal.</param>
160 /// <returns>bool2 result of the componentwise not equal.</returns>
161 [MethodImpl(MethodImplOptions.AggressiveInlining)]
162 public static bool2 operator != (half2 lhs, half rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
163
164 /// <summary>Returns the result of a componentwise not equal operation on a half value and a half2 vector.</summary>
165 /// <param name="lhs">Left hand side half to use to compute componentwise not equal.</param>
166 /// <param name="rhs">Right hand side half2 to use to compute componentwise not equal.</param>
167 /// <returns>bool2 result of the componentwise not equal.</returns>
168 [MethodImpl(MethodImplOptions.AggressiveInlining)]
169 public static bool2 operator != (half lhs, half2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
170
171
172
173
174 /// <summary>Swizzles the vector.</summary>
175 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
176 public half4 xxxx
177 {
178 [MethodImpl(MethodImplOptions.AggressiveInlining)]
179 get { return new half4(x, x, x, x); }
180 }
181
182
183 /// <summary>Swizzles the vector.</summary>
184 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
185 public half4 xxxy
186 {
187 [MethodImpl(MethodImplOptions.AggressiveInlining)]
188 get { return new half4(x, x, x, y); }
189 }
190
191
192 /// <summary>Swizzles the vector.</summary>
193 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
194 public half4 xxyx
195 {
196 [MethodImpl(MethodImplOptions.AggressiveInlining)]
197 get { return new half4(x, x, y, x); }
198 }
199
200
201 /// <summary>Swizzles the vector.</summary>
202 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
203 public half4 xxyy
204 {
205 [MethodImpl(MethodImplOptions.AggressiveInlining)]
206 get { return new half4(x, x, y, y); }
207 }
208
209
210 /// <summary>Swizzles the vector.</summary>
211 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
212 public half4 xyxx
213 {
214 [MethodImpl(MethodImplOptions.AggressiveInlining)]
215 get { return new half4(x, y, x, x); }
216 }
217
218
219 /// <summary>Swizzles the vector.</summary>
220 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
221 public half4 xyxy
222 {
223 [MethodImpl(MethodImplOptions.AggressiveInlining)]
224 get { return new half4(x, y, x, y); }
225 }
226
227
228 /// <summary>Swizzles the vector.</summary>
229 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
230 public half4 xyyx
231 {
232 [MethodImpl(MethodImplOptions.AggressiveInlining)]
233 get { return new half4(x, y, y, x); }
234 }
235
236
237 /// <summary>Swizzles the vector.</summary>
238 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
239 public half4 xyyy
240 {
241 [MethodImpl(MethodImplOptions.AggressiveInlining)]
242 get { return new half4(x, y, y, y); }
243 }
244
245
246 /// <summary>Swizzles the vector.</summary>
247 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
248 public half4 yxxx
249 {
250 [MethodImpl(MethodImplOptions.AggressiveInlining)]
251 get { return new half4(y, x, x, x); }
252 }
253
254
255 /// <summary>Swizzles the vector.</summary>
256 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
257 public half4 yxxy
258 {
259 [MethodImpl(MethodImplOptions.AggressiveInlining)]
260 get { return new half4(y, x, x, y); }
261 }
262
263
264 /// <summary>Swizzles the vector.</summary>
265 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
266 public half4 yxyx
267 {
268 [MethodImpl(MethodImplOptions.AggressiveInlining)]
269 get { return new half4(y, x, y, x); }
270 }
271
272
273 /// <summary>Swizzles the vector.</summary>
274 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
275 public half4 yxyy
276 {
277 [MethodImpl(MethodImplOptions.AggressiveInlining)]
278 get { return new half4(y, x, y, y); }
279 }
280
281
282 /// <summary>Swizzles the vector.</summary>
283 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
284 public half4 yyxx
285 {
286 [MethodImpl(MethodImplOptions.AggressiveInlining)]
287 get { return new half4(y, y, x, x); }
288 }
289
290
291 /// <summary>Swizzles the vector.</summary>
292 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
293 public half4 yyxy
294 {
295 [MethodImpl(MethodImplOptions.AggressiveInlining)]
296 get { return new half4(y, y, x, y); }
297 }
298
299
300 /// <summary>Swizzles the vector.</summary>
301 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
302 public half4 yyyx
303 {
304 [MethodImpl(MethodImplOptions.AggressiveInlining)]
305 get { return new half4(y, y, y, x); }
306 }
307
308
309 /// <summary>Swizzles the vector.</summary>
310 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
311 public half4 yyyy
312 {
313 [MethodImpl(MethodImplOptions.AggressiveInlining)]
314 get { return new half4(y, y, y, y); }
315 }
316
317
318 /// <summary>Swizzles the vector.</summary>
319 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
320 public half3 xxx
321 {
322 [MethodImpl(MethodImplOptions.AggressiveInlining)]
323 get { return new half3(x, x, x); }
324 }
325
326
327 /// <summary>Swizzles the vector.</summary>
328 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
329 public half3 xxy
330 {
331 [MethodImpl(MethodImplOptions.AggressiveInlining)]
332 get { return new half3(x, x, y); }
333 }
334
335
336 /// <summary>Swizzles the vector.</summary>
337 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
338 public half3 xyx
339 {
340 [MethodImpl(MethodImplOptions.AggressiveInlining)]
341 get { return new half3(x, y, x); }
342 }
343
344
345 /// <summary>Swizzles the vector.</summary>
346 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
347 public half3 xyy
348 {
349 [MethodImpl(MethodImplOptions.AggressiveInlining)]
350 get { return new half3(x, y, y); }
351 }
352
353
354 /// <summary>Swizzles the vector.</summary>
355 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
356 public half3 yxx
357 {
358 [MethodImpl(MethodImplOptions.AggressiveInlining)]
359 get { return new half3(y, x, x); }
360 }
361
362
363 /// <summary>Swizzles the vector.</summary>
364 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
365 public half3 yxy
366 {
367 [MethodImpl(MethodImplOptions.AggressiveInlining)]
368 get { return new half3(y, x, y); }
369 }
370
371
372 /// <summary>Swizzles the vector.</summary>
373 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
374 public half3 yyx
375 {
376 [MethodImpl(MethodImplOptions.AggressiveInlining)]
377 get { return new half3(y, y, x); }
378 }
379
380
381 /// <summary>Swizzles the vector.</summary>
382 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
383 public half3 yyy
384 {
385 [MethodImpl(MethodImplOptions.AggressiveInlining)]
386 get { return new half3(y, y, y); }
387 }
388
389
390 /// <summary>Swizzles the vector.</summary>
391 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
392 public half2 xx
393 {
394 [MethodImpl(MethodImplOptions.AggressiveInlining)]
395 get { return new half2(x, x); }
396 }
397
398
399 /// <summary>Swizzles the vector.</summary>
400 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
401 public half2 xy
402 {
403 [MethodImpl(MethodImplOptions.AggressiveInlining)]
404 get { return new half2(x, y); }
405 [MethodImpl(MethodImplOptions.AggressiveInlining)]
406 set { x = value.x; y = value.y; }
407 }
408
409
410 /// <summary>Swizzles the vector.</summary>
411 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
412 public half2 yx
413 {
414 [MethodImpl(MethodImplOptions.AggressiveInlining)]
415 get { return new half2(y, x); }
416 [MethodImpl(MethodImplOptions.AggressiveInlining)]
417 set { y = value.x; x = value.y; }
418 }
419
420
421 /// <summary>Swizzles the vector.</summary>
422 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
423 public half2 yy
424 {
425 [MethodImpl(MethodImplOptions.AggressiveInlining)]
426 get { return new half2(y, y); }
427 }
428
429
430
431 /// <summary>Returns the half element at a specified index.</summary>
432 unsafe public half this[int index]
433 {
434 get
435 {
436#if ENABLE_UNITY_COLLECTIONS_CHECKS
437 if ((uint)index >= 2)
438 throw new System.ArgumentException("index must be between[0...1]");
439#endif
440 fixed (half2* array = &this) { return ((half*)array)[index]; }
441 }
442 set
443 {
444#if ENABLE_UNITY_COLLECTIONS_CHECKS
445 if ((uint)index >= 2)
446 throw new System.ArgumentException("index must be between[0...1]");
447#endif
448 fixed (half* array = &x) { array[index] = value; }
449 }
450 }
451
452 /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
453 /// <param name="rhs">Right hand side argument to compare equality with.</param>
454 /// <returns>The result of the equality comparison.</returns>
455 [MethodImpl(MethodImplOptions.AggressiveInlining)]
456 public bool Equals(half2 rhs) { return x == rhs.x && y == rhs.y; }
457
458 /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
459 /// <param name="o">Right hand side argument to compare equality with.</param>
460 /// <returns>The result of the equality comparison.</returns>
461 public override bool Equals(object o) { return o is half2 converted && Equals(converted); }
462
463
464 /// <summary>Returns a hash code for the half2.</summary>
465 /// <returns>The computed hash code.</returns>
466 [MethodImpl(MethodImplOptions.AggressiveInlining)]
467 public override int GetHashCode() { return (int)math.hash(this); }
468
469
470 /// <summary>Returns a string representation of the half2.</summary>
471 /// <returns>String representation of the value.</returns>
472 [MethodImpl(MethodImplOptions.AggressiveInlining)]
473 public override string ToString()
474 {
475 return string.Format("half2({0}, {1})", x, y);
476 }
477
478 /// <summary>Returns a string representation of the half2 using a specified format and culture-specific format information.</summary>
479 /// <param name="format">Format string to use during string formatting.</param>
480 /// <param name="formatProvider">Format provider to use during string formatting.</param>
481 /// <returns>String representation of the value.</returns>
482 [MethodImpl(MethodImplOptions.AggressiveInlining)]
483 public string ToString(string format, IFormatProvider formatProvider)
484 {
485 return string.Format("half2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
486 }
487
488 internal sealed class DebuggerProxy
489 {
490 public half x;
491 public half y;
492 public DebuggerProxy(half2 v)
493 {
494 x = v.x;
495 y = v.y;
496 }
497 }
498
499 }
500
501 public static partial class math
502 {
503 /// <summary>Returns a half2 vector constructed from two half values.</summary>
504 /// <param name="x">The constructed vector's x component will be set to this value.</param>
505 /// <param name="y">The constructed vector's y component will be set to this value.</param>
506 /// <returns>half2 constructed from arguments.</returns>
507 [MethodImpl(MethodImplOptions.AggressiveInlining)]
508 public static half2 half2(half x, half y) { return new half2(x, y); }
509
510 /// <summary>Returns a half2 vector constructed from a half2 vector.</summary>
511 /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
512 /// <returns>half2 constructed from arguments.</returns>
513 [MethodImpl(MethodImplOptions.AggressiveInlining)]
514 public static half2 half2(half2 xy) { return new half2(xy); }
515
516 /// <summary>Returns a half2 vector constructed from a single half value by assigning it to every component.</summary>
517 /// <param name="v">half to convert to half2</param>
518 /// <returns>Converted value.</returns>
519 [MethodImpl(MethodImplOptions.AggressiveInlining)]
520 public static half2 half2(half v) { return new half2(v); }
521
522 /// <summary>Returns a half2 vector constructed from a single float value by converting it to half and assigning it to every component.</summary>
523 /// <param name="v">float to convert to half2</param>
524 /// <returns>Converted value.</returns>
525 [MethodImpl(MethodImplOptions.AggressiveInlining)]
526 public static half2 half2(float v) { return new half2(v); }
527
528 /// <summary>Return a half2 vector constructed from a float2 vector by componentwise conversion.</summary>
529 /// <param name="v">float2 to convert to half2</param>
530 /// <returns>Converted value.</returns>
531 [MethodImpl(MethodImplOptions.AggressiveInlining)]
532 public static half2 half2(float2 v) { return new half2(v); }
533
534 /// <summary>Returns a half2 vector constructed from a single double value by converting it to half and assigning it to every component.</summary>
535 /// <param name="v">double to convert to half2</param>
536 /// <returns>Converted value.</returns>
537 [MethodImpl(MethodImplOptions.AggressiveInlining)]
538 public static half2 half2(double v) { return new half2(v); }
539
540 /// <summary>Return a half2 vector constructed from a double2 vector by componentwise conversion.</summary>
541 /// <param name="v">double2 to convert to half2</param>
542 /// <returns>Converted value.</returns>
543 [MethodImpl(MethodImplOptions.AggressiveInlining)]
544 public static half2 half2(double2 v) { return new half2(v); }
545
546 /// <summary>Returns a uint hash code of a half2 vector.</summary>
547 /// <param name="v">Vector value to hash.</param>
548 /// <returns>uint hash of the argument.</returns>
549 [MethodImpl(MethodImplOptions.AggressiveInlining)]
550 public static uint hash(half2 v)
551 {
552 return csum(uint2(v.x.value, v.y.value) * uint2(0x6E624EB7u, 0x7383ED49u)) + 0xDD49C23Bu;
553 }
554
555 /// <summary>
556 /// Returns a uint2 vector hash code of a half2 vector.
557 /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
558 /// that are only reduced to a narrow uint hash at the very end instead of at every step.
559 /// </summary>
560 /// <param name="v">Vector value to hash.</param>
561 /// <returns>uint2 hash of the argument.</returns>
562 [MethodImpl(MethodImplOptions.AggressiveInlining)]
563 public static uint2 hashwide(half2 v)
564 {
565 return (uint2(v.x.value, v.y.value) * uint2(0xEBD0D005u, 0x91475DF7u)) + 0x55E84827u;
566 }
567
568 }
569}