History

Removed duplicate pathway to updateNodeInArrays from showAllSubTreeOperation

matsukaze committed 12 years ago

Commit a3ce69b1 parent 616ccd92 files · +49 −29Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+44−26
@@ -60,6 +60,7 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) · 59 unmodified lines
6060 _treeScale(treeScale),
6161 _maxVoxels(maxVoxels),
6262 _initialized(false),
63+ _inInspectForOcclusions(false),
6364 _showCulledSharedFaces(false),
6465 _usePrimitiveRenderer(false),
6566 _renderer(0) {
@@ -1028,7 +1029,6 @@ int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, boo · 962 unmodified lines
10281029 } else {
10291030 node->setVoxelSystem(this);
10301031 }
1031− inspectForInteriorOcclusionsOperation(node, 0);
10321032 unsigned char occlusions;
10331033 if (_showCulledSharedFaces) {
10341034 occlusions = ~node->getInteriorOcclusions();
@@ -1675,15 +1675,7 @@ void VoxelSystem::cullSharedFaces() { · 640 unmodified lines
16751675 _usePrimitiveRenderer = true;
16761676 _renderer->release();
16771677 clearAllNodesBufferIndex();
1678− lockTree();
1679− _tree->recurseTreeWithPostOperation(inspectForExteriorOcclusionsOperation);
1680− _tree->recurseTreeWithPostOperation(inspectForExteriorOcclusionsOperation);
1681− unlockTree();
1682−
1683− _nodeCount = 0;
1684− lockTree();
1685− _tree->recurseTreeWithOperation(inspectForInteriorOcclusionsOperation);
1686− unlockTree();
1678+ inspectForOcclusions();
16871679 qDebug("culling shared faces in %d nodes", _nodeCount);
16881680 } else {
16891681 _usePrimitiveRenderer = false;
@@ -1710,8 +1702,30 @@ void VoxelSystem::showCulledSharedFaces() { · 20 unmodified lines
17101702 _showCulledSharedFaces = false;
17111703 }
17121704 if (Menu::getInstance()->isOptionChecked(MenuOption::CullSharedFaces)) {
1713− cullSharedFaces();
1705+ _writeRenderFullVBO = true;
1706+ _tree->setDirtyBit();
1707+ setupNewVoxelsForDrawing();
1708+ }
1709+}
1710+
1711+void VoxelSystem::inspectForOcclusions() {
1712+
1713+ // don't re-enter...
1714+ if (_inInspectForOcclusions) {
1715+ return;
17141716 }
1717+
1718+ _inInspectForOcclusions = true;
1719+
1720+ bool showDebugDetails = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1721+ PerformanceWarning warn(showDebugDetails, "inspectForOcclusions()");
1722+
1723+ lockTree();
1724+ _tree->recurseTreeWithPostOperation(inspectForExteriorOcclusionsOperation);
1725+ _tree->recurseTreeWithOperation(inspectForInteriorOcclusionsOperation);
1726+ unlockTree();
1727+
1728+ _inInspectForOcclusions = false;
17151729 }
17161730
17171731 bool VoxelSystem::forceRedrawEntireTreeOperation(OctreeElement* element, void* extraData) {
@@ -2338,11 +2352,12 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat · 620 unmodified lines
23382352 voxel->setDirtyBit();
23392353 voxel->markWithChangedTime();
23402354 // and this?
2341− {
2342− VoxelSystem* thisVoxelSystem = args->thisVoxelSystem;
2343− thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->updateNodeInArrays(voxel, true, true);
2344− thisVoxelSystem->setupNewVoxelsForDrawingSingleNode();
2345− }
2355+// no, not needed, because markWithChangedTime notifies hooks, which calls elementUpdated, which calls updateNodeInArrays
2356+// {
2357+// VoxelSystem* thisVoxelSystem = args->thisVoxelSystem;
2358+// thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->updateNodeInArrays(voxel, true, true);
2359+// thisVoxelSystem->setupNewVoxelsForDrawingSingleNode();
2360+// }
23462361 args->nodesShown++;
23472362 }
23482363
@@ -2386,7 +2401,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 37 unmodified lines
23862401 // we need to hide it. Additionally we know that ALL of it's children are also fully OUTSIDE so we can recurse
23872402 // the children and simply mark them as hidden
23882403 args->tree->recurseNodeWithOperation(voxel, hideAllSubTreeOperation, args );
2389−
23902404 return false;
23912405
23922406 } break;
@@ -2576,25 +2590,29 @@ bool VoxelSystem::collectStatsForTreesAndVBOsOperation(OctreeElement* element, v · 183 unmodified lines
25762590 }
25772591
25782592 unsigned long nodeIndex = 0;
2579− if (voxel->isKnownBufferIndex()) {
2580− args->nodesInVBO++;
2581− nodeIndex = voxel->getBufferIndex();
2582− }
2583−
25842593 if (voxel->getPrimitiveIndex()) {
25852594 args->nodesInPrimitiveRenderer++;
25862595 nodeIndex = voxel->getPrimitiveIndex();
2587− }
2588−
2589− if (voxel->isKnownBufferIndex() || (voxel->getPrimitiveIndex() != 0)) {
25902596
25912597 const bool extraDebugging = false; // enable for extra debugging
25922598 if (extraDebugging) {
2593− qDebug("node In VBO... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s, culledFaces=0x%02x \n",
2599+ qDebug("node In Renderer... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s, culledFaces=0x%02x \n",
25942600 voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(),
25952601 nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()),
25962602 voxel->getInteriorOcclusions());
25972603 }
2604+ }
2605+
2606+ if (voxel->isKnownBufferIndex()) {
2607+ args->nodesInVBO++;
2608+ nodeIndex = voxel->getBufferIndex();
2609+
2610+ const bool extraDebugging = false; // enable for extra debugging
2611+ if (extraDebugging) {
2612+ qDebug("node In VBO... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s \n",
2613+ voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(),
2614+ nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()));
2615+ }
25982616
25992617 if (args->hasIndexFound[nodeIndex]) {
26002618 args->duplicateVBOIndex++;