Skip to content

Sync latest #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions sources/Maths/Maths/Matrix2x2F.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x2F<T> : IEquatable<Matrix2x2F<T>> where T : IFloatingPointIeee754<T>
partial struct Matrix2x2F<T> :
IEquatable<Matrix2x2F<T>>
where T : IFloatingPointIeee754<T>
{
/// <summary>The multiplicative identity matrix of size 2x2.</summary>
public static readonly Matrix2x2F<T> Identity = new(
Expand Down Expand Up @@ -39,7 +41,7 @@ public ref Vector2F<T> this[int row]
}

[UnscopedRef]
public ref Vector2F<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -69,7 +71,7 @@ public ref Vector2F<T> this[int row]
/// <summary>Computes the transpose of the matrix.</summary>
public Matrix2x2F<T> Transpose() =>
new(new(M11, M21),
new(M12, M22))
new(M12, M22));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -116,4 +118,12 @@ public Matrix2x2F<T> Transpose() =>
new(left.M11 * right.Row1 + left.M12 * right.Row2,
left.M21 * right.Row1 + left.M22 * right.Row2);
}

static partial class Matrix2x2F
{
public static Matrix2x2F<T> Lerp<T>(Matrix2x2F<T> value1, Matrix2x2F<T> value2, T amount)
where T : IFloatingPointIeee754<T> =>
new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)),
new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)));
}
}
9 changes: 6 additions & 3 deletions sources/Maths/Maths/Matrix2x2I.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x2I<T> : IEquatable<Matrix2x2I<T>> where T : IBinaryInteger<T>
partial struct Matrix2x2I<T> :
IEquatable<Matrix2x2I<T>>
where T : IBinaryInteger<T>
{
/// <summary>The multiplicative identity matrix of size 2x2.</summary>
public static readonly Matrix2x2I<T> Identity = new(
Expand Down Expand Up @@ -39,7 +41,7 @@ public ref Vector2I<T> this[int row]
}

[UnscopedRef]
public ref Vector2I<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -69,7 +71,7 @@ public ref Vector2I<T> this[int row]
/// <summary>Computes the transpose of the matrix.</summary>
public Matrix2x2I<T> Transpose() =>
new(new(M11, M21),
new(M12, M22))
new(M12, M22));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -116,4 +118,5 @@ public Matrix2x2I<T> Transpose() =>
new(left.M11 * right.Row1 + left.M12 * right.Row2,
left.M21 * right.Row1 + left.M22 * right.Row2);
}

}
16 changes: 13 additions & 3 deletions sources/Maths/Maths/Matrix2x3F.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x3F<T> : IEquatable<Matrix2x3F<T>> where T : IFloatingPointIeee754<T>
partial struct Matrix2x3F<T> :
IEquatable<Matrix2x3F<T>>
where T : IFloatingPointIeee754<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector3F<T> Row1;
Expand Down Expand Up @@ -34,7 +36,7 @@ public ref Vector3F<T> this[int row]
}

[UnscopedRef]
public ref Vector3F<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -73,7 +75,7 @@ public ref Vector3F<T> this[int row]
public Matrix3x2F<T> Transpose() =>
new(new(M11, M21),
new(M12, M22),
new(M13, M23))
new(M13, M23));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -128,4 +130,12 @@ public Matrix3x2F<T> Transpose() =>
new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3,
left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3);
}

static partial class Matrix2x3F
{
public static Matrix2x3F<T> Lerp<T>(Matrix2x3F<T> value1, Matrix2x3F<T> value2, T amount)
where T : IFloatingPointIeee754<T> =>
new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)),
new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)));
}
}
9 changes: 6 additions & 3 deletions sources/Maths/Maths/Matrix2x3I.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x3I<T> : IEquatable<Matrix2x3I<T>> where T : IBinaryInteger<T>
partial struct Matrix2x3I<T> :
IEquatable<Matrix2x3I<T>>
where T : IBinaryInteger<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector3I<T> Row1;
Expand Down Expand Up @@ -34,7 +36,7 @@ public ref Vector3I<T> this[int row]
}

[UnscopedRef]
public ref Vector3I<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -73,7 +75,7 @@ public ref Vector3I<T> this[int row]
public Matrix3x2I<T> Transpose() =>
new(new(M11, M21),
new(M12, M22),
new(M13, M23))
new(M13, M23));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -128,4 +130,5 @@ public Matrix3x2I<T> Transpose() =>
new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3,
left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3);
}

}
16 changes: 13 additions & 3 deletions sources/Maths/Maths/Matrix2x4F.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x4F<T> : IEquatable<Matrix2x4F<T>> where T : IFloatingPointIeee754<T>
partial struct Matrix2x4F<T> :
IEquatable<Matrix2x4F<T>>
where T : IFloatingPointIeee754<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector4F<T> Row1;
Expand Down Expand Up @@ -34,7 +36,7 @@ public ref Vector4F<T> this[int row]
}

[UnscopedRef]
public ref Vector4F<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -82,7 +84,7 @@ public Matrix4x2F<T> Transpose() =>
new(new(M11, M21),
new(M12, M22),
new(M13, M23),
new(M14, M24))
new(M14, M24));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -146,4 +148,12 @@ public Matrix4x2F<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2,
left.M31 * right.Row1 + left.M32 * right.Row2);
}

static partial class Matrix2x4F
{
public static Matrix2x4F<T> Lerp<T>(Matrix2x4F<T> value1, Matrix2x4F<T> value2, T amount)
where T : IFloatingPointIeee754<T> =>
new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)),
new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)));
}
}
9 changes: 6 additions & 3 deletions sources/Maths/Maths/Matrix2x4I.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix2x4I<T> : IEquatable<Matrix2x4I<T>> where T : IBinaryInteger<T>
partial struct Matrix2x4I<T> :
IEquatable<Matrix2x4I<T>>
where T : IBinaryInteger<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector4I<T> Row1;
Expand Down Expand Up @@ -34,7 +36,7 @@ public ref Vector4I<T> this[int row]
}

[UnscopedRef]
public ref Vector4I<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -82,7 +84,7 @@ public Matrix4x2I<T> Transpose() =>
new(new(M11, M21),
new(M12, M22),
new(M13, M23),
new(M14, M24))
new(M14, M24));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -146,4 +148,5 @@ public Matrix4x2I<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2,
left.M31 * right.Row1 + left.M32 * right.Row2);
}

}
17 changes: 14 additions & 3 deletions sources/Maths/Maths/Matrix3x2F.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix3x2F<T> : IEquatable<Matrix3x2F<T>> where T : IFloatingPointIeee754<T>
partial struct Matrix3x2F<T> :
IEquatable<Matrix3x2F<T>>
where T : IFloatingPointIeee754<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector2F<T> Row1;
Expand Down Expand Up @@ -39,7 +41,7 @@ public ref Vector2F<T> this[int row]
}

[UnscopedRef]
public ref Vector2F<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -77,7 +79,7 @@ public ref Vector2F<T> this[int row]
/// <summary>Computes the transpose of the matrix.</summary>
public Matrix2x3F<T> Transpose() =>
new(new(M11, M21, M31),
new(M12, M22, M32))
new(M12, M22, M32));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -138,4 +140,13 @@ public Matrix2x3F<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2,
left.M31 * right.Row1 + left.M32 * right.Row2);
}

static partial class Matrix3x2F
{
public static Matrix3x2F<T> Lerp<T>(Matrix3x2F<T> value1, Matrix3x2F<T> value2, T amount)
where T : IFloatingPointIeee754<T> =>
new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)),
new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)),
new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount)));
}
}
9 changes: 6 additions & 3 deletions sources/Maths/Maths/Matrix3x2I.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix3x2I<T> : IEquatable<Matrix3x2I<T>> where T : IBinaryInteger<T>
partial struct Matrix3x2I<T> :
IEquatable<Matrix3x2I<T>>
where T : IBinaryInteger<T>
{
/// <summary>The 1st row of the matrix represented as a vector.</summary>
public Vector2I<T> Row1;
Expand Down Expand Up @@ -39,7 +41,7 @@ public ref Vector2I<T> this[int row]
}

[UnscopedRef]
public ref Vector2I<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -77,7 +79,7 @@ public ref Vector2I<T> this[int row]
/// <summary>Computes the transpose of the matrix.</summary>
public Matrix2x3I<T> Transpose() =>
new(new(M11, M21, M31),
new(M12, M22, M32))
new(M12, M22, M32));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -138,4 +140,5 @@ public Matrix2x3I<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2,
left.M31 * right.Row1 + left.M32 * right.Row2);
}

}
17 changes: 14 additions & 3 deletions sources/Maths/Maths/Matrix3x3F.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix3x3F<T> : IEquatable<Matrix3x3F<T>> where T : IFloatingPointIeee754<T>
partial struct Matrix3x3F<T> :
IEquatable<Matrix3x3F<T>>
where T : IFloatingPointIeee754<T>
{
/// <summary>The multiplicative identity matrix of size 3x3.</summary>
public static readonly Matrix3x3F<T> Identity = new(
Expand Down Expand Up @@ -45,7 +47,7 @@ public ref Vector3F<T> this[int row]
}

[UnscopedRef]
public ref Vector3F<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -96,7 +98,7 @@ public ref Vector3F<T> this[int row]
public Matrix3x3F<T> Transpose() =>
new(new(M11, M21, M31),
new(M12, M22, M32),
new(M13, M23, M33))
new(M13, M23, M33));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -165,4 +167,13 @@ public Matrix3x3F<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3,
left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3);
}

static partial class Matrix3x3F
{
public static Matrix3x3F<T> Lerp<T>(Matrix3x3F<T> value1, Matrix3x3F<T> value2, T amount)
where T : IFloatingPointIeee754<T> =>
new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)),
new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)),
new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount)));
}
}
9 changes: 6 additions & 3 deletions sources/Maths/Maths/Matrix3x3I.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace Silk.NET.Maths
using System.Diagnostics.CodeAnalysis;
using System.Numerics;

partial struct Matrix3x3I<T> : IEquatable<Matrix3x3I<T>> where T : IBinaryInteger<T>
partial struct Matrix3x3I<T> :
IEquatable<Matrix3x3I<T>>
where T : IBinaryInteger<T>
{
/// <summary>The multiplicative identity matrix of size 3x3.</summary>
public static readonly Matrix3x3I<T> Identity = new(
Expand Down Expand Up @@ -45,7 +47,7 @@ public ref Vector3I<T> this[int row]
}

[UnscopedRef]
public ref Vector3I<T> this[int row, int column] => ref this[row][column];
public ref T this[int row, int column] => ref this[row][column];

/// <summary>Gets the element in the 1st row and 1st column of the matrix.</summary>
[UnscopedRef]
Expand Down Expand Up @@ -96,7 +98,7 @@ public ref Vector3I<T> this[int row]
public Matrix3x3I<T> Transpose() =>
new(new(M11, M21, M31),
new(M12, M22, M32),
new(M13, M23, M33))
new(M13, M23, M33));

/// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
/// <param name="left">The first matrix to compare.</param>
Expand Down Expand Up @@ -165,4 +167,5 @@ public Matrix3x3I<T> Transpose() =>
left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3,
left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3);
}

}
Loading