diff --git a/shared/src/VoxelTree.cpp b/shared/src/VoxelTree.cpp index 728e2e6d08..085315ad86 100644 --- a/shared/src/VoxelTree.cpp +++ b/shared/src/VoxelTree.cpp @@ -384,6 +384,21 @@ void VoxelTree::printTreeForDebugging(VoxelNode *startNode) { } } +void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { + bool hasChildren; + + for (int i = 0; i < 8; i++) { + if (startNode->children[i] != NULL) { + reaverageVoxelColors(startNode->children[i]); + hasChildren = true; + } + } + + if (hasChildren) { + startNode->setColorFromAverageOfChildren(); + } + +} ////////////////////////////////////////////////////////////////////////////////////////// // Method: VoxelTree::loadVoxelsFile() // Description: Loads HiFidelity encoded Voxels from a binary file. The current file diff --git a/shared/src/VoxelTree.h b/shared/src/VoxelTree.h index 0a76ff49b4..6b0da733e2 100644 --- a/shared/src/VoxelTree.h +++ b/shared/src/VoxelTree.h @@ -30,6 +30,7 @@ public: void readBitstreamToTree(unsigned char * bitstream, int bufferSizeBytes); void readCodeColorBufferToTree(unsigned char *codeColorBuffer); void printTreeForDebugging(VoxelNode *startNode); + void reaverageVoxelColors(VoxelNode *startNode); unsigned char * loadBitstreamBuffer(unsigned char *& bitstreamBuffer, VoxelNode *currentVoxelNode, MarkerNode *currentMarkerNode,