summaryrefslogtreecommitdiffstats
path: root/core/math/plane.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/plane.cpp
parentbc91e088e4503bbf1c5800282f2974011a4cc8e8 (diff)
downloadredot-engine-b8c64184c628dba6b54b4beb5a38e292a182bd6f.tar.gz
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/plane.cpp')
-rw-r--r--core/math/plane.cpp26
1 files changed, 26 insertions, 0 deletions
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 {