History

fix hook to render pipeline warnings and kill local voxels

Stephen Birarda committed 13 years ago

Commit f72f9d81 parent 474b0465 files · +22 −31Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 5 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+17−13
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include "CoverageMap.h"
2929 #include "CoverageMapV2.h"
3030 #include "InterfaceConfig.h"
31+#include "Menu.h"
3132 #include "renderer/ProgramObject.h"
3233 #include "VoxelConstants.h"
3334 #include "VoxelSystem.h"
@@ -173,14 +174,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 139 unmodified lines
173174
174175 switch(command) {
175176 case PACKET_TYPE_VOXEL_DATA: {
176− PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
177+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
178+ "readBitstreamToTree()");
177179 // ask the VoxelTree to read the bitstream into the tree
178180 ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID());
179181 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
180182 }
181183 break;
182184 case PACKET_TYPE_VOXEL_DATA_MONOCHROME: {
183− PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
185+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
186+ "readBitstreamToTree()");
184187 // ask the VoxelTree to read the MONOCHROME bitstream into the tree
185188 ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID());
186189 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
@@ -222,7 +225,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 35 unmodified lines
222225 }
223226
224227 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
226230 uint64_t start = usecTimestampNow();
227231 uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
228232
@@ -257,10 +261,10 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 28 unmodified lines
257261 bool didWriteFullVBO = _writeRenderFullVBO;
258262 if (_tree->isDirty()) {
259263 static char buffer[64] = { 0 };
260− if (_renderWarningsOn) {
264+ if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
261265 sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO));
262266 };
263− PerformanceWarning warn(_renderWarningsOn, buffer);
267+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer);
264268 _callsToTreesToArrays++;
265269 if (_writeRenderFullVBO) {
266270 _voxelsInWriteArrays = 0; // reset our VBO
@@ -299,7 +303,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 32 unmodified lines
299303 }
300304
301305 void VoxelSystem::cleanupRemovedVoxels() {
302− PerformanceWarning warn(_renderWarningsOn, "cleanupRemovedVoxels()");
306+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "cleanupRemovedVoxels()");
303307 // This handles cleanup of voxels that were culled as part of our regular out of view culling operation
304308 if (!_removedVoxels.isEmpty()) {
305309 while (!_removedVoxels.isEmpty()) {
@@ -375,7 +379,8 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart, · 69 unmodified lines
375379 }
376380
377381 void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) {
378− PerformanceWarning warn(_renderWarningsOn, "copyWrittenDataToReadArrays()");
382+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
383+ "copyWrittenDataToReadArrays()");
379384 if (_voxelsDirty && _voxelsUpdated) {
380385 if (fullVBOs) {
381386 copyWrittenDataToReadArraysFullVBOs();
@@ -509,8 +514,6 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 127 unmodified lines
509514 ProgramObject* VoxelSystem::_perlinModulateProgram = 0;
510515
511516 void VoxelSystem::init() {
512−
513− _renderWarningsOn = false;
514517 _callsToTreesToArrays = 0;
515518 _setupNewVoxelsForDrawingLastFinished = 0;
516519 _setupNewVoxelsForDrawingLastElapsed = 0;
@@ -641,10 +644,11 @@ void VoxelSystem::updatePartialVBOs() { · 124 unmodified lines
641644
642645 void VoxelSystem::updateVBOs() {
643646 static char buffer[40] = { 0 };
644− if (_renderWarningsOn) {
647+ if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
645648 sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO));
646649 };
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);
648652 if (_voxelsDirty) {
649653 if (_readRenderFullVBO) {
650654 updateFullVBOs();
@@ -672,7 +676,7 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 21 unmodified lines
672676 }
673677
674678 void VoxelSystem::render(bool texture) {
675− PerformanceWarning warn(_renderWarningsOn, "render()");
679+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()");
676680
677681 // get the lock so that the update thread won't change anything
678682 pthread_mutex_lock(&_bufferWriteLock);
@@ -1047,7 +1051,7 @@ bool VoxelSystem::hasViewChanged() { · 368 unmodified lines
10471051 }
10481052
10491053 void VoxelSystem::removeOutOfView() {
1050− PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()");
1054+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "removeOutOfView()");
10511055 removeOutOfViewArgs args(this);
10521056 _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args);
10531057