From adc930baee53053c44e0a90d237c057b3e0416c2 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 16 Sep 2023 16:40:21 +0200 Subject: [PATCH] Add Vector2/3/4i.MAX and MIN --- core/variant/variant_call.cpp | 6 ++++++ doc/classes/Vector2i.xml | 6 ++++++ doc/classes/Vector3i.xml | 6 ++++++ doc/classes/Vector4i.xml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 19ae1b01577..772a540d22d 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -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)); diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index ccb5bb78153..2100cd76121 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -124,6 +124,12 @@ One vector, a vector with all components set to [code]1[/code]. + + 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]. + + + Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector2.INF]. + Left unit vector. Represents the direction of left. diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index 90cb70f3478..8906bf0aa71 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -125,6 +125,12 @@ One vector, a vector with all components set to [code]1[/code]. + + 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]. + + + Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector3.INF]. + Left unit vector. Represents the local direction of left, and the global direction of west. diff --git a/doc/classes/Vector4i.xml b/doc/classes/Vector4i.xml index f2eb353b5a9..a612c135ddc 100644 --- a/doc/classes/Vector4i.xml +++ b/doc/classes/Vector4i.xml @@ -129,6 +129,12 @@ One vector, a vector with all components set to [code]1[/code]. + + 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]. + + + Max vector, a vector with all components equal to [code]INT32_MAX[/code]. Can be used as an integer equivalent of [constant Vector4.INF]. +