summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs64
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs64
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs51
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs68
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs72
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs72
9 files changed, 402 insertions, 19 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
index feaa1d07da..ab7f8ede44 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
@@ -69,7 +69,7 @@ namespace Godot
public readonly Aabb Abs()
{
Vector3 end = End;
- Vector3 topLeft = new Vector3(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y), Mathf.Min(_position.Z, end.Z));
+ Vector3 topLeft = end.Min(_position);
return new Aabb(topLeft, _size.Abs());
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index 9d9065911e..19721b6cca 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
@@ -69,7 +69,7 @@ namespace Godot
public readonly Rect2 Abs()
{
Vector2 end = End;
- Vector2 topLeft = new Vector2(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
+ Vector2 topLeft = end.Min(_position);
return new Rect2(topLeft, _size.Abs());
}
@@ -91,14 +91,12 @@ namespace Godot
return new Rect2();
}
- newRect._position.X = Mathf.Max(b._position.X, _position.X);
- newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
+ newRect._position = b._position.Max(_position);
Vector2 bEnd = b._position + b._size;
Vector2 end = _position + _size;
- newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
- newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
+ newRect._size = bEnd.Min(end) - newRect._position;
return newRect;
}
@@ -338,11 +336,9 @@ namespace Godot
{
Rect2 newRect;
- newRect._position.X = Mathf.Min(b._position.X, _position.X);
- newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
+ newRect._position = b._position.Min(_position);
- newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
- newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
+ newRect._size = (b._position + b._size).Max(_position + _size);
newRect._size -= newRect._position; // Make relative again
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
index 65704b3da7..7ee9ff8552 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
@@ -69,7 +69,7 @@ namespace Godot
public readonly Rect2I Abs()
{
Vector2I end = End;
- Vector2I topLeft = new Vector2I(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
+ Vector2I topLeft = end.Min(_position);
return new Rect2I(topLeft, _size.Abs());
}
@@ -91,14 +91,12 @@ namespace Godot
return new Rect2I();
}
- newRect._position.X = Mathf.Max(b._position.X, _position.X);
- newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
+ newRect._position = b._position.Max(_position);
Vector2I bEnd = b._position + b._size;
Vector2I end = _position + _size;
- newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
- newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
+ newRect._size = bEnd.Min(end) - newRect._position;
return newRect;
}
@@ -295,11 +293,9 @@ namespace Godot
{
Rect2I newRect;
- newRect._position.X = Mathf.Min(b._position.X, _position.X);
- newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
+ newRect._position = b._position.Min(_position);
- newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
- newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
+ newRect._size = (b._position + b._size).Max(_position + _size);
newRect._size -= newRect._position; // Make relative again
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index 16de028045..50bf56d832 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -430,6 +430,70 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector2 Max(Vector2 with)
+ {
+ return new Vector2
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2(Mathf.Max(X, with), Mathf.Max(Y, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector2 Max(real_t with)
+ {
+ return new Vector2
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector2 Min(Vector2 with)
+ {
+ return new Vector2
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2(Mathf.Min(X, with), Mathf.Min(Y, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector2 Min(real_t with)
+ {
+ return new Vector2
+ (
+ Mathf.Min(X, with),
+ Mathf.Min(Y, with)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
index 3d11a15e28..9442db4d86 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
@@ -192,6 +192,70 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector2I Max(Vector2I with)
+ {
+ return new Vector2I
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2I(Mathf.Max(X, with), Mathf.Max(Y, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector2I Max(int with)
+ {
+ return new Vector2I
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector2I Min(Vector2I with)
+ {
+ return new Vector2I
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector2I(Mathf.Min(X, with), Mathf.Min(Y, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector2I Min(int with)
+ {
+ return new Vector2I
+ (
+ Mathf.Min(X, with),
+ Mathf.Min(Y, with)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index a2d5c012c0..27f2713efa 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -437,6 +437,57 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector3 Max(Vector3 with)
+ {
+ return new Vector3
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y),
+ Mathf.Max(Z, with.Z)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3(Mathf.Max(X, with), Mathf.Max(Y, with), Mathf.Max(Z, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector3 Max(real_t with)
+ {
+ return new Vector3
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with),
+ Mathf.Max(Z, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector3 Min(Vector3 with)
+ {
+ return new Vector3
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y),
+ Mathf.Min(Z, with.Z)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
index 642c73a8ec..8312e2c231 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
@@ -203,6 +203,74 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector3I Max(Vector3I with)
+ {
+ return new Vector3I
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y),
+ Mathf.Max(Z, with.Z)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3I(Mathf.Max(X, with), Mathf.Max(Y, with), Mathf.Max(Z, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector3I Max(int with)
+ {
+ return new Vector3I
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with),
+ Mathf.Max(Z, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector3I Min(Vector3I with)
+ {
+ return new Vector3I
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y),
+ Mathf.Min(Z, with.Z)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector3I(Mathf.Min(X, with), Mathf.Min(Y, with), Mathf.Min(Z, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector3I Min(int with)
+ {
+ return new Vector3I
+ (
+ Mathf.Min(X, with),
+ Mathf.Min(Y, with),
+ Mathf.Min(Z, with)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
index 9862dfdab6..ec59197fa3 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
@@ -371,6 +371,78 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z), Mathf.Max(W, with.W))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector4 Max(Vector4 with)
+ {
+ return new Vector4
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y),
+ Mathf.Max(Z, with.Z),
+ Mathf.Max(W, with.W)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4(Mathf.Max(X, with), Mathf.Max(Y, with), Mathf.Max(Z, with), Mathf.Max(W, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector4 Max(real_t with)
+ {
+ return new Vector4
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with),
+ Mathf.Max(Z, with),
+ Mathf.Max(W, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z), Mathf.Min(W, with.W))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector4 Min(Vector4 with)
+ {
+ return new Vector4
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y),
+ Mathf.Min(Z, with.Z),
+ Mathf.Min(W, with.W)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4(Mathf.Min(X, with), Mathf.Min(Y, with), Mathf.Min(Z, with), Mathf.Min(W, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector4 Min(real_t with)
+ {
+ return new Vector4
+ (
+ Mathf.Min(X, with),
+ Mathf.Min(Y, with),
+ Mathf.Min(Z, with),
+ Mathf.Min(W, with)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
index 321f985209..ba8e54b88b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
@@ -223,6 +223,78 @@ namespace Godot
}
/// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z), Mathf.Max(W, with.W))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector4I Max(Vector4I with)
+ {
+ return new Vector4I
+ (
+ Mathf.Max(X, with.X),
+ Mathf.Max(Y, with.Y),
+ Mathf.Max(Z, with.Z),
+ Mathf.Max(W, with.W)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise maximum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4I(Mathf.Max(X, with), Mathf.Max(Y, with), Mathf.Max(Z, with), Mathf.Max(W, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting maximum vector.</returns>
+ public readonly Vector4I Max(int with)
+ {
+ return new Vector4I
+ (
+ Mathf.Max(X, with),
+ Mathf.Max(Y, with),
+ Mathf.Max(Z, with),
+ Mathf.Max(W, with)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z), Mathf.Min(W, with.W))</c>.
+ /// </summary>
+ /// <param name="with">The other vector to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector4I Min(Vector4I with)
+ {
+ return new Vector4I
+ (
+ Mathf.Min(X, with.X),
+ Mathf.Min(Y, with.Y),
+ Mathf.Min(Z, with.Z),
+ Mathf.Min(W, with.W)
+ );
+ }
+
+ /// <summary>
+ /// Returns the result of the component-wise minimum between
+ /// this vector and <paramref name="with"/>.
+ /// Equivalent to <c>new Vector4I(Mathf.Min(X, with), Mathf.Min(Y, with), Mathf.Min(Z, with), Mathf.Min(W, with))</c>.
+ /// </summary>
+ /// <param name="with">The other value to use.</param>
+ /// <returns>The resulting minimum vector.</returns>
+ public readonly Vector4I Min(int with)
+ {
+ return new Vector4I
+ (
+ Mathf.Min(X, with),
+ Mathf.Min(Y, with),
+ Mathf.Min(Z, with),
+ Mathf.Min(W, with)
+ );
+ }
+
+ /// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>