Skip to content

Commit

Permalink
Add Vector2/3/4i.MAX and MIN
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Sep 16, 2023
1 parent 5f1e56f commit adc930b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/variant/variant_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2569,9 +2569,13 @@ static void _register_variant_builtin_methods() {

_VariantCall::add_variant_constant(Variant::VECTOR4I, "ZERO", Vector4i(0, 0, 0, 0));
_VariantCall::add_variant_constant(Variant::VECTOR4I, "ONE", Vector4i(1, 1, 1, 1));
_VariantCall::add_variant_constant(Variant::VECTOR4I, "MIN", Vector4i(INT32_MIN, INT32_MIN, INT32_MIN, INT32_MIN));
_VariantCall::add_variant_constant(Variant::VECTOR4I, "MAX", Vector4i(INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX));

_VariantCall::add_variant_constant(Variant::VECTOR3I, "ZERO", Vector3i(0, 0, 0));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "ONE", Vector3i(1, 1, 1));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "MIN", Vector3i(INT32_MIN, INT32_MIN, INT32_MIN));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "MAX", Vector3i(INT32_MAX, INT32_MAX, INT32_MAX));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "LEFT", Vector3i(-1, 0, 0));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "RIGHT", Vector3i(1, 0, 0));
_VariantCall::add_variant_constant(Variant::VECTOR3I, "UP", Vector3i(0, 1, 0));
Expand Down Expand Up @@ -2601,6 +2605,8 @@ static void _register_variant_builtin_methods() {

_VariantCall::add_variant_constant(Variant::VECTOR2I, "ZERO", Vector2i(0, 0));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "ONE", Vector2i(1, 1));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "MIN", Vector2i(INT32_MIN, INT32_MIN));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "MAX", Vector2i(INT32_MAX, INT32_MAX));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "LEFT", Vector2i(-1, 0));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "RIGHT", Vector2i(1, 0));
_VariantCall::add_variant_constant(Variant::VECTOR2I, "UP", Vector2i(0, -1));
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/Vector2i.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
<constant name="ONE" value="Vector2i(1, 1)">
One vector, a vector with all components set to [code]1[/code].
</constant>
<constant name="MIN" value="Vector2i(-2147483648, -2147483648)">
Min vector, a vector with all components equal to [code]INT32_MIN[/code]. Can be used as a negative integer equivalent of [constant Vector2.INF].
</constant>
<constant name="MAX" value="Vector2i(2147483647, 2147483647)">
Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector2.INF].
</constant>
<constant name="LEFT" value="Vector2i(-1, 0)">
Left unit vector. Represents the direction of left.
</constant>
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/Vector3i.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
<constant name="ONE" value="Vector3i(1, 1, 1)">
One vector, a vector with all components set to [code]1[/code].
</constant>
<constant name="MIN" value="Vector3i(-2147483648, -2147483648, -2147483648)">
Min vector, a vector with all components equal to [code]INT32_MIN[/code]. Can be used as a negative integer equivalent of [constant Vector3.INF].
</constant>
<constant name="MAX" value="Vector3i(2147483647, 2147483647, 2147483647)">
Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector3.INF].
</constant>
<constant name="LEFT" value="Vector3i(-1, 0, 0)">
Left unit vector. Represents the local direction of left, and the global direction of west.
</constant>
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/Vector4i.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
<constant name="ONE" value="Vector4i(1, 1, 1, 1)">
One vector, a vector with all components set to [code]1[/code].
</constant>
<constant name="MIN" value="Vector4i(-2147483648, -2147483648, -2147483648, -2147483648)">
Min vector, a vector with all components equal to [code]INT32_MIN[/code]. Can be used as a negative integer equivalent of [constant Vector4.INF].
</constant>
<constant name="MAX" value="Vector4i(2147483647, 2147483647, 2147483647, 2147483647)">
Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector4.INF].
</constant>
</constants>
<operators>
<operator name="operator !=">
Expand Down

0 comments on commit adc930b

Please sign in to comment.