Showing the changes to interface/src/VoxelSystem.cpp (1 of 5 files). Show all
Unified · Split
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "CoverageMap.h" | 28 | #include "CoverageMap.h" |
| 29 | #include "CoverageMapV2.h" | 29 | #include "CoverageMapV2.h" |
| 30 | #include "InterfaceConfig.h" | 30 | #include "InterfaceConfig.h" |
| 31 | #include "Menu.h" | ||
| 31 | #include "renderer/ProgramObject.h" | 32 | #include "renderer/ProgramObject.h" |
| 32 | #include "VoxelConstants.h" | 33 | #include "VoxelConstants.h" |
| 33 | #include "VoxelSystem.h" | 34 | #include "VoxelSystem.h" |
| @@ -173,14 +174,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 139 unmodified lines | |||
| 173 | 174 | ||
| 174 | switch(command) { | 175 | switch(command) { |
| 175 | case PACKET_TYPE_VOXEL_DATA: { | 176 | case PACKET_TYPE_VOXEL_DATA: { |
| 176 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | 177 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 178 | "readBitstreamToTree()"); | ||
| 177 | // ask the VoxelTree to read the bitstream into the tree | 179 | // ask the VoxelTree to read the bitstream into the tree |
| 178 | ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); | 180 | ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); |
| 179 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); | 181 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| 180 | } | 182 | } |
| 181 | break; | 183 | break; |
| 182 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: { | 184 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: { |
| 183 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); | 185 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 186 | "readBitstreamToTree()"); | ||
| 184 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree | 187 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree |
| 185 | ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); | 188 | ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); |
| 186 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); | 189 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| @@ -222,7 +225,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 35 unmodified lines | |||
| 222 | } | 225 | } |
| 223 | 226 | ||
| 224 | void VoxelSystem::setupNewVoxelsForDrawing() { | 227 | void VoxelSystem::setupNewVoxelsForDrawing() { |
| 225 | PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated | 228 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 229 | "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated | ||
| 226 | uint64_t start = usecTimestampNow(); | 230 | uint64_t start = usecTimestampNow(); |
| 227 | uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; | 231 | uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; |
| 228 | 232 | ||
| @@ -257,10 +261,10 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 28 unmodified lines | |||
| 257 | bool didWriteFullVBO = _writeRenderFullVBO; | 261 | bool didWriteFullVBO = _writeRenderFullVBO; |
| 258 | if (_tree->isDirty()) { | 262 | if (_tree->isDirty()) { |
| 259 | static char buffer[64] = { 0 }; | 263 | static char buffer[64] = { 0 }; |
| 260 | if (_renderWarningsOn) { | 264 | if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { |
| 261 | sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO)); | 265 | sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO)); |
| 262 | }; | 266 | }; |
| 263 | PerformanceWarning warn(_renderWarningsOn, buffer); | 267 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer); |
| 264 | _callsToTreesToArrays++; | 268 | _callsToTreesToArrays++; |
| 265 | if (_writeRenderFullVBO) { | 269 | if (_writeRenderFullVBO) { |
| 266 | _voxelsInWriteArrays = 0; // reset our VBO | 270 | _voxelsInWriteArrays = 0; // reset our VBO |
| @@ -299,7 +303,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 32 unmodified lines | |||
| 299 | } | 303 | } |
| 300 | 304 | ||
| 301 | void VoxelSystem::cleanupRemovedVoxels() { | 305 | void VoxelSystem::cleanupRemovedVoxels() { |
| 302 | PerformanceWarning warn(_renderWarningsOn, "cleanupRemovedVoxels()"); | 306 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "cleanupRemovedVoxels()"); |
| 303 | // This handles cleanup of voxels that were culled as part of our regular out of view culling operation | 307 | // This handles cleanup of voxels that were culled as part of our regular out of view culling operation |
| 304 | if (!_removedVoxels.isEmpty()) { | 308 | if (!_removedVoxels.isEmpty()) { |
| 305 | while (!_removedVoxels.isEmpty()) { | 309 | while (!_removedVoxels.isEmpty()) { |
| @@ -375,7 +379,8 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart, · 69 unmodified lines | |||
| 375 | } | 379 | } |
| 376 | 380 | ||
| 377 | void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) { | 381 | void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) { |
| 378 | PerformanceWarning warn(_renderWarningsOn, "copyWrittenDataToReadArrays()"); | 382 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 383 | "copyWrittenDataToReadArrays()"); | ||
| 379 | if (_voxelsDirty && _voxelsUpdated) { | 384 | if (_voxelsDirty && _voxelsUpdated) { |
| 380 | if (fullVBOs) { | 385 | if (fullVBOs) { |
| 381 | copyWrittenDataToReadArraysFullVBOs(); | 386 | copyWrittenDataToReadArraysFullVBOs(); |
| @@ -509,8 +514,6 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 127 unmodified lines | |||
| 509 | ProgramObject* VoxelSystem::_perlinModulateProgram = 0; | 514 | ProgramObject* VoxelSystem::_perlinModulateProgram = 0; |
| 510 | 515 | ||
| 511 | void VoxelSystem::init() { | 516 | void VoxelSystem::init() { |
| 512 | |||
| 513 | _renderWarningsOn = false; | ||
| 514 | _callsToTreesToArrays = 0; | 517 | _callsToTreesToArrays = 0; |
| 515 | _setupNewVoxelsForDrawingLastFinished = 0; | 518 | _setupNewVoxelsForDrawingLastFinished = 0; |
| 516 | _setupNewVoxelsForDrawingLastElapsed = 0; | 519 | _setupNewVoxelsForDrawingLastElapsed = 0; |
| @@ -641,10 +644,11 @@ void VoxelSystem::updatePartialVBOs() { · 124 unmodified lines | |||
| 641 | 644 | ||
| 642 | void VoxelSystem::updateVBOs() { | 645 | void VoxelSystem::updateVBOs() { |
| 643 | static char buffer[40] = { 0 }; | 646 | static char buffer[40] = { 0 }; |
| 644 | if (_renderWarningsOn) { | 647 | if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { |
| 645 | sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO)); | 648 | sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO)); |
| 646 | }; | 649 | }; |
| 647 | PerformanceWarning warn(_renderWarningsOn, buffer); // would like to include _callsToTreesToArrays | 650 | // would like to include _callsToTreesToArrays |
| 651 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer); | ||
| 648 | if (_voxelsDirty) { | 652 | if (_voxelsDirty) { |
| 649 | if (_readRenderFullVBO) { | 653 | if (_readRenderFullVBO) { |
| 650 | updateFullVBOs(); | 654 | updateFullVBOs(); |
| @@ -672,7 +676,7 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 21 unmodified lines | |||
| 672 | } | 676 | } |
| 673 | 677 | ||
| 674 | void VoxelSystem::render(bool texture) { | 678 | void VoxelSystem::render(bool texture) { |
| 675 | PerformanceWarning warn(_renderWarningsOn, "render()"); | 679 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()"); |
| 676 | 680 | ||
| 677 | // get the lock so that the update thread won't change anything | 681 | // get the lock so that the update thread won't change anything |
| 678 | pthread_mutex_lock(&_bufferWriteLock); | 682 | pthread_mutex_lock(&_bufferWriteLock); |
| @@ -1047,7 +1051,7 @@ bool VoxelSystem::hasViewChanged() { · 368 unmodified lines | |||
| 1047 | } | 1051 | } |
| 1048 | 1052 | ||
| 1049 | void VoxelSystem::removeOutOfView() { | 1053 | void VoxelSystem::removeOutOfView() { |
| 1050 | PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()"); | 1054 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "removeOutOfView()"); |
| 1051 | removeOutOfViewArgs args(this); | 1055 | removeOutOfViewArgs args(this); |
| 1052 | _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args); | 1056 | _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args); |
| 1053 | 1057 | ||