Compare commits
9 Commits
2516d688ab
...
072c576a82
Author | SHA1 | Date |
---|---|---|
|
072c576a82 | |
|
dd62b9685f | |
|
8d13acca91 | |
|
b1769a70f0 | |
|
b733102f4a | |
|
718d0baea3 | |
|
b77cb648c3 | |
|
6b02a58e5a | |
|
79a0d64f8a |
|
@ -6,6 +6,7 @@
|
||||||
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one.
|
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one.
|
||||||
# GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors
|
# GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors
|
||||||
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
|
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
|
||||||
|
# GODOT_CPP_INSTALL: Enables target install for exporting godot-cpp cmake configuration
|
||||||
# FLOAT_PRECISION: Floating-point precision level ("single", "double")
|
# FLOAT_PRECISION: Floating-point precision level ("single", "double")
|
||||||
#
|
#
|
||||||
# Android cmake arguments
|
# Android cmake arguments
|
||||||
|
@ -43,6 +44,8 @@ project(godot-cpp LANGUAGES CXX)
|
||||||
option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON)
|
option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON)
|
||||||
option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
|
option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
|
||||||
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
|
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
|
||||||
|
option(GODOT_CPP_INSTALL "Enables target install for exporting godot-cpp cmake configuration" ON)
|
||||||
|
|
||||||
|
|
||||||
# Add path to modules
|
# Add path to modules
|
||||||
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
|
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
|
||||||
|
@ -65,7 +68,7 @@ if(NOT DEFINED BITS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Input from user for GDExtension interface header and the API JSON file
|
# Input from user for GDExtension interface header and the API JSON file
|
||||||
set(GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "")
|
set(GODOT_GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gdextension" CACHE STRING "")
|
||||||
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
|
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
|
||||||
|
|
||||||
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
|
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
|
||||||
|
@ -183,9 +186,10 @@ if (GODOT_CPP_SYSTEM_HEADERS)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
|
target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
|
||||||
include
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gen/include
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen/include>
|
||||||
${GODOT_GDEXTENSION_DIR}
|
$<BUILD_INTERFACE:${GODOT_GDEXTENSION_DIR}>
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add the compile flags
|
# Add the compile flags
|
||||||
|
@ -214,3 +218,43 @@ set_target_properties(${PROJECT_NAME}
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
||||||
OUTPUT_NAME "${OUTPUT_NAME}"
|
OUTPUT_NAME "${OUTPUT_NAME}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ($CACHE{GODOT_CPP_INSTALL})
|
||||||
|
install(TARGETS ${PROJECT_NAME}
|
||||||
|
EXPORT GodotCppTargets
|
||||||
|
)
|
||||||
|
|
||||||
|
install(EXPORT GodotCppTargets
|
||||||
|
FILE GodotCppTargets.cmake
|
||||||
|
NAMESPACE godot::
|
||||||
|
DESTINATION lib/cmake/GodotCpp
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
if (GODOT_GDEXTENSION_DIR AND EXISTS ${GODOT_GDEXTENSION_DIR})
|
||||||
|
install(DIRECTORY ${GODOT_GDEXTENSION_DIR}/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GodotCppConfig.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake"
|
||||||
|
INSTALL_DESTINATION "lib/cmake/GodotCpp"
|
||||||
|
NO_SET_AND_CHECK_MACRO
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake
|
||||||
|
DESTINATION lib/cmake/GodotCpp
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/GodotCppTargets.cmake")
|
|
@ -281,13 +281,13 @@ void call_with_variant_args(T *p_instance, void (T::*p_method)(P...), const Vari
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -299,13 +299,13 @@ void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Var
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -317,13 +317,13 @@ void call_with_variant_args_retc(T *p_instance, R (T::*p_method)(P...) const, co
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -335,7 +335,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -346,7 +346,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -370,7 +370,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -381,7 +381,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -405,7 +405,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -416,7 +416,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -440,7 +440,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -451,7 +451,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -552,7 +552,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionC
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -563,7 +563,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionC
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -597,13 +597,13 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -615,13 +615,13 @@ void call_with_variant_args_static_ret(void (*p_method)(P...), const Variant **p
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -644,7 +644,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtension
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -655,7 +655,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtension
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,6 +117,9 @@ struct _NO_DISCARD_ Vector2i {
|
||||||
int64_t length_squared() const;
|
int64_t length_squared() const;
|
||||||
double length() const;
|
double length() const;
|
||||||
|
|
||||||
|
int64_t distance_squared_to(const Vector2i &p_to) const;
|
||||||
|
double distance_to(const Vector2i &p_to) const;
|
||||||
|
|
||||||
real_t aspect() const { return width / (real_t)height; }
|
real_t aspect() const { return width / (real_t)height; }
|
||||||
Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
|
Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
|
||||||
Vector2i abs() const { return Vector2i(Math::abs(x), Math::abs(y)); }
|
Vector2i abs() const { return Vector2i(Math::abs(x), Math::abs(y)); }
|
||||||
|
|
|
@ -82,6 +82,9 @@ struct _NO_DISCARD_ Vector3i {
|
||||||
_FORCE_INLINE_ int64_t length_squared() const;
|
_FORCE_INLINE_ int64_t length_squared() const;
|
||||||
_FORCE_INLINE_ double length() const;
|
_FORCE_INLINE_ double length() const;
|
||||||
|
|
||||||
|
_FORCE_INLINE_ int64_t distance_squared_to(const Vector3i &p_to) const;
|
||||||
|
_FORCE_INLINE_ double distance_to(const Vector3i &p_to) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ void zero();
|
_FORCE_INLINE_ void zero();
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3i abs() const;
|
_FORCE_INLINE_ Vector3i abs() const;
|
||||||
|
@ -136,6 +139,14 @@ double Vector3i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector3i::distance_squared_to(const Vector3i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector3i::distance_to(const Vector3i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector3i Vector3i::abs() const {
|
Vector3i Vector3i::abs() const {
|
||||||
return Vector3i(Math::abs(x), Math::abs(y), Math::abs(z));
|
return Vector3i(Math::abs(x), Math::abs(y), Math::abs(z));
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,9 @@ struct _NO_DISCARD_ Vector4i {
|
||||||
_FORCE_INLINE_ int64_t length_squared() const;
|
_FORCE_INLINE_ int64_t length_squared() const;
|
||||||
_FORCE_INLINE_ double length() const;
|
_FORCE_INLINE_ double length() const;
|
||||||
|
|
||||||
|
_FORCE_INLINE_ int64_t distance_squared_to(const Vector4i &p_to) const;
|
||||||
|
_FORCE_INLINE_ double distance_to(const Vector4i &p_to) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ void zero();
|
_FORCE_INLINE_ void zero();
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector4i abs() const;
|
_FORCE_INLINE_ Vector4i abs() const;
|
||||||
|
@ -140,6 +143,14 @@ double Vector4i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector4i::distance_squared_to(const Vector4i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector4i::distance_to(const Vector4i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector4i Vector4i::abs() const {
|
Vector4i Vector4i::abs() const {
|
||||||
return Vector4i(Math::abs(x), Math::abs(y), Math::abs(z), Math::abs(w));
|
return Vector4i(Math::abs(x), Math::abs(y), Math::abs(z), Math::abs(w));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,14 @@ double Vector2i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector2i::distance_squared_to(const Vector2i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector2i::distance_to(const Vector2i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector2i Vector2i::operator+(const Vector2i &p_v) const {
|
Vector2i Vector2i::operator+(const Vector2i &p_v) const {
|
||||||
return Vector2i(x + p_v.x, y + p_v.y);
|
return Vector2i(x + p_v.x, y + p_v.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,12 @@ def generate(env):
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
toolchain += "darwin-x86_64"
|
toolchain += "darwin-x86_64"
|
||||||
env.Append(LINKFLAGS=["-shared"])
|
env.Append(LINKFLAGS=["-shared"])
|
||||||
|
|
||||||
|
if not os.path.exists(toolchain):
|
||||||
|
print("ERROR: Could not find NDK toolchain at " + toolchain + ".")
|
||||||
|
print("Make sure NDK version " + get_ndk_version() + " is installed.")
|
||||||
|
env.Exit(1)
|
||||||
|
|
||||||
env.PrependENVPath("PATH", toolchain + "/bin") # This does nothing half of the time, but we'll put it here anyways
|
env.PrependENVPath("PATH", toolchain + "/bin") # This does nothing half of the time, but we'll put it here anyways
|
||||||
|
|
||||||
# Get architecture info
|
# Get architecture info
|
||||||
|
|
Loading…
Reference in New Issue