mirror of
https://github.com/kwsch/pkNX.git
synced 2026-09-08 10:35:22 -05:00
Fix goofy constructor
compiler generated code eats the primary constructor assignment
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user