Skip to content
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

C#: Add Vector2/3/4i.MAX and MIN #81819

Merged
merged 1 commit into from
Sep 19, 2023
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
14 changes: 14 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ public readonly Vector2I Sign()
}

// Constants
private static readonly Vector2I _min = new Vector2I(int.MinValue, int.MinValue);
private static readonly Vector2I _max = new Vector2I(int.MaxValue, int.MaxValue);

private static readonly Vector2I _zero = new Vector2I(0, 0);
private static readonly Vector2I _one = new Vector2I(1, 1);

Expand All @@ -190,6 +193,17 @@ public readonly Vector2I Sign()
private static readonly Vector2I _right = new Vector2I(1, 0);
private static readonly Vector2I _left = new Vector2I(-1, 0);

/// <summary>
/// Min vector, a vector with all components equal to <see cref="int.MinValue"/>. Can be used as a negative integer equivalent of <see cref="Vector2.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector2I(int.MinValue, int.MinValue)</c>.</value>
public static Vector2I Min { get { return _min; } }
/// <summary>
/// Max vector, a vector with all components equal to <see cref="int.MaxValue"/>. Can be used as an integer equivalent of <see cref="Vector2.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector2I(int.MaxValue, int.MaxValue)</c>.</value>
public static Vector2I Max { get { return _max; } }

/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
Expand Down
14 changes: 14 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ public readonly Vector3I Sign()
}

// Constants
private static readonly Vector3I _min = new Vector3I(int.MinValue, int.MinValue, int.MinValue);
private static readonly Vector3I _max = new Vector3I(int.MaxValue, int.MaxValue, int.MaxValue);

private static readonly Vector3I _zero = new Vector3I(0, 0, 0);
private static readonly Vector3I _one = new Vector3I(1, 1, 1);

Expand All @@ -203,6 +206,17 @@ public readonly Vector3I Sign()
private static readonly Vector3I _forward = new Vector3I(0, 0, -1);
private static readonly Vector3I _back = new Vector3I(0, 0, 1);

/// <summary>
/// Min vector, a vector with all components equal to <see cref="int.MinValue"/>. Can be used as a negative integer equivalent of <see cref="Vector3.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector3I(int.MinValue, int.MinValue, int.MinValue)</c>.</value>
public static Vector3I Min { get { return _min; } }
/// <summary>
/// Max vector, a vector with all components equal to <see cref="int.MaxValue"/>. Can be used as an integer equivalent of <see cref="Vector3.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector3I(int.MaxValue, int.MaxValue, int.MaxValue)</c>.</value>
public static Vector3I Max { get { return _max; } }

/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
Expand Down
14 changes: 14 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,23 @@ public readonly Vector4I Sign()
}

// Constants
private static readonly Vector4I _min = new Vector4I(int.MinValue, int.MinValue, int.MinValue, int.MinValue);
private static readonly Vector4I _max = new Vector4I(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue);

private static readonly Vector4I _zero = new Vector4I(0, 0, 0, 0);
private static readonly Vector4I _one = new Vector4I(1, 1, 1, 1);

/// <summary>
/// Min vector, a vector with all components equal to <see cref="int.MinValue"/>. Can be used as a negative integer equivalent of <see cref="Vector4.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector4I(int.MinValue, int.MinValue, int.MinValue, int.MinValue)</c>.</value>
public static Vector4I Min { get { return _min; } }
/// <summary>
/// Max vector, a vector with all components equal to <see cref="int.MaxValue"/>. Can be used as an integer equivalent of <see cref="Vector4.Inf"/>.
/// </summary>
/// <value>Equivalent to <c>new Vector4I(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue)</c>.</value>
public static Vector4I Max { get { return _max; } }

/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
Expand Down