mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 15:33:10 +02:00
printf/pringLog cleanup
This commit is contained in:
parent
ff996c9946
commit
7c180c800f
4 changed files with 11 additions and 52 deletions
|
@ -372,13 +372,7 @@ bool VoxelSystem::randomColorOperation(VoxelNode* node, bool down, void* extraDa
|
|||
newColor[0] = randomColorValue(150);
|
||||
newColor[1] = randomColorValue(150);
|
||||
newColor[1] = randomColorValue(150);
|
||||
|
||||
//printf("randomize color node %d was %x,%x,%x NOW %x,%x,%x\n",
|
||||
// _nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2],
|
||||
// newColor[0],newColor[1],newColor[2]);
|
||||
node->setColor(newColor);
|
||||
} else {
|
||||
//printf("not randomizing color node of %d since it has no color\n",_nodeCount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -386,7 +380,7 @@ bool VoxelSystem::randomColorOperation(VoxelNode* node, bool down, void* extraDa
|
|||
void VoxelSystem::randomizeVoxelColors() {
|
||||
_nodeCount = 0;
|
||||
tree->recurseTreeWithOperation(randomColorOperation);
|
||||
printf("setting randomized true color for %d nodes\n",_nodeCount);
|
||||
printLog("setting randomized true color for %d nodes\n",_nodeCount);
|
||||
setupNewVoxelsForDrawing();
|
||||
}
|
||||
|
||||
|
@ -403,10 +397,6 @@ bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, bool down, void*
|
|||
unsigned char newR = randomColorValue(150);
|
||||
unsigned char newG = randomColorValue(150);
|
||||
unsigned char newB = randomColorValue(150);
|
||||
|
||||
printf("randomize FALSE color node %d was %x,%x,%x NOW %x,%x,%x\n",
|
||||
_nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2],
|
||||
newR,newG,newB);
|
||||
node->setFalseColor(newR,newG,newB);
|
||||
|
||||
return true; // keep going!
|
||||
|
@ -415,7 +405,7 @@ bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, bool down, void*
|
|||
void VoxelSystem::falseColorizeRandom() {
|
||||
_nodeCount = 0;
|
||||
tree->recurseTreeWithOperation(falseColorizeRandomOperation);
|
||||
printf("setting randomized false color for %d nodes\n",_nodeCount);
|
||||
printLog("setting randomized false color for %d nodes\n",_nodeCount);
|
||||
setupNewVoxelsForDrawing();
|
||||
}
|
||||
|
||||
|
@ -428,14 +418,13 @@ bool VoxelSystem::trueColorizeOperation(VoxelNode* node, bool down, void* extraD
|
|||
|
||||
_nodeCount++;
|
||||
node->setFalseColored(false);
|
||||
//printf("setting true color for node %d\n",_nodeCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
void VoxelSystem::trueColorize() {
|
||||
_nodeCount = 0;
|
||||
tree->recurseTreeWithOperation(trueColorizeOperation);
|
||||
printf("setting true color for %d nodes\n",_nodeCount);
|
||||
printLog("setting true color for %d nodes\n",_nodeCount);
|
||||
setupNewVoxelsForDrawing();
|
||||
}
|
||||
|
||||
|
@ -459,9 +448,6 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, bool down, void*
|
|||
unsigned char newR = 255;
|
||||
unsigned char newG = 0;
|
||||
unsigned char newB = 0;
|
||||
|
||||
//printf("voxel OUTSIDE view - FALSE colorizing node %d TRUE color is %x,%x,%x \n",
|
||||
// _nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2]);
|
||||
node->setFalseColor(newR,newG,newB);
|
||||
}
|
||||
}
|
||||
|
@ -472,15 +458,13 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, bool down, void*
|
|||
void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) {
|
||||
_nodeCount = 0;
|
||||
tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum);
|
||||
printf("setting in view false color for %d nodes\n",_nodeCount);
|
||||
printLog("setting in view false color for %d nodes\n",_nodeCount);
|
||||
setupNewVoxelsForDrawing();
|
||||
}
|
||||
|
||||
// Will false colorize voxels based on distance from view
|
||||
bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool down, void* extraData) {
|
||||
|
||||
//printf("falseColorizeDistanceFromViewOperation() down=%s\n",(down ? "TRUE" : "FALSE"));
|
||||
|
||||
// we do our operations on the way up!
|
||||
if (down) {
|
||||
return true;
|
||||
|
@ -505,10 +489,6 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool d
|
|||
float halfUnitForVoxel = powf(0.5, *node->octalCode) * (0.5 * TREE_SCALE);
|
||||
glm::vec3 viewerPosition = viewFrustum->getPosition();
|
||||
|
||||
//printf("halfUnitForVoxel=%f\n",halfUnitForVoxel);
|
||||
//printf("viewer.x=%f y=%f z=%f \n", viewerPosition.x, viewerPosition.y, viewerPosition.z);
|
||||
//printf("node.x=%f y=%f z=%f \n", nodePosition.x, nodePosition.y, nodePosition.z);
|
||||
|
||||
float distance = sqrtf(powf(viewerPosition.x - nodePosition.x - halfUnitForVoxel, 2) +
|
||||
powf(viewerPosition.y - nodePosition.y - halfUnitForVoxel, 2) +
|
||||
powf(viewerPosition.z - nodePosition.z - halfUnitForVoxel, 2));
|
||||
|
@ -526,12 +506,7 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool d
|
|||
unsigned char newR = (colorBand*(gradientOver/colorBands))+(maxColor-gradientOver);
|
||||
unsigned char newG = 0;
|
||||
unsigned char newB = 0;
|
||||
//printf("Setting color down=%s distance=%f min=%f max=%f distanceRatio=%f color=%d \n",
|
||||
// (down ? "TRUE" : "FALSE"), distance, _minDistance, _maxDistance, distanceRatio, (int)newR);
|
||||
|
||||
node->setFalseColor(newR,newG,newB);
|
||||
} else {
|
||||
//printf("voxel not colored, don't consider it - down=%s\n",(down ? "TRUE" : "FALSE"));
|
||||
}
|
||||
return true; // keep going!
|
||||
}
|
||||
|
@ -549,8 +524,6 @@ bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, bool down,
|
|||
return true;
|
||||
}
|
||||
|
||||
//printf("getDistanceFromViewRangeOperation() down=%s\n",(down ? "TRUE" : "FALSE"));
|
||||
|
||||
ViewFrustum* viewFrustum = (ViewFrustum*) extraData;
|
||||
|
||||
// only do this for truly colored voxels...
|
||||
|
@ -577,11 +550,9 @@ bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, bool down,
|
|||
// on way down, calculate the range of distances
|
||||
if (distance > _maxDistance) {
|
||||
_maxDistance = distance;
|
||||
//printf("new maxDistance=%f down=%s\n",_maxDistance, (down ? "TRUE" : "FALSE"));
|
||||
}
|
||||
if (distance < _minDistance) {
|
||||
_minDistance = distance;
|
||||
//printf("new minDistance=%f down=%s\n",_minDistance, (down ? "TRUE" : "FALSE"));
|
||||
}
|
||||
|
||||
_nodeCount++;
|
||||
|
@ -595,11 +566,11 @@ void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) {
|
|||
_maxDistance = 0.0;
|
||||
_minDistance = FLT_MAX;
|
||||
tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum);
|
||||
printf("determining distance range for %d nodes\n",_nodeCount);
|
||||
printLog("determining distance range for %d nodes\n",_nodeCount);
|
||||
|
||||
_nodeCount = 0;
|
||||
|
||||
tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum);
|
||||
printf("setting in distance false color for %d nodes\n",_nodeCount);
|
||||
printLog("setting in distance false color for %d nodes\n",_nodeCount);
|
||||
setupNewVoxelsForDrawing();
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "SharedUtil.h"
|
||||
//#include "voxels_Log.h"
|
||||
#include "voxels_Log.h"
|
||||
#include "VoxelNode.h"
|
||||
#include "OctalCode.h"
|
||||
#include "AABox.h"
|
||||
|
||||
using voxels_lib::printLog;
|
||||
|
||||
// using voxels_lib::printLog;
|
||||
|
||||
VoxelNode::VoxelNode() {
|
||||
|
@ -119,7 +121,6 @@ void VoxelNode::setFalseColored(bool isFalseColored) {
|
|||
|
||||
|
||||
void VoxelNode::setColor(const nodeColor& color) {
|
||||
//printf("VoxelNode::setColor() isFalseColored=%s\n",_falseColored ? "Yes" : "No");
|
||||
memcpy(&_trueColor,&color,sizeof(nodeColor));
|
||||
if (!_falseColored) {
|
||||
memcpy(&_currentColor,&color,sizeof(nodeColor));
|
||||
|
@ -194,7 +195,7 @@ bool VoxelNode::isLeaf() const {
|
|||
void VoxelNode::printDebugDetails(const char* label) const {
|
||||
AABox box;
|
||||
getAABox(box);
|
||||
printf("%s - Voxel at corner=(%f,%f,%f) size=%f octcode=",label,
|
||||
printLog("%s - Voxel at corner=(%f,%f,%f) size=%f octcode=",label,
|
||||
box.getCorner().x, box.getCorner().y, box.getCorner().z,box.getSize().x);
|
||||
printOctalCode(octalCode);
|
||||
}
|
||||
|
|
|
@ -88,10 +88,6 @@ VoxelNode* VoxelNodeBag::extract() {
|
|||
// reduce the count
|
||||
_elementsInUse--;
|
||||
|
||||
// debug!!
|
||||
//printf("VoxelNodeBag::extract() node=");
|
||||
//node->printDebugDetails("");
|
||||
|
||||
return node;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -555,7 +555,7 @@ void VoxelTree::printTreeForDebugging(VoxelNode *startNode) {
|
|||
// output the colors we have
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (startNode->children[j] != NULL && startNode->children[j]->isColored()) {
|
||||
printf("color %d : ",j);
|
||||
printLog("color %d : ",j);
|
||||
for (int c = 0; c < 3; c++) {
|
||||
outputBits(startNode->children[j]->getTrueColor()[c],false);
|
||||
}
|
||||
|
@ -780,10 +780,6 @@ void VoxelTree::searchForColoredNodesRecursion(VoxelNode* node, const ViewFrustu
|
|||
bool childIsInView = (childExists && childNode->isInView(viewFrustum));
|
||||
bool childIsLeaf = (childExists && childNode->isLeaf());
|
||||
|
||||
//printf("childExists=%s childIsColored=%s childIsInView=%s childIsLeaf=%s \n",
|
||||
// (childExists ? "yes" : "no"), (childIsColored ? "yes" : "no"),
|
||||
// (childIsInView ? "yes" : "no"), (childIsLeaf ? "yes" : "no") );
|
||||
|
||||
if (childIsInView) {
|
||||
|
||||
// track children in view as existing and not a leaf
|
||||
|
@ -798,8 +794,6 @@ void VoxelTree::searchForColoredNodesRecursion(VoxelNode* node, const ViewFrustu
|
|||
|
||||
float distance = childNode->distanceToCamera(viewFrustum);
|
||||
|
||||
//printf("child[%d] distance=%f\n",i,distance);
|
||||
|
||||
inViewCount = insertIntoSortedArrays((void*)childNode, distance, i,
|
||||
(void**)&inViewChildren, (float*)&distancesToChildren, (int*)&positionOfChildren,
|
||||
inViewCount, MAX_CHILDREN);
|
||||
|
@ -872,7 +866,6 @@ int VoxelTree::encodeTreeBitstream(VoxelNode* node, const ViewFrustum& viewFrust
|
|||
bytesWritten += childBytesWritten;
|
||||
} else {
|
||||
// otherwise... if we didn't write any child bytes, then pretend like we also didn't write our octal code
|
||||
//printf("encodeTreeBitstreamRecursion() no bytes below...\n");
|
||||
bytesWritten = 0;
|
||||
}
|
||||
return bytesWritten;
|
||||
|
@ -894,7 +887,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, const ViewFrustum&
|
|||
// although technically, we really shouldn't ever be here, because our callers shouldn't be calling us if
|
||||
// we're out of view
|
||||
if (!node->isInView(viewFrustum)) {
|
||||
//printf("encodeTreeBitstreamRecursion() node NOT IN VIEW\n");
|
||||
return bytesAtThisLevel;
|
||||
}
|
||||
|
||||
|
@ -955,7 +947,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, const ViewFrustum&
|
|||
// write the color data...
|
||||
for (int i = 0; i < MAX_CHILDREN; i++) {
|
||||
if (oneAtBit(childrenColoredBits, i)) {
|
||||
//printf("bhgLoadBitstream() writing color for child %d\n",i);
|
||||
memcpy(writeToThisLevelBuffer,&node->children[i]->getColor(),BYTES_PER_COLOR);
|
||||
writeToThisLevelBuffer += BYTES_PER_COLOR; // move the pointer for color
|
||||
bytesAtThisLevel += BYTES_PER_COLOR; // keep track of byte count for color
|
||||
|
|
Loading…
Reference in a new issue