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 | bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, args->voxelSizeScale, args->boundaryLevelAdjust); | 794 | bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, args->voxelSizeScale, args->boundaryLevelAdjust); |
| 795 | bool inView = voxel->isInView(args->thisViewFrustum); | 795 | bool inView = voxel->isInView(args->thisViewFrustum); |
| 796 | voxel->setShouldRender(inView && shouldRender); | 796 | voxel->setShouldRender(inView && shouldRender); |
| 797 | 797 | if (shouldRender && inView) { | |
| 798 | if (shouldRender) { | 798 | // recreate the geometry |
| 799 | bool falseColorize = false; | 799 | args->thisVoxelSystem->updateNodeInArrays(voxel, false, true); // DONT_REUSE_INDEX, FORCE_REDRAW |
| 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 | ||
| 807 | } | 800 | } |
| 808 | 801 | ||
| 809 | return true; // keep recursing! | 802 | return true; // keep recursing! |
| @@ -814,30 +807,17 @@ bool VoxelSystem::recreateVoxelGeometryInViewOperation(OctreeElement* element, v · 4 unmodified lines | |||
| 814 | // TODO: other than cleanupRemovedVoxels() is there anyplace we attempt to detect too many abandoned slots??? | 807 | // TODO: other than cleanupRemovedVoxels() is there anyplace we attempt to detect too many abandoned slots??? |
| 815 | void VoxelSystem::recreateVoxelGeometryInView() { | 808 | void VoxelSystem::recreateVoxelGeometryInView() { |
| 816 | 809 | ||
| 817 | qDebug() << "recreateVoxelGeometryInView()..."; | 810 | qDebug() << "recreateVoxelGeometryInView()..."; |
| 818 | 811 | ||
| 819 | recreateVoxelGeometryInViewArgs args(this); | 812 | recreateVoxelGeometryInViewArgs args(this); |
| 820 | _writeArraysLock.lockForWrite(); // don't let anyone read or write our write arrays until we're done | 813 | _writeArraysLock.lockForWrite(); // don't let anyone read or write our write arrays until we're done |
| 821 | _tree->lockForRead(); // don't let anyone change our tree structure until we're run | 814 | _tree->lockForRead(); // don't let anyone change our tree structure until we're run |
| 822 | 815 | ||
| 823 | // reset our write arrays bookkeeping to think we've got no voxels in it | 816 | // reset our write arrays bookkeeping to think we've got no voxels in it |
| 824 | clearFreeBufferIndexes(); // does this do everything we need? | 817 | clearFreeBufferIndexes(); |
| 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; | ||
| 836 | 818 | ||
| 837 | // do we need to reset out _writeVoxelDirtyArray arrays?? | 819 | // do we need to reset out _writeVoxelDirtyArray arrays?? |
| 838 | memset(_writeVoxelDirtyArray, false, _maxVoxels * sizeof(bool)); | 820 | memset(_writeVoxelDirtyArray, false, _maxVoxels * sizeof(bool)); |
| 839 | |||
| 840 | |||
| 841 | 821 | ||
| 842 | _tree->recurseTreeWithOperation(recreateVoxelGeometryInViewOperation,(void*)&args); | 822 | _tree->recurseTreeWithOperation(recreateVoxelGeometryInViewOperation,(void*)&args); |
| 843 | _tree->unlock(); | 823 | _tree->unlock(); |
| @@ -882,8 +862,7 @@ void VoxelSystem::checkForCulling() { · 38 unmodified lines | |||
| 882 | 862 | ||
| 883 | if (fullRedraw) { | 863 | if (fullRedraw) { |
| 884 | // this will remove all old geometry and recreate the correct geometry for all in view voxels | 864 | // this will remove all old geometry and recreate the correct geometry for all in view voxels |
| 885 | //recreateVoxelGeometryInView(); | 865 | recreateVoxelGeometryInView(); |
| 886 | hideOutOfView(forceFullFrustum); | ||
| 887 | } else { | 866 | } else { |
| 888 | hideOutOfView(forceFullFrustum); | 867 | hideOutOfView(forceFullFrustum); |
| 889 | } | 868 | } |