summaryrefslogtreecommitdiffstats
path: root/core/math/dynamic_bvh.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/dynamic_bvh.h')
-rw-r--r--core/math/dynamic_bvh.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 968badc093..c71db2d24d 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -34,6 +34,7 @@
#include "core/math/aabb.h"
#include "core/templates/list.h"
#include "core/templates/local_vector.h"
+#include "core/templates/paged_allocator.h"
#include "core/typedefs.h"
// Based on bullet Dbvh
@@ -217,6 +218,7 @@ private:
}
};
+ PagedAllocator<Node> node_allocator;
// Fields
Node *bvh_root = nullptr;
int lkhd = -1;
@@ -276,7 +278,7 @@ private:
public:
// Methods
void clear();
- bool empty() const { return (0 == bvh_root); }
+ bool is_empty() const { return (0 == bvh_root); }
void optimize_bottom_up();
void optimize_top_down(int bu_threshold = 128);
void optimize_incremental(int passes);
@@ -330,7 +332,7 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) {
if (n->volume.intersects(volume)) {
if (n->is_internal()) {
if (depth > threshold) {
- if (aux_stack.empty()) {
+ if (aux_stack.is_empty()) {
aux_stack.resize(ALLOCA_STACK_SIZE * 2);
copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *));
} else {
@@ -386,7 +388,7 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve
if (n->volume.intersects(volume) && n->volume.intersects_convex(p_planes, p_plane_count, p_points, p_point_count)) {
if (n->is_internal()) {
if (depth > threshold) {
- if (aux_stack.empty()) {
+ if (aux_stack.is_empty()) {
aux_stack.resize(ALLOCA_STACK_SIZE * 2);
copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *));
} else {
@@ -443,7 +445,7 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu
if (result1) {
if (node->is_internal()) {
if (depth > threshold) {
- if (aux_stack.empty()) {
+ if (aux_stack.is_empty()) {
aux_stack.resize(ALLOCA_STACK_SIZE * 2);
copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *));
} else {