From e920a6e873c3f6f02eda95e225311073d048e121 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 29 Mar 2013 08:53:28 -0700 Subject: [PATCH 1/3] tweak --- voxel/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxel/src/main.cpp b/voxel/src/main.cpp index ff20bbcf0e..e680781e2c 100644 --- a/voxel/src/main.cpp +++ b/voxel/src/main.cpp @@ -52,7 +52,7 @@ void addSphere(VoxelTree * tree,bool random, bool wantColorRandomizer) { float xc = random ? randFloatInRange(r,(1-r)) : 0.5; float yc = random ? randFloatInRange(r,(1-r)) : 0.5; float zc = random ? randFloatInRange(r,(1-r)) : 0.5; - float s = (1.0/32); // size of voxels to make up surface of sphere + float s = (1.0/16); // size of voxels to make up surface of sphere bool solid = true; printf("adding sphere:"); From 9e308f4821d5286579c5496bcaabb65421312d43 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 29 Mar 2013 08:59:50 -0700 Subject: [PATCH 2/3] added debugging --- shared/src/VoxelTree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/src/VoxelTree.cpp b/shared/src/VoxelTree.cpp index c51c01a285..1334a62d25 100644 --- a/shared/src/VoxelTree.cpp +++ b/shared/src/VoxelTree.cpp @@ -394,7 +394,7 @@ void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { } if (hasChildren) { - bool childrenCollapsed = startNode->collapseIdenticalLeaves(); + bool childrenCollapsed = false;//startNode->collapseIdenticalLeaves(); if (!childrenCollapsed) { startNode->setColorFromAverageOfChildren(); } @@ -541,4 +541,5 @@ void VoxelTree::createSphere(float r,float xc, float yc, float zc, float s, bool } } this->reaverageVoxelColors(this->rootNode); + this->printTreeForDebugging(this->rootNode); } \ No newline at end of file From f7df625439a8392244af6bcc27982a7c7b772ad9 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 29 Mar 2013 09:12:52 -0700 Subject: [PATCH 3/3] tweak --- shared/src/VoxelNode.cpp | 1 + shared/src/VoxelTree.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/src/VoxelNode.cpp b/shared/src/VoxelNode.cpp index 19a71dc7c4..f16150f438 100644 --- a/shared/src/VoxelNode.cpp +++ b/shared/src/VoxelNode.cpp @@ -97,6 +97,7 @@ bool VoxelNode::collapseIdenticalLeaves() { if (allChildrenMatch) { +printf("allChildrenMatch: pruning tree\n"); for (int i = 0; i < 8; i++) { delete children[i]; // delete all the child nodes children[i]=NULL; // set it to NULL diff --git a/shared/src/VoxelTree.cpp b/shared/src/VoxelTree.cpp index 1334a62d25..55631867b7 100644 --- a/shared/src/VoxelTree.cpp +++ b/shared/src/VoxelTree.cpp @@ -528,7 +528,7 @@ void VoxelTree::createSphere(float r,float xc, float yc, float zc, float s, bool // only use our actual desired color on the outer edge, otherwise // use our "average" color if (ri+(s*2.0)>=r) { - printf("painting candy shell radius: ri=%f r=%f\n",ri,r); + //printf("painting candy shell radius: ri=%f r=%f\n",ri,r); red = wantColorRandomizer ? randomColorValue(165) : r1+((r2-r1)*gradient); green = wantColorRandomizer ? randomColorValue(165) : g1+((g2-g1)*gradient); blue = wantColorRandomizer ? randomColorValue(165) : b1+((b2-b1)*gradient); @@ -536,6 +536,8 @@ void VoxelTree::createSphere(float r,float xc, float yc, float zc, float s, bool unsigned char* voxelData = pointToVoxel(x,y,z,s,red,green,blue); this->readCodeColorBufferToTree(voxelData); + printf("voxel data for x:%f y:%f z:%f s:%f\n",x,y,z,s); + printVoxelCode(voxelData); delete voxelData; } }