Fix goofy constructor

compiler generated code eats the primary constructor assignment
This commit is contained in:
Kurt
2024-04-29 00:23:31 -05:00
parent 4deec6fc7a
commit ca8bc605f2

View File

@@ -3,13 +3,23 @@
namespace pkNX.Structures.FlatBuffers;
[TypeConverter(typeof(ExpandableObjectConverter))]
public partial struct PackedVec3f(float x = 0, float y = 0, float z = 0) : IEquatable<PackedVec3f>
public partial struct PackedVec3f : IEquatable<PackedVec3f>
{
public static readonly PackedVec3f Zero = new();
public static readonly PackedVec3f One = new() { X = 1, Y = 1, Z = 1 };
public static explicit operator PackedVec3f(Vec3f v) => new() { X = v.X, Y = v.Y, Z = v.Z };
// ReSharper disable once ConvertToPrimaryConstructor
#pragma warning disable IDE0290 // Use primary constructor
public PackedVec3f(float x = 0, float y = 0, float z = 0)
{
X = x;
Y = y;
Z = z;
}
#pragma warning restore IDE0290 // Use primary constructor
public readonly bool IsOne() => X is 1 && Y is 1 && Z is 1;
public readonly bool IsZero() => X is 0 && Y is 0 && Z is 0;
public readonly float Magnitude() => MathF.Sqrt(MagnitudeSqr());