mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
100 lines
3 KiB
C#
100 lines
3 KiB
C#
// <auto-generated /> - edit Matrix.operators.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
public partial struct double4x4
|
|
{
|
|
/// <inheritdoc cref="Matrix4x4.op_Addition(Matrix4x4, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4x4 operator +(double4x4 left, double4x4 right)
|
|
{
|
|
double4x4 result;
|
|
|
|
result.X = left.X + right.X;
|
|
result.Y = left.Y + right.Y;
|
|
result.Z = left.Z + right.Z;
|
|
result.W = left.W + right.W;
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_Equality(Matrix4x4, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool operator ==(double4x4 left, double4x4 right)
|
|
{
|
|
return left.X == right.X && left.Y == right.Y && left.Z == right.Z && left.W == right.W;
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_Inequality(Matrix4x4, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool operator !=(double4x4 left, double4x4 right)
|
|
{
|
|
return left.X != right.X || left.Y != right.Y || left.Z != right.Z || left.W != right.W;
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_Multiply(Matrix4x4, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4x4 operator *(double4x4 left, double4x4 right)
|
|
{
|
|
ref readonly var l = ref left.AsRows();
|
|
ref readonly var r = ref right.AsRows();
|
|
|
|
var result = new Rows(
|
|
r.Transform(l.X),
|
|
r.Transform(l.Y),
|
|
r.Transform(l.Z),
|
|
r.Transform(l.W));
|
|
|
|
return Unsafe.BitCast<Rows, double4x4>(result);
|
|
}
|
|
|
|
/// <inheritdoc cref="Multiply(double4x4, double4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 operator *(double4x4 matrix, double4 vector)
|
|
{
|
|
return Multiply(matrix, vector);
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_Multiply(Matrix4x4, float)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4x4 operator *(double4x4 left, double right)
|
|
{
|
|
double4x4 result;
|
|
|
|
result.X = left.X * right;
|
|
result.Y = left.Y * right;
|
|
result.Z = left.Z * right;
|
|
result.W = left.W * right;
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_Subtraction(Matrix4x4, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4x4 operator -(double4x4 left, double4x4 right)
|
|
{
|
|
double4x4 result;
|
|
|
|
result.X = left.X - right.X;
|
|
result.Y = left.Y - right.Y;
|
|
result.Z = left.Z - right.Z;
|
|
result.W = left.W - right.W;
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Matrix4x4.op_UnaryNegation(Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4x4 operator -(double4x4 value)
|
|
{
|
|
double4x4 result;
|
|
|
|
result.X = -value.X;
|
|
result.Y = -value.Y;
|
|
result.Z = -value.Z;
|
|
result.W = -value.W;
|
|
|
|
return result;
|
|
}
|
|
}
|