mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-19 02:47:18 +01:00
Move this code closer to what uses it
This commit is contained in:
parent
1defe3bdbd
commit
572dcbf680
@ -206,16 +206,6 @@ void generate_octree_top_down(OctreeNode *node, const VoxelAccess &voxels, float
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Action_T>
|
||||
void foreach_node(OctreeNode *root, Action_T &a, int depth = 0) {
|
||||
a(root, depth);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (root->children[i]) {
|
||||
foreach_node(root->children[i], a, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Builds the octree bottom-up, to ensure that no detail can be missed by a top-down approach.
|
||||
class OctreeBuilderBottomUp {
|
||||
public:
|
||||
@ -293,6 +283,16 @@ private:
|
||||
const float _geometry_error;
|
||||
};
|
||||
|
||||
template <typename Action_T>
|
||||
void foreach_node(OctreeNode *root, Action_T &a, int depth = 0) {
|
||||
a(root, depth);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (root->children[i]) {
|
||||
foreach_node(root->children[i], a, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ref<ArrayMesh> generate_debug_octree_mesh(OctreeNode *root) {
|
||||
|
||||
struct GetMaxDepth {
|
||||
|
Loading…
Reference in New Issue
Block a user