summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/math/vector4.cpp4
-rw-r--r--core/math/vector4.h1
-rw-r--r--core/variant/variant_call.cpp10
3 files changed, 15 insertions, 0 deletions
diff --git a/core/math/vector4.cpp b/core/math/vector4.cpp
index 4697c311b4..1dd5adad2b 100644
--- a/core/math/vector4.cpp
+++ b/core/math/vector4.cpp
@@ -91,6 +91,10 @@ real_t Vector4::distance_to(const Vector4 &p_to) const {
return (p_to - *this).length();
}
+real_t Vector4::distance_squared_to(const Vector4 &p_to) const {
+ return (p_to - *this).length_squared();
+}
+
Vector4 Vector4::direction_to(const Vector4 &p_to) const {
Vector4 ret(p_to.x - x, p_to.y - y, p_to.z - z, p_to.w - w);
ret.normalize();
diff --git a/core/math/vector4.h b/core/math/vector4.h
index 373a6a1218..d26fe15941 100644
--- a/core/math/vector4.h
+++ b/core/math/vector4.h
@@ -79,6 +79,7 @@ struct _NO_DISCARD_ Vector4 {
bool is_normalized() const;
real_t distance_to(const Vector4 &p_to) const;
+ real_t distance_squared_to(const Vector4 &p_to) const;
Vector4 direction_to(const Vector4 &p_to) const;
Vector4 abs() const;
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 5c298f9b3b..eba12b68bb 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1746,6 +1746,7 @@ static void _register_variant_builtin_methods() {
bind_method(Vector4, is_normalized, sarray(), varray());
bind_method(Vector4, direction_to, sarray("to"), varray());
bind_method(Vector4, distance_to, sarray("to"), varray());
+ bind_method(Vector4, distance_squared_to, sarray("to"), varray());
bind_method(Vector4, dot, sarray("with"), varray());
bind_method(Vector4, inverse, sarray(), varray());
bind_method(Vector4, is_equal_approx, sarray("with"), varray());
@@ -2067,6 +2068,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedByteArray, insert, sarray("at_index", "value"), varray());
bind_method(PackedByteArray, fill, sarray("value"), varray());
bind_methodv(PackedByteArray, resize, &PackedByteArray::resize_zeroed, sarray("new_size"), varray());
+ bind_method(PackedByteArray, clear, sarray(), varray());
bind_method(PackedByteArray, has, sarray("value"), varray());
bind_method(PackedByteArray, reverse, sarray(), varray());
bind_method(PackedByteArray, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2131,6 +2133,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedInt32Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedInt32Array, fill, sarray("value"), varray());
bind_methodv(PackedInt32Array, resize, &PackedInt32Array::resize_zeroed, sarray("new_size"), varray());
+ bind_method(PackedInt32Array, clear, sarray(), varray());
bind_method(PackedInt32Array, has, sarray("value"), varray());
bind_method(PackedInt32Array, reverse, sarray(), varray());
bind_method(PackedInt32Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2154,6 +2157,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedInt64Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedInt64Array, fill, sarray("value"), varray());
bind_methodv(PackedInt64Array, resize, &PackedInt64Array::resize_zeroed, sarray("new_size"), varray());
+ bind_method(PackedInt64Array, clear, sarray(), varray());
bind_method(PackedInt64Array, has, sarray("value"), varray());
bind_method(PackedInt64Array, reverse, sarray(), varray());
bind_method(PackedInt64Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2177,6 +2181,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedFloat32Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedFloat32Array, fill, sarray("value"), varray());
bind_methodv(PackedFloat32Array, resize, &PackedFloat32Array::resize_zeroed, sarray("new_size"), varray());
+ bind_method(PackedFloat32Array, clear, sarray(), varray());
bind_method(PackedFloat32Array, has, sarray("value"), varray());
bind_method(PackedFloat32Array, reverse, sarray(), varray());
bind_method(PackedFloat32Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2200,6 +2205,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedFloat64Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedFloat64Array, fill, sarray("value"), varray());
bind_methodv(PackedFloat64Array, resize, &PackedFloat64Array::resize_zeroed, sarray("new_size"), varray());
+ bind_method(PackedFloat64Array, clear, sarray(), varray());
bind_method(PackedFloat64Array, has, sarray("value"), varray());
bind_method(PackedFloat64Array, reverse, sarray(), varray());
bind_method(PackedFloat64Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2223,6 +2229,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedStringArray, insert, sarray("at_index", "value"), varray());
bind_method(PackedStringArray, fill, sarray("value"), varray());
bind_method(PackedStringArray, resize, sarray("new_size"), varray());
+ bind_method(PackedStringArray, clear, sarray(), varray());
bind_method(PackedStringArray, has, sarray("value"), varray());
bind_method(PackedStringArray, reverse, sarray(), varray());
bind_method(PackedStringArray, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2246,6 +2253,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedVector2Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedVector2Array, fill, sarray("value"), varray());
bind_method(PackedVector2Array, resize, sarray("new_size"), varray());
+ bind_method(PackedVector2Array, clear, sarray(), varray());
bind_method(PackedVector2Array, has, sarray("value"), varray());
bind_method(PackedVector2Array, reverse, sarray(), varray());
bind_method(PackedVector2Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2269,6 +2277,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedVector3Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedVector3Array, fill, sarray("value"), varray());
bind_method(PackedVector3Array, resize, sarray("new_size"), varray());
+ bind_method(PackedVector3Array, clear, sarray(), varray());
bind_method(PackedVector3Array, has, sarray("value"), varray());
bind_method(PackedVector3Array, reverse, sarray(), varray());
bind_method(PackedVector3Array, slice, sarray("begin", "end"), varray(INT_MAX));
@@ -2292,6 +2301,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedColorArray, insert, sarray("at_index", "value"), varray());
bind_method(PackedColorArray, fill, sarray("value"), varray());
bind_method(PackedColorArray, resize, sarray("new_size"), varray());
+ bind_method(PackedColorArray, clear, sarray(), varray());
bind_method(PackedColorArray, has, sarray("value"), varray());
bind_method(PackedColorArray, reverse, sarray(), varray());
bind_method(PackedColorArray, slice, sarray("begin", "end"), varray(INT_MAX));