daily update on 20230830

This commit is contained in:
Nitload
2023-08-30 22:49:11 +08:00
parent 1fcbfb972b
commit c6f4b3dd53
55 changed files with 648 additions and 1198 deletions
+18 -11
View File
@@ -58,7 +58,7 @@ namespace StgSharp
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
internal struct Mat2
internal struct Mat2 : IEquatable<Mat2>
{
[FieldOffset(0)] internal Vector4 colum0;
@@ -84,21 +84,28 @@ namespace StgSharp.Math
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Mat2 Add(Mat2 left, Mat2 right)
public override bool Equals(object? obj)
{
return new Mat2(
left.colum0 + right.colum0,
left.colum1 + right.colum1
);
return obj is Mat2 mat && Equals(mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Mat2 Sub(Mat2 left, Mat2 right)
public bool Equals(Mat2 other)
{
return new Mat2(
left.colum0 - right.colum0,
left.colum1 - right.colum1
);
return colum0.Equals(other.colum0) &&
colum1.Equals(other.colum1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Mat2 left, Mat2 right)
{
return left.Equals(right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Mat2 left, Mat2 right)
{
return !(left == right);
}
}
}