mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
// <auto-generated /> - edit Matrix.access.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
public partial struct float4x4
|
|
{
|
|
/// <inheritdoc />
|
|
public float this[int row, int column]
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
readonly get
|
|
{
|
|
if ((uint)row >= RowCount)
|
|
throw new ArgumentOutOfRangeException(nameof(row));
|
|
|
|
return Unsafe.Add(ref Unsafe.AsRef(in X), row)[column];
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
set
|
|
{
|
|
if ((uint)row >= RowCount)
|
|
throw new ArgumentOutOfRangeException(nameof(row));
|
|
|
|
Unsafe.Add(ref X, row)[column] = value;
|
|
}
|
|
}
|
|
|
|
public readonly void Deconstruct(out float4 x, out float4 y, out float4 z, out float4 w)
|
|
{
|
|
x = X;
|
|
y = Y;
|
|
z = Z;
|
|
w = W;
|
|
}
|
|
|
|
public Span<float> AsSpan()
|
|
{
|
|
return MemoryMarshal.CreateSpan(ref Unsafe.As<float4x4, float>(ref this), 16);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public readonly ReadOnlySpan<float> AsReadOnlySpan()
|
|
{
|
|
return MemoryMarshal.CreateReadOnlySpan(in Unsafe.As<float4x4, float>(ref Unsafe.AsRef(in this)), 16);
|
|
}
|
|
}
|