add a method to VoxelTree to reaverage the voxel colors

This commit is contained in:
Stephen Birarda 2013-03-28 16:22:37 -07:00
parent a7f74a9f40
commit f85abe53ef
2 changed files with 16 additions and 0 deletions

View file

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

View file

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