History

merge

atlante45 committed 13 years ago

Commit 6b58e1b2 parents 2eb29ee 94952fe28 files · +1580 −1443Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+25−17
@@ -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"
@@ -189,14 +190,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 155 unmodified lines
189190
190191 switch(command) {
191192 case PACKET_TYPE_VOXEL_DATA: {
192− PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
193+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
194+ "readBitstreamToTree()");
193195 // ask the VoxelTree to read the bitstream into the tree
194196 ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID());
195197 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
196198 }
197199 break;
198200 case PACKET_TYPE_VOXEL_DATA_MONOCHROME: {
199− PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
201+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
202+ "readBitstreamToTree()");
200203 // ask the VoxelTree to read the MONOCHROME bitstream into the tree
201204 ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID());
202205 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
@@ -238,7 +241,8 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 35 unmodified lines
238241 }
239242
240243 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
242246 uint64_t start = usecTimestampNow();
243247 uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
244248
@@ -273,10 +277,10 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 28 unmodified lines
273277 bool didWriteFullVBO = _writeRenderFullVBO;
274278 if (_tree->isDirty()) {
275279 static char buffer[64] = { 0 };
276− if (_renderWarningsOn) {
280+ if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
277281 sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO));
278282 };
279− PerformanceWarning warn(_renderWarningsOn, buffer);
283+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), buffer);
280284 _callsToTreesToArrays++;
281285 if (_writeRenderFullVBO) {
282286 _voxelsInWriteArrays = 0; // reset our VBO
@@ -315,7 +319,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 32 unmodified lines
315319 }
316320
317321 void VoxelSystem::cleanupRemovedVoxels() {
318− PerformanceWarning warn(_renderWarningsOn, "cleanupRemovedVoxels()");
322+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "cleanupRemovedVoxels()");
319323 // This handles cleanup of voxels that were culled as part of our regular out of view culling operation
320324 if (!_removedVoxels.isEmpty()) {
321325 while (!_removedVoxels.isEmpty()) {
@@ -391,7 +395,8 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart, · 69 unmodified lines
391395 }
392396
393397 void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) {
394− PerformanceWarning warn(_renderWarningsOn, "copyWrittenDataToReadArrays()");
398+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
399+ "copyWrittenDataToReadArrays()");
395400 if (_voxelsDirty && _voxelsUpdated) {
396401 if (fullVBOs) {
397402 copyWrittenDataToReadArraysFullVBOs();
@@ -525,8 +530,6 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 127 unmodified lines
525530 ProgramObject* VoxelSystem::_perlinModulateProgram = 0;
526531
527532 void VoxelSystem::init() {
528−
529− _renderWarningsOn = false;
530533 _callsToTreesToArrays = 0;
531534 _setupNewVoxelsForDrawingLastFinished = 0;
532535 _setupNewVoxelsForDrawingLastElapsed = 0;
@@ -657,10 +660,11 @@ void VoxelSystem::updatePartialVBOs() { · 124 unmodified lines
657660
658661 void VoxelSystem::updateVBOs() {
659662 static char buffer[40] = { 0 };
660− if (_renderWarningsOn) {
663+ if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
661664 sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO));
662665 };
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);
664668 if (_voxelsDirty) {
665669 if (_readRenderFullVBO) {
666670 updateFullVBOs();
@@ -688,7 +692,7 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 21 unmodified lines
688692 }
689693
690694 void VoxelSystem::render(bool texture) {
691− PerformanceWarning warn(_renderWarningsOn, "render()");
695+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()");
692696
693697 // get the lock so that the update thread won't change anything
694698 pthread_mutex_lock(&_bufferWriteLock);
@@ -824,7 +828,9 @@ bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) · 129 unmodified lines
824828 return true; // keep going!
825829 }
826830
827−void VoxelSystem::falseColorizeInView(ViewFrustum* viewFrustum) {
831+void VoxelSystem::falseColorizeInView() {
832+ ViewFrustum* viewFrustum = Application::getInstance()->getViewFrustum();
833+
828834 _nodeCount = 0;
829835 _tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)viewFrustum);
830836 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
951957 return true; // keep going!
952958 }
953959
954−void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) {
960+void VoxelSystem::falseColorizeDistanceFromView() {
961+ ViewFrustum* viewFrustum = Application::getInstance()->getViewFrustum();
962+
955963 _nodeCount = 0;
956964 _maxDistance = 0.0;
957965 _minDistance = FLT_MAX;
958− _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation,(void*)viewFrustum);
966+ _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation, (void*) viewFrustum);
959967 qDebug("determining distance range for %d nodes\n", _nodeCount);
960968 _nodeCount = 0;
961− _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum);
969+ _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation, (void*) viewFrustum);
962970 qDebug("setting in distance false color for %d nodes\n", _nodeCount);
963971 _tree->setDirtyBit();
964972 setupNewVoxelsForDrawing();
@@ -1063,7 +1071,7 @@ bool VoxelSystem::hasViewChanged() { · 98 unmodified lines
10631071 }
10641072
10651073 void VoxelSystem::removeOutOfView() {
1066− PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()");
1074+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "removeOutOfView()");
10671075 removeOutOfViewArgs args(this);
10681076 _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args);
10691077