A game about forced loneliness, made by TACStudios
at master 93 lines 3.5 kB view raw
1#if !UNITY_DOTSPLAYER 2using UnityEngine; 3 4#pragma warning disable 0660, 0661 5 6namespace Unity.Mathematics 7{ 8 public partial struct float2 9 { 10 /// <summary> 11 /// Converts a float2 to Vector2. 12 /// </summary> 13 /// <param name="v">float2 to convert.</param> 14 /// <returns>The converted Vector2.</returns> 15 public static implicit operator Vector2(float2 v) { return new Vector2(v.x, v.y); } 16 17 /// <summary> 18 /// Converts a Vector2 to float2. 19 /// </summary> 20 /// <param name="v">Vector2 to convert.</param> 21 /// <returns>The converted float2.</returns> 22 public static implicit operator float2(Vector2 v) { return new float2(v.x, v.y); } 23 } 24 25 public partial struct float3 26 { 27 /// <summary> 28 /// Converts a float3 to Vector3. 29 /// </summary> 30 /// <param name="v">float3 to convert.</param> 31 /// <returns>The converted Vector3.</returns> 32 public static implicit operator Vector3(float3 v) { return new Vector3(v.x, v.y, v.z); } 33 34 /// <summary> 35 /// Converts a Vector3 to float3. 36 /// </summary> 37 /// <param name="v">Vector3 to convert.</param> 38 /// <returns>The converted float3.</returns> 39 public static implicit operator float3(Vector3 v) { return new float3(v.x, v.y, v.z); } 40 } 41 42 public partial struct float4 43 { 44 /// <summary> 45 /// Converts a Vector4 to float4. 46 /// </summary> 47 /// <param name="v">Vector4 to convert.</param> 48 /// <returns>The converted float4.</returns> 49 public static implicit operator float4(Vector4 v) { return new float4(v.x, v.y, v.z, v.w); } 50 51 /// <summary> 52 /// Converts a float4 to Vector4. 53 /// </summary> 54 /// <param name="v">float4 to convert.</param> 55 /// <returns>The converted Vector4.</returns> 56 public static implicit operator Vector4(float4 v) { return new Vector4(v.x, v.y, v.z, v.w); } 57 } 58 59 public partial struct quaternion 60 { 61 /// <summary> 62 /// Converts a quaternion to Quaternion. 63 /// </summary> 64 /// <param name="q">quaternion to convert.</param> 65 /// <returns>The converted Quaternion.</returns> 66 public static implicit operator Quaternion(quaternion q) { return new Quaternion(q.value.x, q.value.y, q.value.z, q.value.w); } 67 68 /// <summary> 69 /// Converts a Quaternion to quaternion. 70 /// </summary> 71 /// <param name="q">Quaternion to convert.</param> 72 /// <returns>The converted quaternion.</returns> 73 public static implicit operator quaternion(Quaternion q) { return new quaternion(q.x, q.y, q.z, q.w); } 74 } 75 76 public partial struct float4x4 77 { 78 /// <summary> 79 /// Converts a Matrix4x4 to float4x4. 80 /// </summary> 81 /// <param name="m">Matrix4x4 to convert.</param> 82 /// <returns>The converted float4x4.</returns> 83 public static implicit operator float4x4(Matrix4x4 m) { return new float4x4(m.GetColumn(0), m.GetColumn(1), m.GetColumn(2), m.GetColumn(3)); } 84 85 /// <summary> 86 /// Converts a float4x4 to Matrix4x4. 87 /// </summary> 88 /// <param name="m">float4x4 to convert.</param> 89 /// <returns>The converted Matrix4x4.</returns> 90 public static implicit operator Matrix4x4(float4x4 m) { return new Matrix4x4(m.c0, m.c1, m.c2, m.c3); } 91 } 92} 93#endif