daily update on 20241226 by nitload youmu

This commit is contained in:
Nitload
2024-12-26 03:09:46 +08:00
parent 7c8d462ca5
commit 592ad55d57
94 changed files with 3767 additions and 1484 deletions
@@ -35,11 +35,12 @@ using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
namespace StgSharp.Math
{
[StructLayout(
LayoutKind.Explicit,
layoutKind: LayoutKind.Explicit,
Size = ( 7 * 4 * sizeof( float ) ) + sizeof( bool ),
Pack = 16 )]
public struct Matrix43 : IEquatable<Matrix43>, IMat
@@ -50,12 +51,19 @@ namespace StgSharp.Math
[FieldOffset( 0 )]
internal ColumnSet3 mat;
[FieldOffset( 3 * 4 * sizeof( float ) )]
internal ColumnSet4 transpose;
public Matrix43()
{
Unsafe.SkipInit(out this);
isTransposed = false;
}
internal Matrix43( Vector4 c0, Vector4 c1, Vector4 c2 )
{
Unsafe.SkipInit(out this);
isTransposed = false;
mat.colum0 = c0;
mat.colum1 = c1;
mat.colum2 = c2;
@@ -75,6 +83,8 @@ namespace StgSharp.Math
float a31,
float a32 )
{
Unsafe.SkipInit(out this);
isTransposed = false;
mat.colum0 = new Vector4( a00, a10, a20, a30 );
mat.colum1 = new Vector4( a01, a11, a21, a31 );
mat.colum2 = new Vector4( a02, a12, a22, a32 );
@@ -135,12 +145,10 @@ namespace StgSharp.Math
internal unsafe void InternalTranspose()
{
if( !isTransposed ) {
fixed( ColumnSet3* source = &this.mat ) {
fixed( ColumnSet4* target = &this.transpose ) {
InternalIO.Intrinsic.transpose34( source, target );
}
fixed( ColumnSet3* source = &this.mat )
fixed( ColumnSet4* target = &this.transpose ) {
InternalIO.Intrinsic.transpose34( source, target );
}
isTransposed = true;
}
}
@@ -160,7 +168,7 @@ namespace StgSharp.Math
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static Matrix43 operator *( Matrix43 mat, float value )
public static unsafe Matrix43 operator *( Matrix43 mat, float value )
{
return new Matrix43(
mat.mat.colum0 * value, mat.mat.colum1 * value,
@@ -242,12 +250,11 @@ namespace StgSharp.Math
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static Matrix43 operator +( Matrix43 left, Matrix43 right )
public static unsafe Matrix43 operator +( Matrix43 left, Matrix43 right )
{
return new Matrix43(
left.mat.colum0 + right.mat.colum0,
left.mat.colum1 + right.mat.colum1,
left.mat.colum2 + right.mat.colum2 );
Matrix43 ret = new Matrix43();
InternalIO.Intrinsic.add_mat_3(&left.mat, &right.mat, &ret.mat);
return ret;
}
public static bool operator ==( Matrix43 left, Matrix43 right )