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
+19 -82
View File
@@ -10,68 +10,6 @@ namespace StgSharp
internal static unsafe partial class internalIO
{
#region add_mat4
#if NET7_0_OR_GREATER
#else
[DllImport("StgSharpGraphic", EntryPoint = "addmat4",
#endif
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern unsafe Mat4* add_mat4(
ref Mat4 mat1, ref Mat4 Mat2);
[DllImport("StgSharpGraphic", EntryPoint = "addmat4",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern unsafe Mat4* add_mat4(
Mat4* mat1, Mat4* Mat2);
#endregion
#region sub_mat4
[DllImport("StgSharpGraphic", EntryPoint = "sub_mat4",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe extern Mat4* sub_mat4(
ref Mat4 mat1, ref Mat4 Mat2);
[DllImport("StgSharpGraphic", EntryPoint = "Mat4",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe extern Mat4* sub_mat4(
Mat4* mat1, Mat4* Mat2);
#endregion
#region mul
[DllImport("StgSharpGraphic", EntryPoint = "mul_const",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe extern Mat4* mul_const(
Mat4* mat, float value);
[DllImport("StgSharpGraphic", EntryPoint = "mul_const",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe extern Mat4* mul_const(
ref Mat4 mat, float value);
[DllImport("StgsharpGraphic", EntryPoint = "mul_4_2",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern unsafe Mat2* mul_4_2(Mat4* left, Mat2* right);
[DllImport("StgsharpGraphic", EntryPoint = "mul_4_4",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern unsafe Mat4* mul_4_4(Mat4* left, Mat4* right);
#endregion
#region transpose
[DllImport("StgsharpGraphic", EntryPoint = "transpose4to4",
@@ -100,10 +38,6 @@ namespace StgSharp
#region deinit_mat4
[DllImport("StgSharpGraphic", EntryPoint = "deinit_mat4",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void deinit_mat4(ref Mat4 mat);
[DllImport("StgSharpGraphic", EntryPoint = "deinit_mat4",
CallingConvention = CallingConvention.Cdecl)]
@@ -121,7 +55,7 @@ namespace StgSharp.Math
[StructLayout(LayoutKind.Explicit, Size = 16 * sizeof(float))]
public struct Mat4
internal struct Mat4 : IEquatable<Mat4>
{
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(16)] internal Vector4 colum1;
@@ -162,27 +96,30 @@ namespace StgSharp.Math
this.colum3 = colum3;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Mat4 add(Mat4 left, Mat4 right)
public override bool Equals(object? obj)
{
return new Mat4(
left.colum0 + right.colum0,
left.colum1 + right.colum1,
left.colum2 + right.colum2,
left.colum3 + right.colum3
);
return obj is Mat4 mat && Equals(mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Mat4 sub(Mat4 left, Mat4 right)
public bool Equals(Mat4 other)
{
return new Mat4(
left.colum0 - right.colum0,
left.colum1 - right.colum1,
left.colum2 - right.colum2,
left.colum3 - right.colum3
);
return colum0.Equals(other.colum0) &&
colum1.Equals(other.colum1) &&
colum2.Equals(other.colum2) &&
colum3.Equals(other.colum3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Mat4 left, Mat4 right)
{
return left.Equals(right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Mat4 left, Mat4 right)
{
return !(left == right);
}
}
}