History

first working cut at recreateVoxelGeometryInView()

ZappoMan committed 12 years ago

Commit 3aba29b1 parent cac67d71 file · +6 −27Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+6−27
@@ -794,16 +794,9 @@ bool VoxelSystem::recreateVoxelGeometryInViewOperation(OctreeElement* element, v · 793 unmodified lines
794794 bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, args->voxelSizeScale, args->boundaryLevelAdjust);
795795 bool inView = voxel->isInView(args->thisViewFrustum);
796796 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
807800 }
808801
809802 return true; // keep recursing!
@@ -814,30 +807,17 @@ bool VoxelSystem::recreateVoxelGeometryInViewOperation(OctreeElement* element, v · 4 unmodified lines
814807 // TODO: other than cleanupRemovedVoxels() is there anyplace we attempt to detect too many abandoned slots???
815808 void VoxelSystem::recreateVoxelGeometryInView() {
816809
817−qDebug() << "recreateVoxelGeometryInView()...";
810+ qDebug() << "recreateVoxelGeometryInView()...";
818811
819812 recreateVoxelGeometryInViewArgs args(this);
820813 _writeArraysLock.lockForWrite(); // don't let anyone read or write our write arrays until we're done
821814 _tree->lockForRead(); // don't let anyone change our tree structure until we're run
822815
823816 // 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();
836818
837819 // do we need to reset out _writeVoxelDirtyArray arrays??
838820 memset(_writeVoxelDirtyArray, false, _maxVoxels * sizeof(bool));
839−
840−
841821
842822 _tree->recurseTreeWithOperation(recreateVoxelGeometryInViewOperation,(void*)&args);
843823 _tree->unlock();
@@ -882,8 +862,7 @@ void VoxelSystem::checkForCulling() { · 38 unmodified lines
882862
883863 if (fullRedraw) {
884864 // this will remove all old geometry and recreate the correct geometry for all in view voxels
885− //recreateVoxelGeometryInView();
886− hideOutOfView(forceFullFrustum);
865+ recreateVoxelGeometryInView();
887866 } else {
888867 hideOutOfView(forceFullFrustum);
889868 }