Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all
Unified · Split
| @@ -372,13 +372,7 @@ bool VoxelSystem::randomColorOperation(VoxelNode* node, bool down, void* extraDa · 371 unmodified lines | |||
| 372 | newColor[0] = randomColorValue(150); | 372 | newColor[0] = randomColorValue(150); |
| 373 | newColor[1] = randomColorValue(150); | 373 | newColor[1] = randomColorValue(150); |
| 374 | newColor[1] = randomColorValue(150); | 374 | newColor[1] = randomColorValue(150); |
| 375 | |||
| 376 | //printf("randomize color node %d was %x,%x,%x NOW %x,%x,%x\n", | ||
| 377 | // _nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2], | ||
| 378 | // newColor[0],newColor[1],newColor[2]); | ||
| 379 | node->setColor(newColor); | 375 | node->setColor(newColor); |
| 380 | } else { | ||
| 381 | //printf("not randomizing color node of %d since it has no color\n",_nodeCount); | ||
| 382 | } | 376 | } |
| 383 | return true; | 377 | return true; |
| 384 | } | 378 | } |
| @@ -386,7 +380,7 @@ bool VoxelSystem::randomColorOperation(VoxelNode* node, bool down, void* extraDa · 1 unmodified line | |||
| 386 | void VoxelSystem::randomizeVoxelColors() { | 380 | void VoxelSystem::randomizeVoxelColors() { |
| 387 | _nodeCount = 0; | 381 | _nodeCount = 0; |
| 388 | tree->recurseTreeWithOperation(randomColorOperation); | 382 | tree->recurseTreeWithOperation(randomColorOperation); |
| 389 | printf("setting randomized true color for %d nodes\n",_nodeCount); | 383 | printLog("setting randomized true color for %d nodes\n",_nodeCount); |
| 390 | setupNewVoxelsForDrawing(); | 384 | setupNewVoxelsForDrawing(); |
| 391 | } | 385 | } |
| 392 | 386 | ||
| @@ -403,10 +397,6 @@ bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, bool down, void* · 10 unmodified lines | |||
| 403 | unsigned char newR = randomColorValue(150); | 397 | unsigned char newR = randomColorValue(150); |
| 404 | unsigned char newG = randomColorValue(150); | 398 | unsigned char newG = randomColorValue(150); |
| 405 | unsigned char newB = randomColorValue(150); | 399 | unsigned char newB = randomColorValue(150); |
| 406 | |||
| 407 | printf("randomize FALSE color node %d was %x,%x,%x NOW %x,%x,%x\n", | ||
| 408 | _nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2], | ||
| 409 | newR,newG,newB); | ||
| 410 | node->setFalseColor(newR,newG,newB); | 400 | node->setFalseColor(newR,newG,newB); |
| 411 | 401 | ||
| 412 | return true; // keep going! | 402 | return true; // keep going! |
| @@ -415,7 +405,7 @@ bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, bool down, void* · 2 unmodified lines | |||
| 415 | void VoxelSystem::falseColorizeRandom() { | 405 | void VoxelSystem::falseColorizeRandom() { |
| 416 | _nodeCount = 0; | 406 | _nodeCount = 0; |
| 417 | tree->recurseTreeWithOperation(falseColorizeRandomOperation); | 407 | tree->recurseTreeWithOperation(falseColorizeRandomOperation); |
| 418 | printf("setting randomized false color for %d nodes\n",_nodeCount); | 408 | printLog("setting randomized false color for %d nodes\n",_nodeCount); |
| 419 | setupNewVoxelsForDrawing(); | 409 | setupNewVoxelsForDrawing(); |
| 420 | } | 410 | } |
| 421 | 411 | ||
| @@ -428,14 +418,13 @@ bool VoxelSystem::trueColorizeOperation(VoxelNode* node, bool down, void* extraD · 6 unmodified lines | |||
| 428 | 418 | ||
| 429 | _nodeCount++; | 419 | _nodeCount++; |
| 430 | node->setFalseColored(false); | 420 | node->setFalseColored(false); |
| 431 | //printf("setting true color for node %d\n",_nodeCount); | ||
| 432 | return true; | 421 | return true; |
| 433 | } | 422 | } |
| 434 | 423 | ||
| 435 | void VoxelSystem::trueColorize() { | 424 | void VoxelSystem::trueColorize() { |
| 436 | _nodeCount = 0; | 425 | _nodeCount = 0; |
| 437 | tree->recurseTreeWithOperation(trueColorizeOperation); | 426 | tree->recurseTreeWithOperation(trueColorizeOperation); |
| 438 | printf("setting true color for %d nodes\n",_nodeCount); | 427 | printLog("setting true color for %d nodes\n",_nodeCount); |
| 439 | setupNewVoxelsForDrawing(); | 428 | setupNewVoxelsForDrawing(); |
| 440 | } | 429 | } |
| 441 | 430 | ||
| @@ -459,9 +448,6 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, bool down, void* · 17 unmodified lines | |||
| 459 | unsigned char newR = 255; | 448 | unsigned char newR = 255; |
| 460 | unsigned char newG = 0; | 449 | unsigned char newG = 0; |
| 461 | unsigned char newB = 0; | 450 | unsigned char newB = 0; |
| 462 | |||
| 463 | //printf("voxel OUTSIDE view - FALSE colorizing node %d TRUE color is %x,%x,%x \n", | ||
| 464 | // _nodeCount,node->getTrueColor()[0],node->getTrueColor()[1],node->getTrueColor()[2]); | ||
| 465 | node->setFalseColor(newR,newG,newB); | 451 | node->setFalseColor(newR,newG,newB); |
| 466 | } | 452 | } |
| 467 | } | 453 | } |
| @@ -472,15 +458,13 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, bool down, void* · 4 unmodified lines | |||
| 472 | void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) { | 458 | void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) { |
| 473 | _nodeCount = 0; | 459 | _nodeCount = 0; |
| 474 | tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum); | 460 | tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum); |
| 475 | printf("setting in view false color for %d nodes\n",_nodeCount); | 461 | printLog("setting in view false color for %d nodes\n",_nodeCount); |
| 476 | setupNewVoxelsForDrawing(); | 462 | setupNewVoxelsForDrawing(); |
| 477 | } | 463 | } |
| 478 | 464 | ||
| 479 | // Will false colorize voxels based on distance from view | 465 | // Will false colorize voxels based on distance from view |
| 480 | bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool down, void* extraData) { | 466 | bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool down, void* extraData) { |
| 481 | 467 | ||
| 482 | //printf("falseColorizeDistanceFromViewOperation() down=%s\n",(down ? "TRUE" : "FALSE")); | ||
| 483 | |||
| 484 | // we do our operations on the way up! | 468 | // we do our operations on the way up! |
| 485 | if (down) { | 469 | if (down) { |
| 486 | return true; | 470 | return true; |
| @@ -505,10 +489,6 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool d · 18 unmodified lines | |||
| 505 | float halfUnitForVoxel = powf(0.5, *node->octalCode) * (0.5 * TREE_SCALE); | 489 | float halfUnitForVoxel = powf(0.5, *node->octalCode) * (0.5 * TREE_SCALE); |
| 506 | glm::vec3 viewerPosition = viewFrustum->getPosition(); | 490 | glm::vec3 viewerPosition = viewFrustum->getPosition(); |
| 507 | 491 | ||
| 508 | //printf("halfUnitForVoxel=%f\n",halfUnitForVoxel); | ||
| 509 | //printf("viewer.x=%f y=%f z=%f \n", viewerPosition.x, viewerPosition.y, viewerPosition.z); | ||
| 510 | //printf("node.x=%f y=%f z=%f \n", nodePosition.x, nodePosition.y, nodePosition.z); | ||
| 511 | |||
| 512 | float distance = sqrtf(powf(viewerPosition.x - nodePosition.x - halfUnitForVoxel, 2) + | 492 | float distance = sqrtf(powf(viewerPosition.x - nodePosition.x - halfUnitForVoxel, 2) + |
| 513 | powf(viewerPosition.y - nodePosition.y - halfUnitForVoxel, 2) + | 493 | powf(viewerPosition.y - nodePosition.y - halfUnitForVoxel, 2) + |
| 514 | powf(viewerPosition.z - nodePosition.z - halfUnitForVoxel, 2)); | 494 | powf(viewerPosition.z - nodePosition.z - halfUnitForVoxel, 2)); |
| @@ -526,12 +506,7 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, bool d · 11 unmodified lines | |||
| 526 | unsigned char newR = (colorBand*(gradientOver/colorBands))+(maxColor-gradientOver); | 506 | unsigned char newR = (colorBand*(gradientOver/colorBands))+(maxColor-gradientOver); |
| 527 | unsigned char newG = 0; | 507 | unsigned char newG = 0; |
| 528 | unsigned char newB = 0; | 508 | unsigned char newB = 0; |
| 529 | //printf("Setting color down=%s distance=%f min=%f max=%f distanceRatio=%f color=%d \n", | ||
| 530 | // (down ? "TRUE" : "FALSE"), distance, _minDistance, _maxDistance, distanceRatio, (int)newR); | ||
| 531 | |||
| 532 | node->setFalseColor(newR,newG,newB); | 509 | node->setFalseColor(newR,newG,newB); |
| 533 | } else { | ||
| 534 | //printf("voxel not colored, don't consider it - down=%s\n",(down ? "TRUE" : "FALSE")); | ||
| 535 | } | 510 | } |
| 536 | return true; // keep going! | 511 | return true; // keep going! |
| 537 | } | 512 | } |
| @@ -549,8 +524,6 @@ bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, bool down, · 11 unmodified lines | |||
| 549 | return true; | 524 | return true; |
| 550 | } | 525 | } |
| 551 | 526 | ||
| 552 | //printf("getDistanceFromViewRangeOperation() down=%s\n",(down ? "TRUE" : "FALSE")); | ||
| 553 | |||
| 554 | ViewFrustum* viewFrustum = (ViewFrustum*) extraData; | 527 | ViewFrustum* viewFrustum = (ViewFrustum*) extraData; |
| 555 | 528 | ||
| 556 | // only do this for truly colored voxels... | 529 | // only do this for truly colored voxels... |
| @@ -577,11 +550,9 @@ bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, bool down, · 20 unmodified lines | |||
| 577 | // on way down, calculate the range of distances | 550 | // on way down, calculate the range of distances |
| 578 | if (distance > _maxDistance) { | 551 | if (distance > _maxDistance) { |
| 579 | _maxDistance = distance; | 552 | _maxDistance = distance; |
| 580 | //printf("new maxDistance=%f down=%s\n",_maxDistance, (down ? "TRUE" : "FALSE")); | ||
| 581 | } | 553 | } |
| 582 | if (distance < _minDistance) { | 554 | if (distance < _minDistance) { |
| 583 | _minDistance = distance; | 555 | _minDistance = distance; |
| 584 | //printf("new minDistance=%f down=%s\n",_minDistance, (down ? "TRUE" : "FALSE")); | ||
| 585 | } | 556 | } |
| 586 | 557 | ||
| 587 | _nodeCount++; | 558 | _nodeCount++; |
| @@ -595,11 +566,11 @@ void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) { · 7 unmodified lines | |||
| 595 | _maxDistance = 0.0; | 566 | _maxDistance = 0.0; |
| 596 | _minDistance = FLT_MAX; | 567 | _minDistance = FLT_MAX; |
| 597 | tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum); | 568 | tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum); |
| 598 | printf("determining distance range for %d nodes\n",_nodeCount); | 569 | printLog("determining distance range for %d nodes\n",_nodeCount); |
| 599 | 570 | ||
| 600 | _nodeCount = 0; | 571 | _nodeCount = 0; |
| 601 | 572 | ||
| 602 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); | 573 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); |
| 603 | printf("setting in distance false color for %d nodes\n",_nodeCount); | 574 | printLog("setting in distance false color for %d nodes\n",_nodeCount); |
| 604 | setupNewVoxelsForDrawing(); | 575 | setupNewVoxelsForDrawing(); |
| 605 | } | 576 | } |