From e57db88c07f5b9e6ce23b2a2e65c49f14935195c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 7 Jun 2013 10:28:25 -0700 Subject: [PATCH] remove redundant calls to reaverageVoxelColors() now only use recursion unwinding --- libraries/voxels/src/VoxelTree.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index ab724d92a9..4e2de6afc6 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -261,7 +261,6 @@ void VoxelTree::deleteVoxelAt(float x, float y, float z, float s, bool stage) { unsigned char* octalCode = pointToVoxel(x,y,z,s,0,0,0); deleteVoxelCodeFromTree(octalCode, stage); delete octalCode; // cleanup memory - reaverageVoxelColors(rootNode); } @@ -365,9 +364,6 @@ void VoxelTree::deleteVoxelCodeFromTreeRecursion(VoxelNode* node, void* extraDat childNode->stageForDeletion(); } else { node->deleteChildAtIndex(childIndex); // note: this will track dirtiness and lastChanged for this node - if (_shouldReaverage) { - node->setColorFromAverageOfChildren(); - } } // track our tree dirtiness @@ -503,7 +499,6 @@ void VoxelTree::processRemoveVoxelBitstream(unsigned char * bitstream, int buffe voxelCode+=voxelDataSize; atByte+=voxelDataSize; } - reaverageVoxelColors(rootNode); // Fix our colors!! Need to call it on rootNode } void VoxelTree::printTreeForDebugging(VoxelNode *startNode) { @@ -552,6 +547,7 @@ void VoxelTree::printTreeForDebugging(VoxelNode *startNode) { } } +// Note: this is an expensive call. Don't call it unless you really need to reaverage the entire tree (from startNode) void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { // if our tree is a reaveraging tree, then we do this, otherwise we don't do anything if (_shouldReaverage) { @@ -785,7 +781,6 @@ void VoxelTree::createSphere(float radius, float xc, float yc, float zc, float v thisRadius += thisVoxelSize; thisVoxelSize = std::max(voxelSize, thisVoxelSize / 2.0f); } - this->reaverageVoxelColors(this->rootNode); } int VoxelTree::searchForColoredNodes(int maxSearchLevel, VoxelNode* node, const ViewFrustum& viewFrustum, VoxelNodeBag& bag,