diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/config/engine.cpp | 36 | ||||
-rw-r--r-- | core/config/engine.h | 2 | ||||
-rw-r--r-- | core/core_bind.cpp | 6 | ||||
-rw-r--r-- | core/core_bind.h | 2 | ||||
-rw-r--r-- | core/extension/native_extension.cpp | 7 | ||||
-rw-r--r-- | core/math/vector4.cpp | 4 | ||||
-rw-r--r-- | core/math/vector4.h | 1 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 10 |
8 files changed, 65 insertions, 3 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 1a6093869f..e1da9eb44e 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -181,6 +181,42 @@ String Engine::get_license_text() const { return String(GODOT_LICENSE_TEXT); } +String Engine::get_architecture_name() const { +#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) + return "x86_64"; + +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) + return "x86_32"; + +#elif defined(__aarch64__) || defined(_M_ARM64) + return "arm64"; + +#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) + return "armv7"; + +#elif defined(__riscv) +#if __riscv_xlen == 8 + return "rv64"; +#else + return "riscv"; +#endif + +#elif defined(__powerpc__) +#if defined(__powerpc64__) + return "ppc64"; +#else + return "ppc"; +#endif + +#elif defined(__wasm__) +#if defined(__wasm64__) + return "wasm64"; +#elif defined(__wasm32__) + return "wasm32"; +#endif +#endif +} + bool Engine::is_abort_on_gpu_errors_enabled() const { return abort_on_gpu_errors; } diff --git a/core/config/engine.h b/core/config/engine.h index 68562643e7..649be23717 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -142,6 +142,8 @@ public: void set_write_movie_path(const String &p_path); String get_write_movie_path() const; + String get_architecture_name() const; + void set_shader_cache_path(const String &p_path); String get_shader_cache_path() const; diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 56130134a0..630bd68e65 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -2270,6 +2270,10 @@ String Engine::get_license_text() const { return ::Engine::get_singleton()->get_license_text(); } +String Engine::get_architecture_name() const { + return ::Engine::get_singleton()->get_architecture_name(); +} + bool Engine::is_in_physics_frame() const { return ::Engine::get_singleton()->is_in_physics_frame(); } @@ -2367,6 +2371,8 @@ void Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_license_info"), &Engine::get_license_info); ClassDB::bind_method(D_METHOD("get_license_text"), &Engine::get_license_text); + ClassDB::bind_method(D_METHOD("get_architecture_name"), &Engine::get_architecture_name); + ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &Engine::is_in_physics_frame); ClassDB::bind_method(D_METHOD("has_singleton", "name"), &Engine::has_singleton); diff --git a/core/core_bind.h b/core/core_bind.h index 98bf34e07d..79230bd685 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -666,6 +666,8 @@ public: Dictionary get_license_info() const; String get_license_text() const; + String get_architecture_name() const; + bool is_in_physics_frame() const; bool has_singleton(const StringName &p_name) const; diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp index b69859b441..a085df874e 100644 --- a/core/extension/native_extension.cpp +++ b/core/extension/native_extension.cpp @@ -372,7 +372,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St } if (err != OK) { - ERR_PRINT("Error loading GDExtension config file: " + p_path); + ERR_PRINT("Error loading GDExtension configuration file: " + p_path); return Ref<Resource>(); } @@ -380,7 +380,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St if (r_error) { *r_error = ERR_INVALID_DATA; } - ERR_PRINT("GDExtension config file must contain 'configuration.entry_symbol' key: " + p_path); + ERR_PRINT("GDExtension configuration file must contain a \"configuration/entry_symbol\" key: " + p_path); return Ref<Resource>(); } @@ -413,7 +413,8 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St if (r_error) { *r_error = ERR_FILE_NOT_FOUND; } - ERR_PRINT("No GDExtension library found for current architecture; in config file " + p_path); + const String os_arch = OS::get_singleton()->get_name().to_lower() + "." + Engine::get_singleton()->get_architecture_name(); + ERR_PRINT(vformat("No GDExtension library found for current OS and architecture (%s) in configuration file: %s", os_arch, p_path)); return Ref<Resource>(); } 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)); |