Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -794,16 +794,9 @@ bool VoxelSystem::recreateVoxelGeometryInViewOperation(OctreeElement* element, v · 793 unmodified lines | ||
| 794 | 794 | bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, args->voxelSizeScale, args->boundaryLevelAdjust); |
| 795 | 795 | bool inView = voxel->isInView(args->thisViewFrustum); |
| 796 | 796 | voxel->setShouldRender(inView && shouldRender); |
| 797 | − | |
| 798 | − if (shouldRender) { | |
| 799 | − bool falseColorize = false; | |
| 800 | − if (falseColorize) { | |
| 801 | − voxel->setFalseColor(0,0,255); // false colorize | |
| 802 | − } | |
| 803 | − // These are both needed to force redraw... | |
| 804 | − voxel->setDirtyBit(); | |
| 805 | − qDebug() << "recreateVoxelGeometryInViewOperation()... calling voxel->markWithChangedTime()"; | |
| 806 | − voxel->markWithChangedTime(); // this will notifyUpdateHooks, which will result in our geometry being created | |
| 797 | + if (shouldRender && inView) { | |
| 798 | + // recreate the geometry | |
| 799 | + args->thisVoxelSystem->updateNodeInArrays(voxel, false, true); // DONT_REUSE_INDEX, FORCE_REDRAW | |
| 807 | 800 | } |
| 808 | 801 | |
| 809 | 802 | return true; // keep recursing! |
| @@ -814,30 +807,17 @@ bool VoxelSystem::recreateVoxelGeometryInViewOperation(OctreeElement* element, v · 4 unmodified lines | ||
| 814 | 807 | // TODO: other than cleanupRemovedVoxels() is there anyplace we attempt to detect too many abandoned slots??? |
| 815 | 808 | void VoxelSystem::recreateVoxelGeometryInView() { |
| 816 | 809 | |
| 817 | −qDebug() << "recreateVoxelGeometryInView()..."; | |
| 810 | + qDebug() << "recreateVoxelGeometryInView()..."; | |
| 818 | 811 | |
| 819 | 812 | recreateVoxelGeometryInViewArgs args(this); |
| 820 | 813 | _writeArraysLock.lockForWrite(); // don't let anyone read or write our write arrays until we're done |
| 821 | 814 | _tree->lockForRead(); // don't let anyone change our tree structure until we're run |
| 822 | 815 | |
| 823 | 816 | // reset our write arrays bookkeeping to think we've got no voxels in it |
| 824 | − clearFreeBufferIndexes(); // does this do everything we need? | |
| 825 | − /** | |
| 826 | − // clear out all our abandoned indexes - they are all available | |
| 827 | − // TODO: is it possible freeBufferIndex() will get called??? | |
| 828 | − _voxelsInWriteArrays = 0; | |
| 829 | − _freeIndexLock.lock(); | |
| 830 | − _freeIndexes.clear(); | |
| 831 | − _freeIndexLock.unlock(); | |
| 832 | − **/ | |
| 833 | − | |
| 834 | − //_voxelsUpdated = 0; // ???? | |
| 835 | − //_writeRenderFullVBO = true; | |
| 817 | + clearFreeBufferIndexes(); | |
| 836 | 818 | |
| 837 | 819 | // do we need to reset out _writeVoxelDirtyArray arrays?? |
| 838 | 820 | memset(_writeVoxelDirtyArray, false, _maxVoxels * sizeof(bool)); |
| 839 | − | |
| 840 | − | |
| 841 | 821 | |
| 842 | 822 | _tree->recurseTreeWithOperation(recreateVoxelGeometryInViewOperation,(void*)&args); |
| 843 | 823 | _tree->unlock(); |
| @@ -882,8 +862,7 @@ void VoxelSystem::checkForCulling() { · 38 unmodified lines | ||
| 882 | 862 | |
| 883 | 863 | if (fullRedraw) { |
| 884 | 864 | // this will remove all old geometry and recreate the correct geometry for all in view voxels |
| 885 | − //recreateVoxelGeometryInView(); | |
| 886 | − hideOutOfView(forceFullFrustum); | |
| 865 | + recreateVoxelGeometryInView(); | |
| 887 | 866 | } else { |
| 888 | 867 | hideOutOfView(forceFullFrustum); |
| 889 | 868 | } |