Move this code closer to what uses it

This commit is contained in:
Marc Gilleron 2019-04-22 21:15:45 +01:00
parent 1defe3bdbd
commit 572dcbf680

View File

@ -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 {