summaryrefslogtreecommitdiff
path: root/core/math/aabb.cpp
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2020-10-13 15:59:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-10-14 15:24:30 +0200
commitb8c64184c628dba6b54b4beb5a38e292a182bd6f (patch)
tree7ffaba5d7fecfb9d16e0c47a18ffdd98117a2eea /core/math/aabb.cpp
parentbc91e088e4503bbf1c5800282f2974011a4cc8e8 (diff)
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.
Diffstat (limited to 'core/math/aabb.cpp')
-rw-r--r--core/math/aabb.cpp16
1 files changed, 16 insertions, 0 deletions
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;
}