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/plane.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'core/math/plane.cpp') diff --git a/core/math/plane.cpp b/core/math/plane.cpp index 4200484c59..ae2021d2f6 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -31,6 +31,7 @@ #include "plane.h" #include "core/math/math_funcs.h" +#include "core/variant.h" void Plane::set_normal(const Vector3 &p_normal) { normal = p_normal; @@ -138,6 +139,31 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec return true; } +Variant Plane::intersect_3_bind(const Plane &p_plane1, const Plane &p_plane2) const { + Vector3 inters; + if (intersect_3(p_plane1, p_plane2, &inters)) { + return inters; + } else { + return Variant(); + } +} +Variant Plane::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const { + Vector3 inters; + if (intersects_ray(p_from, p_dir, &inters)) { + return inters; + } else { + return Variant(); + } +} +Variant Plane::intersects_segment_bind(const Vector3 &p_begin, const Vector3 &p_end) const { + Vector3 inters; + if (intersects_segment(p_begin, p_end, &inters)) { + return inters; + } else { + return Variant(); + } +} + /* misc */ bool Plane::is_equal_approx_any_side(const Plane &p_plane) const { -- cgit v1.2.3