mirror of
https://github.com/Relintai/godot_voxel.git
synced 2025-04-17 05:46:32 +02: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.
|
// Builds the octree bottom-up, to ensure that no detail can be missed by a top-down approach.
|
||||||
class OctreeBuilderBottomUp {
|
class OctreeBuilderBottomUp {
|
||||||
public:
|
public:
|
||||||
@ -293,6 +283,16 @@ private:
|
|||||||
const float _geometry_error;
|
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) {
|
Ref<ArrayMesh> generate_debug_octree_mesh(OctreeNode *root) {
|
||||||
|
|
||||||
struct GetMaxDepth {
|
struct GetMaxDepth {
|
||||||
|
Loading…
Reference in New Issue
Block a user