daily update on 20240305 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-05 10:17:02 +08:00
parent 1f2fca4c8f
commit 6a0cccae79
156 changed files with 23040 additions and 1385 deletions
+11 -16
View File
@@ -6,13 +6,15 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = 7*4*sizeof(float)+ sizeof(bool),Pack =16 )]
[StructLayout(LayoutKind.Explicit, Size = 7 * 4 * sizeof(float) + sizeof(bool), Pack = 16)]
public struct Matrix4x3 : IEquatable<Matrix4x3>
{
[FieldOffset(0)]
internal Mat3 mat;
[FieldOffset(3 * 4 * sizeof(float))]
internal Mat4 transpose;
[FieldOffset(7 * 4 * sizeof(float))]
internal bool isTransposed;
@@ -62,7 +64,6 @@ namespace StgSharp.Math
}
set
{
if (rowNum > 3 || rowNum < 0)
{
throw new ArgumentOutOfRangeException(nameof(columNum));
@@ -92,7 +93,6 @@ namespace StgSharp.Math
fixed (Mat4* target = &this.transpose)
{
InternalIO.Transpose3to4_internal(source, target);
}
isTransposed = true;
}
@@ -108,7 +108,6 @@ namespace StgSharp.Math
return EqualityComparer<Mat3>.Default.Equals(mat, other.mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x3 operator +(Matrix4x3 left, Matrix4x3 right)
{
@@ -127,7 +126,6 @@ namespace StgSharp.Math
left.mat.colum1 - right.mat.colum1,
left.mat.colum2 - right.mat.colum2
);
}
public static bool operator ==(Matrix4x3 left, Matrix4x3 right)
@@ -159,7 +157,7 @@ namespace StgSharp.Math
mat.mat.colum2 / value
);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x2 operator *(Matrix4x3 left, Matrix3x2 right)
{
@@ -167,19 +165,19 @@ namespace StgSharp.Math
return new Matrix4x2(
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
Vector4.Dot(left.transpose.colum2, right.mat.colum0),
Vector4.Dot(left.transpose.colum2, right.mat.colum1),
Vector4.Dot(left.transpose.colum3, right.mat.colum0),
Vector4.Dot(left.transpose.colum3, right.mat.colum1)
);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x3 operator *(Matrix4x3 left, Matrix3x3 right)
{
@@ -223,7 +221,7 @@ namespace StgSharp.Math
Vector4.Dot(left.transpose.colum2, right.mat.colum1),
Vector4.Dot(left.transpose.colum2, right.mat.colum2),
Vector4.Dot(left.transpose.colum2, right.mat.colum3),
Vector4.Dot(left.transpose.colum3, right.mat.colum0),
Vector4.Dot(left.transpose.colum3, right.mat.colum1),
Vector4.Dot(left.transpose.colum3, right.mat.colum2),
@@ -240,8 +238,5 @@ namespace StgSharp.Math
mat.colum2.GetHashCode()
);
}
}
}
}