some cleanup pre CR

This commit is contained in:
ZappoMan 2013-05-06 16:24:09 -07:00
parent 9fb57feb3b
commit f5808f43b5
2 changed files with 8 additions and 8 deletions

View file

@ -212,7 +212,7 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) {
} }
node->setShouldRender(shouldRender); node->setShouldRender(shouldRender);
// let children figure out their renderness // 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)) { if (node->getChildAtIndex(i)) {
voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i)); voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i));
} }
@ -595,7 +595,7 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) {
VoxelSystem* thisVoxelSystem = (VoxelSystem*) extraData; VoxelSystem* thisVoxelSystem = (VoxelSystem*) extraData;
_nodeCount++; _nodeCount++;
// Need to operate on our child nodes, so we can remove them // 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); VoxelNode* childNode = node->getChildAtIndex(i);
if (childNode && !childNode->isInView(*thisVoxelSystem->_viewFrustum)) { if (childNode && !childNode->isInView(*thisVoxelSystem->_viewFrustum)) {
node->removeChildAtIndex(i); node->removeChildAtIndex(i);

View file

@ -37,7 +37,7 @@ void VoxelNode::init(unsigned char * octalCode) {
#endif #endif
// default pointers to child nodes to NULL // 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; _children[i] = NULL;
} }
@ -52,7 +52,7 @@ VoxelNode::~VoxelNode() {
delete[] _octalCode; delete[] _octalCode;
// delete all of this node's children // 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]) { if (_children[i]) {
delete _children[i]; delete _children[i];
} }
@ -115,7 +115,7 @@ void VoxelNode::addChildAtIndex(int childIndex) {
// will average the child colors... // will average the child colors...
void VoxelNode::setColorFromAverageOfChildren() { void VoxelNode::setColorFromAverageOfChildren() {
int colorArray[4] = {0,0,0,0}; 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()) { if (_children[i] && _children[i]->isColored()) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
colorArray[j] += _children[i]->getTrueColor()[j]; // color averaging should always be based on true colors 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 // scan children, verify that they are ALL present and accounted for
bool allChildrenMatch = true; // assume the best (ottimista) bool allChildrenMatch = true; // assume the best (ottimista)
int red,green,blue; 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 no child, or child doesn't have a color
if (!_children[i] || !_children[i]->isColored()) { if (!_children[i] || !_children[i]->isColored()) {
allChildrenMatch=false; allChildrenMatch=false;
@ -216,7 +216,7 @@ bool VoxelNode::collapseIdenticalLeaves() {
if (allChildrenMatch) { if (allChildrenMatch) {
//printLog("allChildrenMatch: pruning tree\n"); //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 delete _children[i]; // delete all the child nodes
_children[i]=NULL; // set it to NULL _children[i]=NULL; // set it to NULL
} }
@ -241,7 +241,7 @@ void VoxelNode::setRandomColor(int minimumBrightness) {
} }
bool VoxelNode::isLeaf() const { bool VoxelNode::isLeaf() const {
for (int i = 0; i < 8; i++) { for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
if (_children[i]) { if (_children[i]) {
return false; return false;
} }