History

add 'level' param to tree recursion

ZappoMan committed 13 years ago

Commit 44357fc1 parent 1f0df9a9 files · +67 −52Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 9 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+14−14
@@ -701,7 +701,7 @@ void VoxelSystem::killLocalVoxels() { · 700 unmodified lines
701}701}
702 702
703 703
704bool VoxelSystem::randomColorOperation(VoxelNode* node, void* extraData) {704bool VoxelSystem::randomColorOperation(VoxelNode* node, int level, void* extraData) {
705 _nodeCount++;705 _nodeCount++;
706 if (node->isColored()) {706 if (node->isColored()) {
707 nodeColor newColor = { 255, randomColorValue(150), randomColorValue(150), 1 };707 nodeColor newColor = { 255, randomColorValue(150), randomColorValue(150), 1 };
@@ -717,7 +717,7 @@ void VoxelSystem::randomizeVoxelColors() { · 9 unmodified lines
717 setupNewVoxelsForDrawing();717 setupNewVoxelsForDrawing();
718}718}
719 719
720bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, void* extraData) {720bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, int level, void* extraData) {
721 _nodeCount++;721 _nodeCount++;
722 // always false colorize722 // always false colorize
723 node->setFalseColor(255, randomColorValue(150), randomColorValue(150));723 node->setFalseColor(255, randomColorValue(150), randomColorValue(150));
@@ -731,7 +731,7 @@ void VoxelSystem::falseColorizeRandom() { · 7 unmodified lines
731 setupNewVoxelsForDrawing();731 setupNewVoxelsForDrawing();
732}732}
733 733
734bool VoxelSystem::trueColorizeOperation(VoxelNode* node, void* extraData) {734bool VoxelSystem::trueColorizeOperation(VoxelNode* node, int level, void* extraData) {
735 _nodeCount++;735 _nodeCount++;
736 node->setFalseColored(false);736 node->setFalseColored(false);
737 return true;737 return true;
@@ -746,7 +746,7 @@ void VoxelSystem::trueColorize() { · 8 unmodified lines
746}746}
747 747
748// Will false colorize voxels that are not in view748// Will false colorize voxels that are not in view
749bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) {749bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, int level, void* extraData) {
750 const ViewFrustum* viewFrustum = (const ViewFrustum*) extraData;750 const ViewFrustum* viewFrustum = (const ViewFrustum*) extraData;
751 _nodeCount++;751 _nodeCount++;
752 if (node->isColored()) {752 if (node->isColored()) {
@@ -766,7 +766,7 @@ void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) { · 13 unmodified lines
766}766}
767 767
768// Will false colorize voxels based on distance from view768// Will false colorize voxels based on distance from view
769bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, void* extraData) {769bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, int level, void* extraData) {
770 ViewFrustum* viewFrustum = (ViewFrustum*) extraData;770 ViewFrustum* viewFrustum = (ViewFrustum*) extraData;
771 if (node->isColored()) {771 if (node->isColored()) {
772 float distance = node->distanceToCamera(*viewFrustum);772 float distance = node->distanceToCamera(*viewFrustum);
@@ -789,7 +789,7 @@ float VoxelSystem::_minDistance = FLT_MAX; · 16 unmodified lines
789// Helper function will get the distance from view range, would be nice if you could just keep track789// Helper function will get the distance from view range, would be nice if you could just keep track
790// of this as voxels are created and/or colored... seems like some transform math could do that so790// of this as voxels are created and/or colored... seems like some transform math could do that so
791// we wouldn't need to do two passes of the tree791// we wouldn't need to do two passes of the tree
792bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, void* extraData) {792bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, int level, void* extraData) {
793 ViewFrustum* viewFrustum = (ViewFrustum*) extraData;793 ViewFrustum* viewFrustum = (ViewFrustum*) extraData;
794 // only do this for truly colored voxels...794 // only do this for truly colored voxels...
795 if (node->isColored()) {795 if (node->isColored()) {
@@ -842,7 +842,7 @@ public: · 46 unmodified lines
842 842
843// "Remove" voxels from the tree that are not in view. We don't actually delete them,843// "Remove" voxels from the tree that are not in view. We don't actually delete them,
844// we remove them from the tree and place them into a holding area for later deletion844// we remove them from the tree and place them into a holding area for later deletion
845bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) {845bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, int level, void* extraData) {
846 removeOutOfViewArgs* args = (removeOutOfViewArgs*)extraData;846 removeOutOfViewArgs* args = (removeOutOfViewArgs*)extraData;
847 847
848 // If our node was previously added to the don't recurse bag, then return false to848 // If our node was previously added to the don't recurse bag, then return false to
@@ -977,7 +977,7 @@ public: · 128 unmodified lines
977 bool colorThis;977 bool colorThis;
978};978};
979 979
980bool VoxelSystem::falseColorizeRandomEveryOtherOperation(VoxelNode* node, void* extraData) {980bool VoxelSystem::falseColorizeRandomEveryOtherOperation(VoxelNode* node, int level, void* extraData) {
981 falseColorizeRandomEveryOtherArgs* args = (falseColorizeRandomEveryOtherArgs*)extraData;981 falseColorizeRandomEveryOtherArgs* args = (falseColorizeRandomEveryOtherArgs*)extraData;
982 args->totalNodes++;982 args->totalNodes++;
983 if (node->isColored()) {983 if (node->isColored()) {
@@ -1030,7 +1030,7 @@ public: · 46 unmodified lines
1030 bool hasIndexFound[MAX_VOXELS_PER_SYSTEM];1030 bool hasIndexFound[MAX_VOXELS_PER_SYSTEM];
1031};1031};
1032 1032
1033bool VoxelSystem::collectStatsForTreesAndVBOsOperation(VoxelNode* node, void* extraData) {1033bool VoxelSystem::collectStatsForTreesAndVBOsOperation(VoxelNode* node, int level, void* extraData) {
1034 collectStatsForTreesAndVBOsArgs* args = (collectStatsForTreesAndVBOsArgs*)extraData;1034 collectStatsForTreesAndVBOsArgs* args = (collectStatsForTreesAndVBOsArgs*)extraData;
1035 args->totalNodes++;1035 args->totalNodes++;
1036 1036
@@ -1182,7 +1182,7 @@ struct FalseColorizeSubTreeOperationArgs { · 145 unmodified lines
1182 long voxelsTouched;1182 long voxelsTouched;
1183};1183};
1184 1184
1185bool VoxelSystem::falseColorizeSubTreeOperation(VoxelNode* node, void* extraData) {1185bool VoxelSystem::falseColorizeSubTreeOperation(VoxelNode* node, int level, void* extraData) {
1186 if (node->getShouldRender()) {1186 if (node->getShouldRender()) {
1187 FalseColorizeSubTreeOperationArgs* args = (FalseColorizeSubTreeOperationArgs*) extraData;1187 FalseColorizeSubTreeOperationArgs* args = (FalseColorizeSubTreeOperationArgs*) extraData;
1188 node->setFalseColor(args->color[0], args->color[1], args->color[2]);1188 node->setFalseColor(args->color[0], args->color[1], args->color[2]);
@@ -1191,7 +1191,7 @@ bool VoxelSystem::falseColorizeSubTreeOperation(VoxelNode* node, void* extraData · 2 unmodified lines
1191 return true; 1191 return true;
1192}1192}
1193 1193
1194bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraData) {1194bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, int level, void* extraData) {
1195 1195
1196 FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData;1196 FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData;
1197 args->totalVoxels++;1197 args->totalVoxels++;
@@ -1228,7 +1228,7 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat · 30 unmodified lines
1228 subArgs.color[2] = 0;1228 subArgs.color[2] = 0;
1229 subArgs.voxelsTouched = 0;1229 subArgs.voxelsTouched = 0;
1230 1230
1231 args->tree->recurseNodeWithOperation(node, falseColorizeSubTreeOperation, &subArgs );1231 args->tree->recurseNodeWithOperation(node, level, falseColorizeSubTreeOperation, &subArgs );
1232 1232
1233 args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1);1233 args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1);
1234 args->totalVoxels += (subArgs.voxelsTouched - 1);1234 args->totalVoxels += (subArgs.voxelsTouched - 1);
@@ -1312,7 +1312,7 @@ void VoxelSystem::falseColorizeOccluded() { · 77 unmodified lines
1312 setupNewVoxelsForDrawing();1312 setupNewVoxelsForDrawing();
1313}1313}
1314 1314
1315bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraData) {1315bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, int level, void* extraData) {
1316 1316
1317 FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData;1317 FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData;
1318 args->totalVoxels++;1318 args->totalVoxels++;
@@ -1349,7 +1349,7 @@ bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraD · 30 unmodified lines
1349 subArgs.color[2] = 0;1349 subArgs.color[2] = 0;
1350 subArgs.voxelsTouched = 0;1350 subArgs.voxelsTouched = 0;
1351 1351
1352 args->tree->recurseNodeWithOperation(node, falseColorizeSubTreeOperation, &subArgs );1352 args->tree->recurseNodeWithOperation(node, level, falseColorizeSubTreeOperation, &subArgs );
1353 1353
1354 args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1);1354 args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1);
1355 args->totalVoxels += (subArgs.voxelsTouched - 1);1355 args->totalVoxels += (subArgs.voxelsTouched - 1);