summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
Diffstat (limited to 'core/math')
-rw-r--r--core/math/dynamic_bvh.cpp4
-rw-r--r--core/math/dynamic_bvh.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index e66de5037d..23e713dd2d 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -31,7 +31,7 @@
#include "dynamic_bvh.h"
void DynamicBVH::_delete_node(Node *p_node) {
- memdelete(p_node);
+ node_allocator.free(p_node);
}
void DynamicBVH::_recurse_delete_node(Node *p_node) {
@@ -46,7 +46,7 @@ void DynamicBVH::_recurse_delete_node(Node *p_node) {
}
DynamicBVH::Node *DynamicBVH::_create_node(Node *p_parent, void *p_data) {
- Node *node = memnew(Node);
+ Node *node = node_allocator.alloc();
node->parent = p_parent;
node->data = p_data;
return (node);
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 968badc093..ecf2feb3d8 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -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;