Skip to content

Commit

Permalink
Dynamic BVH for rendering and godot physics
Browse files Browse the repository at this point in the history
Complete rewrite of spatial partitioning using a bounding volume hierarchy rather than octree.

Switchable in project settings between using octree or BVH for rendering and physics.
  • Loading branch information
lawnjelly committed Jan 12, 2021
1 parent 0a8cc0a commit 690e07b
Show file tree
Hide file tree
Showing 23 changed files with 3,647 additions and 38 deletions.
13 changes: 13 additions & 0 deletions core/local_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ class LocalVector {
}
}

// Removes the item copying the last value into the position of the one to
// remove. It's generally faster than `remove`.
void remove_unordered(U p_index) {
ERR_FAIL_INDEX(p_index, count);
count--;
if (count > p_index) {
data[p_index] = data[count];
}
if (!__has_trivial_destructor(T) && !force_trivial) {
data[count].~T();
}
}

void erase(const T &p_val) {
int64_t idx = find(p_val);
if (idx >= 0) {
Expand Down
Loading

0 comments on commit 690e07b

Please sign in to comment.