From b8c64184c628dba6b54b4beb5a38e292a182bd6f Mon Sep 17 00:00:00 2001 From: reduz Date: Tue, 13 Oct 2020 15:59:37 -0300 Subject: Refactored binding system for core types Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access. --- core/math/aabb.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/math/aabb.cpp') diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp index f5c667dab0..e868ebc7c8 100644 --- a/core/math/aabb.cpp +++ b/core/math/aabb.cpp @@ -31,6 +31,7 @@ #include "aabb.h" #include "core/print_string.h" +#include "core/variant.h" real_t AABB::get_area() const { return size.x * size.y * size.z; @@ -375,6 +376,21 @@ void AABB::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const { } } +Variant AABB::intersects_segment_bind(const Vector3 &p_from, const Vector3 &p_to) const { + Vector3 inters; + if (intersects_segment(p_from, p_to, &inters)) { + return inters; + } + return Variant(); +} +Variant AABB::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const { + Vector3 inters; + if (intersects_ray(p_from, p_dir, &inters)) { + return inters; + } + return Variant(); +} + AABB::operator String() const { return String() + position + " - " + size; } -- cgit v1.2.3