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
+35 -2
View File
@@ -1,7 +1,7 @@
using StgSharp.Math;
using StgSharp.StgSharp.Math;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp
@@ -9,6 +9,14 @@ namespace StgSharp
internal static unsafe partial class internalIO
{
#region det
[DllImport("StgsharpGraphic", EntryPoint = "det_mat3",
CallingConvention = CallingConvention.Cdecl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern unsafe float det_mat3(Mat3* mat);
#endregion
#region transpose
@@ -34,7 +42,7 @@ namespace StgSharp
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
internal struct Mat3
internal struct Mat3 : IEquatable<Mat3>
{
[FieldOffset(0)] internal Vector4 colum0;
@@ -56,4 +64,29 @@ namespace StgSharp.Math
[FieldOffset(10 * sizeof(float))] internal float m22;
[FieldOffset(11 * sizeof(float))] internal float m32;
public override bool Equals(object? obj)
{
return obj is Mat3 mat && Equals(mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Mat3 other)
{
return colum0.Equals(other.colum0) &&
colum1.Equals(other.colum1) &&
colum2.Equals(other.colum2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Mat3 left, Mat3 right)
{
return left.Equals(right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Mat3 left, Mat3 right)
{
return !(left == right);
}
}
}