Showing the changes to interface/src/VoxelSystem.cpp (1 of 28 files). Show all
Unified · Split
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "CoverageMap.h" |
| 29 | 29 | #include "CoverageMapV2.h" |
| 30 | 30 | #include "InterfaceConfig.h" |
| 31 | +#include "Menu.h" | |
| 31 | 32 | #include "renderer/ProgramObject.h" |
| 32 | 33 | #include "VoxelConstants.h" |
| 33 | 34 | #include "VoxelSystem.h" |
| @@ -189,14 +190,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 155 unmodified lines | ||
| 189 | 190 | |
| 190 | 191 | switch(command) { |
| 191 | 192 | case PACKET_TYPE_VOXEL_DATA: { |
| 192 | − PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | |
| 193 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 194 | + "readBitstreamToTree()"); | |
| 193 | 195 | // ask the VoxelTree to read the bitstream into the tree |
| 194 | 196 | ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); |
| 195 | 197 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| 196 | 198 | } |
| 197 | 199 | break; |
| 198 | 200 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: { |
| 199 | − PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | |
| 201 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 202 | + "readBitstreamToTree()"); | |
| 200 | 203 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree |
| 201 | 204 | ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); |
| 202 | 205 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| @@ -238,7 +241,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 35 unmodified lines | ||
| 238 | 241 | } |
| 239 | 242 | |
| 240 | 243 | void VoxelSystem::setupNewVoxelsForDrawing() { |
| 241 | − PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated | |
| 244 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 245 | + "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated | |
| 242 | 246 | uint64_t start = usecTimestampNow(); |
| 243 | 247 | uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; |
| 244 | 248 | |
| @@ -273,10 +277,10 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 28 unmodified lines | ||
| 273 | 277 | bool didWriteFullVBO = _writeRenderFullVBO; |
| 274 | 278 | if (_tree->isDirty()) { |
| 275 | 279 | static char buffer[64] = { 0 }; |
| 276 | − if (_renderWarningsOn) { | |
| 280 | + if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { | |
| 277 | 281 | sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO)); |
| 278 | 282 | }; |
| 279 | − PerformanceWarning warn(_renderWarningsOn, buffer); | |
| 283 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer); | |
| 280 | 284 | _callsToTreesToArrays++; |
| 281 | 285 | if (_writeRenderFullVBO) { |
| 282 | 286 | _voxelsInWriteArrays = 0; // reset our VBO |
| @@ -315,7 +319,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 32 unmodified lines | ||
| 315 | 319 | } |
| 316 | 320 | |
| 317 | 321 | void VoxelSystem::cleanupRemovedVoxels() { |
| 318 | − PerformanceWarning warn(_renderWarningsOn, "cleanupRemovedVoxels()"); | |
| 322 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "cleanupRemovedVoxels()"); | |
| 319 | 323 | // This handles cleanup of voxels that were culled as part of our regular out of view culling operation |
| 320 | 324 | if (!_removedVoxels.isEmpty()) { |
| 321 | 325 | while (!_removedVoxels.isEmpty()) { |
| @@ -391,7 +395,8 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart, · 69 unmodified lines | ||
| 391 | 395 | } |
| 392 | 396 | |
| 393 | 397 | void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) { |
| 394 | − PerformanceWarning warn(_renderWarningsOn, "copyWrittenDataToReadArrays()"); | |
| 398 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 399 | + "copyWrittenDataToReadArrays()"); | |
| 395 | 400 | if (_voxelsDirty && _voxelsUpdated) { |
| 396 | 401 | if (fullVBOs) { |
| 397 | 402 | copyWrittenDataToReadArraysFullVBOs(); |
| @@ -525,8 +530,6 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 127 unmodified lines | ||
| 525 | 530 | ProgramObject* VoxelSystem::_perlinModulateProgram = 0; |
| 526 | 531 | |
| 527 | 532 | void VoxelSystem::init() { |
| 528 | − | |
| 529 | − _renderWarningsOn = false; | |
| 530 | 533 | _callsToTreesToArrays = 0; |
| 531 | 534 | _setupNewVoxelsForDrawingLastFinished = 0; |
| 532 | 535 | _setupNewVoxelsForDrawingLastElapsed = 0; |
| @@ -657,10 +660,11 @@ void VoxelSystem::updatePartialVBOs() { · 124 unmodified lines | ||
| 657 | 660 | |
| 658 | 661 | void VoxelSystem::updateVBOs() { |
| 659 | 662 | static char buffer[40] = { 0 }; |
| 660 | − if (_renderWarningsOn) { | |
| 663 | + if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { | |
| 661 | 664 | sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO)); |
| 662 | 665 | }; |
| 663 | − PerformanceWarning warn(_renderWarningsOn, buffer); // would like to include _callsToTreesToArrays | |
| 666 | + // would like to include _callsToTreesToArrays | |
| 667 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer); | |
| 664 | 668 | if (_voxelsDirty) { |
| 665 | 669 | if (_readRenderFullVBO) { |
| 666 | 670 | updateFullVBOs(); |
| @@ -688,7 +692,7 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 21 unmodified lines | ||
| 688 | 692 | } |
| 689 | 693 | |
| 690 | 694 | void VoxelSystem::render(bool texture) { |
| 691 | − PerformanceWarning warn(_renderWarningsOn, "render()"); | |
| 695 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()"); | |
| 692 | 696 | |
| 693 | 697 | // get the lock so that the update thread won't change anything |
| 694 | 698 | pthread_mutex_lock(&_bufferWriteLock); |
| @@ -824,7 +828,9 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) · 129 unmodified lines | ||
| 824 | 828 | return true; // keep going! |
| 825 | 829 | } |
| 826 | 830 | |
| 827 | −void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) { | |
| 831 | +void VoxelSystem::falseColorizeInView() { | |
| 832 | + ViewFrustum* viewFrustum = Application::getInstance()->getViewFrustum(); | |
| 833 | + | |
| 828 | 834 | _nodeCount = 0; |
| 829 | 835 | _tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum); |
| 830 | 836 | qDebug("setting in view false color for %d nodes\n", _nodeCount); |
| @@ -951,14 +957,16 @@ bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, void* extra · 120 unmodified lines | ||
| 951 | 957 | return true; // keep going! |
| 952 | 958 | } |
| 953 | 959 | |
| 954 | −void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) { | |
| 960 | +void VoxelSystem::falseColorizeDistanceFromView() { | |
| 961 | + ViewFrustum* viewFrustum = Application::getInstance()->getViewFrustum(); | |
| 962 | + | |
| 955 | 963 | _nodeCount = 0; |
| 956 | 964 | _maxDistance = 0.0; |
| 957 | 965 | _minDistance = FLT_MAX; |
| 958 | − _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum); | |
| 966 | + _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation, (void*) viewFrustum); | |
| 959 | 967 | qDebug("determining distance range for %d nodes\n", _nodeCount); |
| 960 | 968 | _nodeCount = 0; |
| 961 | − _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); | |
| 969 | + _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation, (void*) viewFrustum); | |
| 962 | 970 | qDebug("setting in distance false color for %d nodes\n", _nodeCount); |
| 963 | 971 | _tree->setDirtyBit(); |
| 964 | 972 | setupNewVoxelsForDrawing(); |
| @@ -1063,7 +1071,7 @@ bool VoxelSystem::hasViewChanged() { · 98 unmodified lines | ||
| 1063 | 1071 | } |
| 1064 | 1072 | |
| 1065 | 1073 | void VoxelSystem::removeOutOfView() { |
| 1066 | − PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()"); | |
| 1074 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "removeOutOfView()"); | |
| 1067 | 1075 | removeOutOfViewArgs args(this); |
| 1068 | 1076 | _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args); |
| 1069 | 1077 | |