mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
|
|
@ -0,0 +1,93 @@
|
|||
// <auto-generated /> - edit Matrix.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a 3x2 matrix with float components.
|
||||
/// </summary>
|
||||
[DebuggerTypeProxy(typeof(DebugView))]
|
||||
public partial struct float3x2 : IMatrix<float3x2, float>
|
||||
, IFloatingMatrix3x2<float3x2, float, float2, float3>
|
||||
{
|
||||
internal class DebugView(float3x2 m)
|
||||
{
|
||||
public float2 X => m.X;
|
||||
public float2 Y => m.Y;
|
||||
public float2 Z => m.Z;
|
||||
}
|
||||
|
||||
/// <summary>The first row of the matrix.</summary>
|
||||
[XmlIgnore]
|
||||
public float2 X;
|
||||
|
||||
/// <summary>The second row of the matrix.</summary>
|
||||
[XmlIgnore]
|
||||
public float2 Y;
|
||||
|
||||
/// <summary>The third row of the matrix.</summary>
|
||||
[XmlIgnore]
|
||||
public float2 Z;
|
||||
|
||||
/// <inheritdoc cref="Matrix3x2(float, float, float, float, float, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public float3x2(
|
||||
float m11,
|
||||
float m12,
|
||||
float m21,
|
||||
float m22,
|
||||
float m31,
|
||||
float m32
|
||||
)
|
||||
{
|
||||
X = new float2(m11, m12);
|
||||
Y = new float2(m21, m22);
|
||||
Z = new float2(m31, m32);
|
||||
}
|
||||
|
||||
/// <summary>Creates a matrix from the leading 6 elements of a span, row by row.</summary>
|
||||
/// <param name="span">The elements to read; must contain at least 6, and any beyond that are ignored.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="span" /> holds fewer than 6 elements.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public float3x2(ReadOnlySpan<float> span)
|
||||
{
|
||||
if (span.Length < 6)
|
||||
throw new ArgumentOutOfRangeException(nameof(span), "Length must be at least 6.");
|
||||
|
||||
this = Unsafe.ReadUnaligned<float3x2>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(span)));
|
||||
}
|
||||
|
||||
static float3x2 IMatrix<float3x2, float>.Create(ReadOnlySpan<float> span) => new(span);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static float3x2 Identity
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
float3x2 result;
|
||||
|
||||
result.X = float2.UnitX;
|
||||
result.Y = float2.UnitY;
|
||||
result.Z = float2.Zero;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public static int ComponentSize => sizeof(float);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static int RowCount => 3;
|
||||
|
||||
/// <inheritdoc />
|
||||
public static int ColumnCount => 2;
|
||||
|
||||
/// <inheritdoc cref="Matrix3x2.IsIdentity" />
|
||||
public readonly bool IsIdentity
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => X == float2.UnitX && Y == float2.UnitY && Z == float2.Zero;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue