From f5808f43b57033dbf8d61e0bfcb05726e17c02ef Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 6 May 2013 16:24:09 -0700 Subject: [PATCH] some cleanup pre CR --- interface/src/VoxelSystem.cpp | 4 ++-- libraries/voxels/src/VoxelNode.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 1f5ce93283..1679526b82 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -212,7 +212,7 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { } node->setShouldRender(shouldRender); // let children figure out their renderness - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { if (node->getChildAtIndex(i)) { voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i)); } @@ -595,7 +595,7 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) { VoxelSystem* thisVoxelSystem = (VoxelSystem*) extraData; _nodeCount++; // Need to operate on our child nodes, so we can remove them - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { VoxelNode* childNode = node->getChildAtIndex(i); if (childNode && !childNode->isInView(*thisVoxelSystem->_viewFrustum)) { node->removeChildAtIndex(i); diff --git a/libraries/voxels/src/VoxelNode.cpp b/libraries/voxels/src/VoxelNode.cpp index 7f6d422fff..95e71b2b76 100644 --- a/libraries/voxels/src/VoxelNode.cpp +++ b/libraries/voxels/src/VoxelNode.cpp @@ -37,7 +37,7 @@ void VoxelNode::init(unsigned char * octalCode) { #endif // default pointers to child nodes to NULL - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { _children[i] = NULL; } @@ -52,7 +52,7 @@ VoxelNode::~VoxelNode() { delete[] _octalCode; // delete all of this node's children - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { if (_children[i]) { delete _children[i]; } @@ -115,7 +115,7 @@ void VoxelNode::addChildAtIndex(int childIndex) { // will average the child colors... void VoxelNode::setColorFromAverageOfChildren() { int colorArray[4] = {0,0,0,0}; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { if (_children[i] && _children[i]->isColored()) { for (int j = 0; j < 3; j++) { colorArray[j] += _children[i]->getTrueColor()[j]; // color averaging should always be based on true colors @@ -194,7 +194,7 @@ bool VoxelNode::collapseIdenticalLeaves() { // scan children, verify that they are ALL present and accounted for bool allChildrenMatch = true; // assume the best (ottimista) int red,green,blue; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { // if no child, or child doesn't have a color if (!_children[i] || !_children[i]->isColored()) { allChildrenMatch=false; @@ -216,7 +216,7 @@ bool VoxelNode::collapseIdenticalLeaves() { if (allChildrenMatch) { //printLog("allChildrenMatch: pruning tree\n"); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { delete _children[i]; // delete all the child nodes _children[i]=NULL; // set it to NULL } @@ -241,7 +241,7 @@ void VoxelNode::setRandomColor(int minimumBrightness) { } bool VoxelNode::isLeaf() const { - for (int i = 0; i < 8; i++) { + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { if (_children[i]) { return false; }