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
60 _treeScale(treeScale),60 _treeScale(treeScale),
61 _maxVoxels(maxVoxels),61 _maxVoxels(maxVoxels),
62 _initialized(false),62 _initialized(false),
63 _inInspectForOcclusions(false),
63 _showCulledSharedFaces(false),64 _showCulledSharedFaces(false),
64 _usePrimitiveRenderer(false),65 _usePrimitiveRenderer(false),
65 _renderer(0) {66 _renderer(0) {
@@ -1028,7 +1029,6 @@ int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, boo · 962 unmodified lines
1028 } else {1029 } else {
1029 node->setVoxelSystem(this);1030 node->setVoxelSystem(this);
1030 }1031 }
1031 inspectForInteriorOcclusionsOperation(node, 0);
1032 unsigned char occlusions;1032 unsigned char occlusions;
1033 if (_showCulledSharedFaces) {1033 if (_showCulledSharedFaces) {
1034 occlusions = ~node->getInteriorOcclusions();1034 occlusions = ~node->getInteriorOcclusions();
@@ -1675,15 +1675,7 @@ void VoxelSystem::cullSharedFaces() { · 640 unmodified lines
1675 _usePrimitiveRenderer = true;1675 _usePrimitiveRenderer = true;
1676 _renderer->release();1676 _renderer->release();
1677 clearAllNodesBufferIndex();1677 clearAllNodesBufferIndex();
1678 lockTree();1678 inspectForOcclusions();
1679 _tree->recurseTreeWithPostOperation(inspectForExteriorOcclusionsOperation);
1680 _tree->recurseTreeWithPostOperation(inspectForExteriorOcclusionsOperation);
1681 unlockTree();
1682
1683 _nodeCount = 0;
1684 lockTree();
1685 _tree->recurseTreeWithOperation(inspectForInteriorOcclusionsOperation);
1686 unlockTree();
1687 qDebug("culling shared faces in %d nodes", _nodeCount);1679 qDebug("culling shared faces in %d nodes", _nodeCount);
1688 } else {1680 } else {
1689 _usePrimitiveRenderer = false;1681 _usePrimitiveRenderer = false;
@@ -1710,8 +1702,30 @@ void VoxelSystem::showCulledSharedFaces() { · 20 unmodified lines
1710 _showCulledSharedFaces = false;1702 _showCulledSharedFaces = false;
1711 }1703 }
1712 if (Menu::getInstance()->isOptionChecked(MenuOption::CullSharedFaces)) {1704 if (Menu::getInstance()->isOptionChecked(MenuOption::CullSharedFaces)) {
1713 cullSharedFaces();1705 _writeRenderFullVBO = true;
1706 _tree->setDirtyBit();
1707 setupNewVoxelsForDrawing();
1708 }
1709}
1710
1711void VoxelSystem::inspectForOcclusions() {
1712
1713 // don't re-enter...
1714 if (_inInspectForOcclusions) {
1715 return;
1714 }1716 }
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;
1715}1729}
1716 1730
1717bool VoxelSystem::forceRedrawEntireTreeOperation(OctreeElement* element, void* extraData) {1731bool VoxelSystem::forceRedrawEntireTreeOperation(OctreeElement* element, void* extraData) {
@@ -2338,11 +2352,12 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat · 620 unmodified lines
2338 voxel->setDirtyBit();2352 voxel->setDirtyBit();
2339 voxel->markWithChangedTime();2353 voxel->markWithChangedTime();
2340 // and this?2354 // and this?
2341 {2355// no, not needed, because markWithChangedTime notifies hooks, which calls elementUpdated, which calls updateNodeInArrays
2342 VoxelSystem* thisVoxelSystem = args->thisVoxelSystem;2356// {
2343 thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->updateNodeInArrays(voxel, true, true);2357// VoxelSystem* thisVoxelSystem = args->thisVoxelSystem;
2344 thisVoxelSystem->setupNewVoxelsForDrawingSingleNode();2358// thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->updateNodeInArrays(voxel, true, true);
2345 }2359// thisVoxelSystem->setupNewVoxelsForDrawingSingleNode();
2360// }
2346 args->nodesShown++;2361 args->nodesShown++;
2347 }2362 }
2348 2363
@@ -2386,7 +2401,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 37 unmodified lines
2386 // we need to hide it. Additionally we know that ALL of it's children are also fully OUTSIDE so we can recurse2401 // we need to hide it. Additionally we know that ALL of it's children are also fully OUTSIDE so we can recurse
2387 // the children and simply mark them as hidden2402 // the children and simply mark them as hidden
2388 args->tree->recurseNodeWithOperation(voxel, hideAllSubTreeOperation, args );2403 args->tree->recurseNodeWithOperation(voxel, hideAllSubTreeOperation, args );
2389
2390 return false;2404 return false;
2391 2405
2392 } break;2406 } break;
@@ -2576,25 +2590,29 @@ bool VoxelSystem::collectStatsForTreesAndVBOsOperation(OctreeElement* element, v · 183 unmodified lines
2576 }2590 }
2577 2591
2578 unsigned long nodeIndex = 0;2592 unsigned long nodeIndex = 0;
2579 if (voxel->isKnownBufferIndex()) {
2580 args->nodesInVBO++;
2581 nodeIndex = voxel->getBufferIndex();
2582 }
2583
2584 if (voxel->getPrimitiveIndex()) {2593 if (voxel->getPrimitiveIndex()) {
2585 args->nodesInPrimitiveRenderer++;2594 args->nodesInPrimitiveRenderer++;
2586 nodeIndex = voxel->getPrimitiveIndex();2595 nodeIndex = voxel->getPrimitiveIndex();
2587 }
2588
2589 if (voxel->isKnownBufferIndex() || (voxel->getPrimitiveIndex() != 0)) {
2590 2596
2591 const bool extraDebugging = false; // enable for extra debugging2597 const bool extraDebugging = false; // enable for extra debugging
2592 if (extraDebugging) {2598 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",
2594 voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(),2600 voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(),
2595 nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()),2601 nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender()),
2596 voxel->getInteriorOcclusions());2602 voxel->getInteriorOcclusions());
2597 }2603 }
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 }
2598 2616
2599 if (args->hasIndexFound[nodeIndex]) {2617 if (args->hasIndexFound[nodeIndex]) {
2600 args->duplicateVBOIndex++;2618 args->duplicateVBOIndex++;