Add Vector2/3/4i.MAX and MIN

This commit is contained in:
kobewi 2023-09-16 16:40:21 +02:00
parent 5f1e56ff26
commit adc930baee
4 changed files with 24 additions and 0 deletions

View File

@ -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));
@ -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));

View File

@ -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>

View File

@ -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>

View File

@ -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 !=">