Showing the changes to interface/src/VoxelSystem.cpp (1 of 2 files). Show all
Unified · Split
| @@ -364,19 +364,12 @@ void VoxelSystem::render() { · 363 unmodified lines | ||
| 364 | 364 | glPopMatrix(); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | −void VoxelSystem::simulate(float deltaTime) { | |
| 368 | − | |
| 369 | −} | |
| 370 | − | |
| 371 | 367 | int VoxelSystem::_nodeCount = 0; |
| 372 | 368 | |
| 373 | 369 | bool VoxelSystem::randomColorOperation(VoxelNode* node, void* extraData) { |
| 374 | 370 | _nodeCount++; |
| 375 | 371 | if (node->isColored()) { |
| 376 | − nodeColor newColor = { 0,0,0,1 }; | |
| 377 | − newColor[0] = randomColorValue(150); | |
| 378 | − newColor[1] = randomColorValue(150); | |
| 379 | − newColor[1] = randomColorValue(150); | |
| 372 | + nodeColor newColor = { randomColorValue(150), randomColorValue(150), randomColorValue(150), 1 }; | |
| 380 | 373 | node->setColor(newColor); |
| 381 | 374 | } |
| 382 | 375 | return true; |
| @@ -385,24 +378,21 @@ bool VoxelSystem::randomColorOperation(VoxelNode* node, void* extraData) { · 2 unmodified lines | ||
| 385 | 378 | void VoxelSystem::randomizeVoxelColors() { |
| 386 | 379 | _nodeCount = 0; |
| 387 | 380 | _tree->recurseTreeWithOperation(randomColorOperation); |
| 388 | − printLog("setting randomized true color for %d nodes\n",_nodeCount); | |
| 381 | + printLog("setting randomized true color for %d nodes\n", _nodeCount); | |
| 389 | 382 | setupNewVoxelsForDrawing(); |
| 390 | 383 | } |
| 391 | 384 | |
| 392 | 385 | bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, void* extraData) { |
| 393 | 386 | _nodeCount++; |
| 394 | 387 | // always false colorize |
| 395 | − unsigned char newR = randomColorValue(150); | |
| 396 | − unsigned char newG = randomColorValue(150); | |
| 397 | − unsigned char newB = randomColorValue(150); | |
| 398 | − node->setFalseColor(newR,newG,newB); | |
| 388 | + node->setFalseColor(randomColorValue(150), randomColorValue(150), randomColorValue(150)); | |
| 399 | 389 | return true; // keep going! |
| 400 | 390 | } |
| 401 | 391 | |
| 402 | 392 | void VoxelSystem::falseColorizeRandom() { |
| 403 | 393 | _nodeCount = 0; |
| 404 | 394 | _tree->recurseTreeWithOperation(falseColorizeRandomOperation); |
| 405 | − printLog("setting randomized false color for %d nodes\n",_nodeCount); | |
| 395 | + printLog("setting randomized false color for %d nodes\n", _nodeCount); | |
| 406 | 396 | setupNewVoxelsForDrawing(); |
| 407 | 397 | } |
| 408 | 398 | |
| @@ -415,7 +405,7 @@ bool VoxelSystem::trueColorizeOperation(VoxelNode* node, void* extraData) { · 6 unmodified lines | ||
| 415 | 405 | void VoxelSystem::trueColorize() { |
| 416 | 406 | _nodeCount = 0; |
| 417 | 407 | _tree->recurseTreeWithOperation(trueColorizeOperation); |
| 418 | − printLog("setting true color for %d nodes\n",_nodeCount); | |
| 408 | + printLog("setting true color for %d nodes\n", _nodeCount); | |
| 419 | 409 | setupNewVoxelsForDrawing(); |
| 420 | 410 | } |
| 421 | 411 | |
| @@ -426,10 +416,7 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) · 4 unmodified lines | ||
| 426 | 416 | if (node->isColored()) { |
| 427 | 417 | if (!node->isInView(*viewFrustum)) { |
| 428 | 418 | // Out of view voxels are colored RED |
| 429 | − unsigned char newR = 255; | |
| 430 | − unsigned char newG = 0; | |
| 431 | − unsigned char newB = 0; | |
| 432 | − node->setFalseColor(newR,newG,newB); | |
| 419 | + node->setFalseColor(255, 0, 0); | |
| 433 | 420 | } |
| 434 | 421 | } |
| 435 | 422 | return true; // keep going! |
| @@ -438,7 +425,7 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) · 2 unmodified lines | ||
| 438 | 425 | void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) { |
| 439 | 426 | _nodeCount = 0; |
| 440 | 427 | _tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum); |
| 441 | − printLog("setting in view false color for %d nodes\n",_nodeCount); | |
| 428 | + printLog("setting in view false color for %d nodes\n", _nodeCount); | |
| 442 | 429 | setupNewVoxelsForDrawing(); |
| 443 | 430 | } |
| 444 | 431 | |
| @@ -448,17 +435,14 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, void* · 3 unmodified lines | ||
| 448 | 435 | if (node->isColored()) { |
| 449 | 436 | float distance = node->distanceToCamera(*viewFrustum); |
| 450 | 437 | _nodeCount++; |
| 451 | − float distanceRatio = (_minDistance==_maxDistance) ? 1 : (distance - _minDistance)/(_maxDistance - _minDistance); | |
| 438 | + float distanceRatio = (_minDistance == _maxDistance) ? 1 : (distance - _minDistance) / (_maxDistance - _minDistance); | |
| 452 | 439 | |
| 453 | 440 | // We want to colorize this in 16 bug chunks of color |
| 454 | 441 | const unsigned char maxColor = 255; |
| 455 | 442 | const unsigned char colorBands = 16; |
| 456 | 443 | const unsigned char gradientOver = 128; |
| 457 | − unsigned char colorBand = (colorBands*distanceRatio); | |
| 458 | − unsigned char newR = (colorBand*(gradientOver/colorBands))+(maxColor-gradientOver); | |
| 459 | − unsigned char newG = 0; | |
| 460 | − unsigned char newB = 0; | |
| 461 | − node->setFalseColor(newR,newG,newB); | |
| 444 | + unsigned char colorBand = (colorBands * distanceRatio); | |
| 445 | + node->setFalseColor((colorBand * (gradientOver / colorBands)) + (maxColor - gradientOver), 0, 0); | |
| 462 | 446 | } |
| 463 | 447 | return true; // keep going! |
| 464 | 448 | } |
| @@ -491,10 +475,10 @@ void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) { · 26 unmodified lines | ||
| 491 | 475 | _maxDistance = 0.0; |
| 492 | 476 | _minDistance = FLT_MAX; |
| 493 | 477 | _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum); |
| 494 | − printLog("determining distance range for %d nodes\n",_nodeCount); | |
| 478 | + printLog("determining distance range for %d nodes\n", _nodeCount); | |
| 495 | 479 | _nodeCount = 0; |
| 496 | 480 | _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); |
| 497 | − printLog("setting in distance false color for %d nodes\n",_nodeCount); | |
| 481 | + printLog("setting in distance false color for %d nodes\n", _nodeCount); | |
| 498 | 482 | setupNewVoxelsForDrawing(); |
| 499 | 483 | } |
| 500 | 484 | |