History

Merge branch 'master' of git://github.com/worklist/hifi into windows_build

Brad Hefta-Gaub committed 12 years ago

Commit 170dbe62 parents a39c20e 8325753106 files · +1132 −2119Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+44−44
@@ -197,7 +197,7 @@ glBufferIndex VoxelSystem::getNextBufferIndex() { · 196 unmodified lines
197197 // will be "invisible"
198198 void VoxelSystem::freeBufferIndex(glBufferIndex index) {
199199 if (_voxelsInWriteArrays == 0) {
200− qDebug() << "freeBufferIndex() called when _voxelsInWriteArrays == 0!!!!\n";
200+ qDebug() << "freeBufferIndex() called when _voxelsInWriteArrays == 0!";
201201 }
202202
203203 // if the "freed" index was our max index, then just drop the _voxelsInWriteArrays down one...
@@ -207,7 +207,7 @@ void VoxelSystem::freeBufferIndex(glBufferIndex index) { · 3 unmodified lines
207207 if (Menu::getInstance()->isOptionChecked(MenuOption::AutomaticallyAuditTree)) {
208208 for (unsigned long i = 0; i < _freeIndexes.size(); i++) {
209209 if (_freeIndexes[i] == index) {
210− printf("freeBufferIndex(glBufferIndex index)... index=%ld already in free list!\n", index);
210+ printf("freeBufferIndex(glBufferIndex index)... index=%ld already in free list!", index);
211211 inList = true;
212212 break;
213213 }
@@ -605,7 +605,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 391 unmodified lines
605605 if (Application::getInstance()->getLogger()->extraDebugging()) {
606606 qDebug("VoxelSystem::parseData() ... Got Packet Section"
607607 " color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d"
608− " subsection:%d sectionLength:%d uncompressed:%d\n",
608+ " subsection:%d sectionLength:%d uncompressed:%d",
609609 debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
610610 sequence, flightTime, numBytes, dataBytes, subsection, sectionLength, packetData.getUncompressedSize());
611611 }
@@ -694,7 +694,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 82 unmodified lines
694694
695695 bool extraDebugging = Application::getInstance()->getLogger()->extraDebugging();
696696 if (extraDebugging) {
697− qDebug("setupNewVoxelsForDrawing()... _voxelsUpdated=%lu...\n",_voxelsUpdated);
697+ qDebug("setupNewVoxelsForDrawing()... _voxelsUpdated=%lu...",_voxelsUpdated);
698698 _viewFrustum->printDebugDetails();
699699 }
700700 }
@@ -791,7 +791,7 @@ void VoxelSystem::cleanupRemovedVoxels() { · 90 unmodified lines
791791 // This handles cleanup of voxels that were culled as part of our regular out of view culling operation
792792 if (!_removedVoxels.isEmpty()) {
793793 if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
794− qDebug() << "cleanupRemovedVoxels().. _removedVoxels=" << _removedVoxels.count() << "\n";
794+ qDebug() << "cleanupRemovedVoxels().. _removedVoxels=" << _removedVoxels.count();
795795 }
796796 while (!_removedVoxels.isEmpty()) {
797797 delete _removedVoxels.extract();
@@ -805,7 +805,7 @@ void VoxelSystem::cleanupRemovedVoxels() { · 7 unmodified lines
805805 if (!_writeRenderFullVBO && (_abandonedVBOSlots > (_voxelsInWriteArrays * TOO_MANY_ABANDONED_RATIO))) {
806806 if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
807807 qDebug() << "cleanupRemovedVoxels().. _abandonedVBOSlots ["
808− << _abandonedVBOSlots << "] > TOO_MANY_ABANDONED_RATIO \n";
808+ << _abandonedVBOSlots << "] > TOO_MANY_ABANDONED_RATIO";
809809 }
810810 _writeRenderFullVBO = true;
811811 }
@@ -972,7 +972,7 @@ int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, boo · 160 unmodified lines
972972 // possibly shifting down to lower LOD or something. This debug message is to help identify, if/when/how this
973973 // state actually occurs.
974974 if (Application::getInstance()->getLogger()->extraDebugging()) {
975− qDebug("OHHHH NOOOOOO!!!! updateNodeInArrays() BAILING (_voxelsInWriteArrays >= _maxVoxels)\n");
975+ qDebug("OH NO! updateNodeInArrays() BAILING (_voxelsInWriteArrays >= _maxVoxels)");
976976 }
977977 return 0;
978978 }
@@ -1052,7 +1052,7 @@ ProgramObject VoxelSystem::_shadowMapProgram; · 73 unmodified lines
10521052
10531053 void VoxelSystem::init() {
10541054 if (_initialized) {
1055− qDebug("[ERROR] VoxelSystem is already initialized.\n");
1055+ qDebug("[ERROR] VoxelSystem is already initialized.");
10561056 return;
10571057 }
10581058
@@ -1426,7 +1426,7 @@ void VoxelSystem::clearAllNodesBufferIndex() { · 367 unmodified lines
14261426 _tree->recurseTreeWithOperation(clearAllNodesBufferIndexOperation);
14271427 unlockTree();
14281428 if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) {
1429− qDebug("clearing buffer index of %d nodes\n", _nodeCount);
1429+ qDebug("clearing buffer index of %d nodes", _nodeCount);
14301430 }
14311431 }
14321432
@@ -1439,7 +1439,7 @@ bool VoxelSystem::forceRedrawEntireTreeOperation(OctreeElement* element, void* e · 6 unmodified lines
14391439 void VoxelSystem::forceRedrawEntireTree() {
14401440 _nodeCount = 0;
14411441 _tree->recurseTreeWithOperation(forceRedrawEntireTreeOperation);
1442− qDebug("forcing redraw of %d nodes\n", _nodeCount);
1442+ qDebug("forcing redraw of %d nodes", _nodeCount);
14431443 _tree->setDirtyBit();
14441444 setupNewVoxelsForDrawing();
14451445 }
@@ -1457,7 +1457,7 @@ bool VoxelSystem::randomColorOperation(OctreeElement* element, void* extraData) · 11 unmodified lines
14571457 void VoxelSystem::randomizeVoxelColors() {
14581458 _nodeCount = 0;
14591459 _tree->recurseTreeWithOperation(randomColorOperation);
1460− qDebug("setting randomized true color for %d nodes\n", _nodeCount);
1460+ qDebug("setting randomized true color for %d nodes", _nodeCount);
14611461 _tree->setDirtyBit();
14621462 setupNewVoxelsForDrawing();
14631463 }
@@ -1473,7 +1473,7 @@ bool VoxelSystem::falseColorizeRandomOperation(OctreeElement* element, void* ext · 9 unmodified lines
14731473 void VoxelSystem::falseColorizeRandom() {
14741474 _nodeCount = 0;
14751475 _tree->recurseTreeWithOperation(falseColorizeRandomOperation);
1476− qDebug("setting randomized false color for %d nodes\n", _nodeCount);
1476+ qDebug("setting randomized false color for %d nodes", _nodeCount);
14771477 _tree->setDirtyBit();
14781478 setupNewVoxelsForDrawing();
14791479 }
@@ -1489,7 +1489,7 @@ void VoxelSystem::trueColorize() { · 9 unmodified lines
14891489 PerformanceWarning warn(true, "trueColorize()",true);
14901490 _nodeCount = 0;
14911491 _tree->recurseTreeWithOperation(trueColorizeOperation);
1492− qDebug("setting true color for %d nodes\n", _nodeCount);
1492+ qDebug("setting true color for %d nodes", _nodeCount);
14931493 _tree->setDirtyBit();
14941494 setupNewVoxelsForDrawing();
14951495 }
@@ -1511,7 +1511,7 @@ bool VoxelSystem::falseColorizeInViewOperation(OctreeElement* element, void* ext · 15 unmodified lines
15111511 void VoxelSystem::falseColorizeInView() {
15121512 _nodeCount = 0;
15131513 _tree->recurseTreeWithOperation(falseColorizeInViewOperation,(void*)_viewFrustum);
1514− qDebug("setting in view false color for %d nodes\n", _nodeCount);
1514+ qDebug("setting in view false color for %d nodes", _nodeCount);
15151515 _tree->setDirtyBit();
15161516 setupNewVoxelsForDrawing();
15171517 }
@@ -1594,13 +1594,13 @@ void VoxelSystem::falseColorizeBySource() { · 76 unmodified lines
15941594 };
15951595
15961596 // create a bunch of colors we'll use during colorization
1597− NodeList* nodeList = NodeList::getInstance();
1598− for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1597+
1598+ foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
15991599 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
16001600 uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID());
16011601 int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS;
16021602 args.colors[nodeID] = groupColors[groupColor];
1603−
1603+
16041604 if (groupColors[groupColor].red > 0) {
16051605 groupColors[groupColor].red = ((groupColors[groupColor].red - MIN_COLOR)/2) + MIN_COLOR;
16061606 }
@@ -1610,13 +1610,13 @@ void VoxelSystem::falseColorizeBySource() { · 3 unmodified lines
16101610 if (groupColors[groupColor].blue > 0) {
16111611 groupColors[groupColor].blue = ((groupColors[groupColor].blue - MIN_COLOR)/2) + MIN_COLOR;
16121612 }
1613−
1613+
16141614 voxelServerCount++;
16151615 }
16161616 }
16171617
16181618 _tree->recurseTreeWithOperation(falseColorizeBySourceOperation, &args);
1619− qDebug("setting false color by source for %d nodes\n", _nodeCount);
1619+ qDebug("setting false color by source for %d nodes", _nodeCount);
16201620 _tree->setDirtyBit();
16211621 setupNewVoxelsForDrawing();
16221622 }
@@ -1669,10 +1669,10 @@ void VoxelSystem::falseColorizeDistanceFromView() { · 46 unmodified lines
16691669 _maxDistance = 0.0;
16701670 _minDistance = FLT_MAX;
16711671 _tree->recurseTreeWithOperation(getDistanceFromViewRangeOperation, (void*) _viewFrustum);
1672− qDebug("determining distance range for %d nodes\n", _nodeCount);
1672+ qDebug("determining distance range for %d nodes", _nodeCount);
16731673 _nodeCount = 0;
16741674 _tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation, (void*) _viewFrustum);
1675− qDebug("setting in distance false color for %d nodes\n", _nodeCount);
1675+ qDebug("setting in distance false color for %d nodes", _nodeCount);
16761676 _tree->setDirtyBit();
16771677 setupNewVoxelsForDrawing();
16781678 }
@@ -1803,7 +1803,7 @@ void VoxelSystem::removeOutOfView() { · 124 unmodified lines
18031803 }
18041804 bool showRemoveDebugDetails = false;
18051805 if (showRemoveDebugDetails) {
1806− qDebug("removeOutOfView() scanned=%ld removed=%ld inside=%ld intersect=%ld outside=%ld _removedVoxels.count()=%d \n",
1806+ qDebug("removeOutOfView() scanned=%ld removed=%ld inside=%ld intersect=%ld outside=%ld _removedVoxels.count()=%d",
18071807 args.nodesScanned, args.nodesRemoved, args.nodesInside,
18081808 args.nodesIntersect, args.nodesOutside, _removedVoxels.count()
18091809 );
@@ -1832,7 +1832,7 @@ void VoxelSystem::showAllLocalVoxels() { · 22 unmodified lines
18321832
18331833 bool showRemoveDebugDetails = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
18341834 if (showRemoveDebugDetails) {
1835− qDebug("showAllLocalVoxels() scanned=%ld \n",args.nodesScanned );
1835+ qDebug("showAllLocalVoxels() scanned=%ld",args.nodesScanned );
18361836 }
18371837 }
18381838
@@ -1969,15 +1969,15 @@ void VoxelSystem::hideOutOfView(bool forceFullFrustum) { · 130 unmodified lines
19691969
19701970 bool extraDebugDetails = false; // Application::getInstance()->getLogger()->extraDebugging();
19711971 if (extraDebugDetails) {
1972− qDebug("hideOutOfView() scanned=%ld removed=%ld show=%ld inside=%ld intersect=%ld outside=%ld\n",
1972+ qDebug("hideOutOfView() scanned=%ld removed=%ld show=%ld inside=%ld intersect=%ld outside=%ld",
19731973 args.nodesScanned, args.nodesRemoved, args.nodesShown, args.nodesInside,
19741974 args.nodesIntersect, args.nodesOutside
19751975 );
1976− qDebug(" inside/inside=%ld intersect/inside=%ld outside/outside=%ld\n",
1976+ qDebug("inside/inside=%ld intersect/inside=%ld outside/outside=%ld",
19771977 args.nodesInsideInside, args.nodesIntersectInside, args.nodesOutsideOutside
19781978 );
19791979
1980− qDebug() << "args.thisViewFrustum....\n";
1980+ qDebug() << "args.thisViewFrustum....";
19811981 args.thisViewFrustum.printDebugDetails();
19821982 }
19831983 _inhideOutOfView = false;
@@ -2214,7 +2214,7 @@ bool VoxelSystem::falseColorizeRandomEveryOtherOperation(OctreeElement* element, · 230 unmodified lines
22142214 void VoxelSystem::falseColorizeRandomEveryOther() {
22152215 falseColorizeRandomEveryOtherArgs args;
22162216 _tree->recurseTreeWithOperation(falseColorizeRandomEveryOtherOperation,&args);
2217− qDebug("randomized false color for every other node: total %ld, colorable %ld, colored %ld\n",
2217+ qDebug("randomized false color for every other node: total %ld, colorable %ld, colored %ld",
22182218 args.totalNodes, args.colorableNodes, args.coloredNodes);
22192219 _tree->setDirtyBit();
22202220 setupNewVoxelsForDrawing();
@@ -2284,14 +2284,14 @@ bool VoxelSystem::collectStatsForTreesAndVBOsOperation(OctreeElement* element, v · 63 unmodified lines
22842284
22852285 const bool extraDebugging = false; // enable for extra debugging
22862286 if (extraDebugging) {
2287− qDebug("node In VBO... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s \n",
2287+ qDebug("node In VBO... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s",
22882288 voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(),
22892289 nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()));
22902290 }
22912291
22922292 if (args->hasIndexFound[nodeIndex]) {
22932293 args->duplicateVBOIndex++;
2294− qDebug("duplicateVBO found... index=%ld, isDirty=%s, shouldRender=%s \n", nodeIndex,
2294+ qDebug("duplicateVBO found... index=%ld, isDirty=%s, shouldRender=%s", nodeIndex,
22952295 debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()));
22962296 } else {
22972297 args->hasIndexFound[nodeIndex] = true;
@@ -2325,17 +2325,17 @@ void VoxelSystem::collectStatsForTreesAndVBOs() { · 27 unmodified lines
23252325 collectStatsForTreesAndVBOsArgs args(_maxVoxels);
23262326 args.expectedMax = _voxelsInWriteArrays;
23272327
2328− qDebug("CALCULATING Local Voxel Tree Statistics >>>>>>>>>>>>\n");
2328+ qDebug("CALCULATING Local Voxel Tree Statistics >>>>>>>>>>>>");
23292329
23302330 _tree->recurseTreeWithOperation(collectStatsForTreesAndVBOsOperation,&args);
23312331
2332− qDebug("Local Voxel Tree Statistics:\n total nodes %ld \n leaves %ld \n dirty %ld \n colored %ld \n shouldRender %ld \n",
2332+ qDebug("Local Voxel Tree Statistics:\n total nodes %ld \n leaves %ld \n dirty %ld \n colored %ld \n shouldRender %ld",
23332333 args.totalNodes, args.leafNodes, args.dirtyNodes, args.coloredNodes, args.shouldRenderNodes);
23342334
2335− qDebug(" _voxelsDirty=%s \n _voxelsInWriteArrays=%ld \n minDirty=%ld \n maxDirty=%ld \n", debug::valueOf(_voxelsDirty),
2335+ qDebug(" _voxelsDirty=%s \n _voxelsInWriteArrays=%ld \n minDirty=%ld \n maxDirty=%ld", debug::valueOf(_voxelsDirty),
23362336 _voxelsInWriteArrays, minDirty, maxDirty);
23372337
2338− qDebug(" inVBO %ld \n nodesInVBOOverExpectedMax %ld \n duplicateVBOIndex %ld \n nodesInVBONotShouldRender %ld \n",
2338+ qDebug(" inVBO %ld \n nodesInVBOOverExpectedMax %ld \n duplicateVBOIndex %ld \n nodesInVBONotShouldRender %ld",
23392339 args.nodesInVBO, args.nodesInVBOOverExpectedMax, args.duplicateVBOIndex, args.nodesInVBONotShouldRender);
23402340
23412341 glBufferIndex minInVBO = GLBUFFER_INDEX_UNKNOWN;
@@ -2348,13 +2348,13 @@ void VoxelSystem::collectStatsForTreesAndVBOs() { · 6 unmodified lines
23482348 }
23492349 }
23502350
2351− qDebug(" minInVBO=%ld \n maxInVBO=%ld \n _voxelsInWriteArrays=%ld \n _voxelsInReadArrays=%ld \n",
2351+ qDebug(" minInVBO=%ld \n maxInVBO=%ld \n _voxelsInWriteArrays=%ld \n _voxelsInReadArrays=%ld",
23522352 minInVBO, maxInVBO, _voxelsInWriteArrays, _voxelsInReadArrays);
23532353
2354− qDebug(" _freeIndexes.size()=%ld \n",
2354+ qDebug(" _freeIndexes.size()=%ld",
23552355 _freeIndexes.size());
23562356
2357− qDebug("DONE WITH Local Voxel Tree Statistics >>>>>>>>>>>>\n");
2357+ qDebug("DONE WITH Local Voxel Tree Statistics >>>>>>>>>>>>");
23582358 }
23592359
23602360
@@ -2534,7 +2534,7 @@ void VoxelSystem::falseColorizeOccluded() { · 173 unmodified lines
25342534
25352535 _tree->recurseTreeWithOperationDistanceSorted(falseColorizeOccludedOperation, position, (void*)&args);
25362536
2537− qDebug("falseColorizeOccluded()\n position=(%f,%f)\n total=%ld\n colored=%ld\n occluded=%ld\n notOccluded=%ld\n outOfView=%ld\n subtreeVoxelsSkipped=%ld\n nonLeaves=%ld\n nonLeavesOutOfView=%ld\n nonLeavesOccluded=%ld\n pointInside_calls=%ld\n occludes_calls=%ld\n intersects_calls=%ld\n",
2537+ qDebug("falseColorizeOccluded()\n position=(%f,%f)\n total=%ld\n colored=%ld\n occluded=%ld\n notOccluded=%ld\n outOfView=%ld\n subtreeVoxelsSkipped=%ld\n nonLeaves=%ld\n nonLeavesOutOfView=%ld\n nonLeavesOccluded=%ld\n pointInside_calls=%ld\n occludes_calls=%ld\n intersects_calls=%ld",
25382538 position.x, position.y,
25392539 args.totalVoxels, args.coloredVoxels, args.occludedVoxels,
25402540 args.notOccludedVoxels, args.outOfView, args.subtreeVoxelsSkipped,
@@ -2667,9 +2667,9 @@ void VoxelSystem::falseColorizeOccludedV2() { · 126 unmodified lines
26672667 setupNewVoxelsForDrawing();
26682668 }
26692669
2670−void VoxelSystem::nodeAdded(Node* node) {
2670+void VoxelSystem::nodeAdded(SharedNodePointer node) {
26712671 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
2672− qDebug("VoxelSystem... voxel server %s added...\n", node->getUUID().toString().toLocal8Bit().constData());
2672+ qDebug("VoxelSystem... voxel server %s added...", node->getUUID().toString().toLocal8Bit().constData());
26732673 _voxelServerCount++;
26742674 }
26752675 }
@@ -2688,11 +2688,11 @@ bool VoxelSystem::killSourceVoxelsOperation(OctreeElement* element, void* extraD · 12 unmodified lines
26882688 return true;
26892689 }
26902690
2691−void VoxelSystem::nodeKilled(Node* node) {
2691+void VoxelSystem::nodeKilled(SharedNodePointer node) {
26922692 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
26932693 _voxelServerCount--;
26942694 QUuid nodeUUID = node->getUUID();
2695− qDebug("VoxelSystem... voxel server %s removed...\n", nodeUUID.toString().toLocal8Bit().constData());
2695+ qDebug("VoxelSystem... voxel server %s removed...", nodeUUID.toString().toLocal8Bit().constData());
26962696 }
26972697 }
26982698
@@ -2761,7 +2761,7 @@ void VoxelSystem::unlockTree() { · 62 unmodified lines
27612761
27622762
27632763 void VoxelSystem::localVoxelCacheLoaded() {
2764− qDebug() << "localVoxelCacheLoaded()\n";
2764+ qDebug() << "localVoxelCacheLoaded()";
27652765
27662766 // Make sure that the application has properly set up the view frustum for our loaded state
27672767 Application::getInstance()->initAvatarAndViewFrustum();
@@ -2774,11 +2774,11 @@ void VoxelSystem::localVoxelCacheLoaded() { · 6 unmodified lines
27742774 }
27752775
27762776 void VoxelSystem::beginLoadingLocalVoxelCache() {
2777− qDebug() << "beginLoadingLocalVoxelCache()\n";
2777+ qDebug() << "beginLoadingLocalVoxelCache()";
27782778 _writeRenderFullVBO = true; // this will disable individual node updates
27792779 _inhideOutOfView = true; // this will disable hidOutOfView which we want to do until local cache is loaded
27802780 killLocalVoxels();
2781− qDebug() << "DONE beginLoadingLocalVoxelCache()\n";
2781+ qDebug() << "DONE beginLoadingLocalVoxelCache()";
27822782 }
27832783
27842784