History

Fix Delta Sending mode by not culling out of view voxels until we STOP moving - added isViewChanging() which determines if the view is currently changing - made hasViewChanged() report false UNTIL we've stopped moving - changed setupNewVoxelsForDrawing() to only call removeOutOfView() if we're not moving

ZappoMan committed 13 years ago

Commit f6863081 parent 48ca5622 files · +25 −3Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+23−3
@@ -160,13 +160,15 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 159 unmodified lines
160160 }
161161
162162 double sinceLastViewCulling = (start - _lastViewCulling) / 1000.0;
163− // If the view frustum has changed, since last time, then remove nodes that are out of view
164− if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) && hasViewChanged()) {
163+ // If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view
164+ if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS))
165+ && !isViewChanging() && hasViewChanged()) {
165166 _lastViewCulling = start;
166167
167168 // When we call removeOutOfView() voxels, we don't actually remove the voxels from the VBOs, but we do remove
168169 // them from tree, this makes our tree caclulations faster, but doesn't require us to fully rebuild the VBOs (which
169170 // can be expensive).
171+printLog("CALLING---removeOutOfView(); sinceLastViewCulling=%lf \n",sinceLastViewCulling);
170172 removeOutOfView();
171173
172174 // Once we call cleanupRemovedVoxels() we do need to rebuild our VBOs (if anything was actually removed). So,
@@ -883,8 +885,10 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) { · 710 unmodified lines
883885 return true; // keep going!
884886 }
885887
886−bool VoxelSystem::hasViewChanged() {
888+
889+bool VoxelSystem::isViewChanging() {
887890 bool result = false; // assume the best
891+ // If our viewFrustum has changed since our _lastKnowViewFrustum
888892 if (_viewFrustum && !_lastKnowViewFrustum.matches(_viewFrustum)) {
889893 result = true;
890894 _lastKnowViewFrustum = *_viewFrustum; // save last known
@@ -892,6 +896,22 @@ bool VoxelSystem::hasViewChanged() { · 1 unmodified line
892896 return result;
893897 }
894898
899+bool VoxelSystem::hasViewChanged() {
900+ bool result = false; // assume the best
901+
902+ // If we're still changing, report no change yet.
903+ if (isViewChanging()) {
904+ return false;
905+ }
906+
907+ // If our viewFrustum has changed since our _lastKnowViewFrustum
908+ if (_viewFrustum && !_lastStableViewFrustum.matches(_viewFrustum)) {
909+ result = true;
910+ _lastStableViewFrustum = *_viewFrustum; // save last stable
911+ }
912+ return result;
913+}
914+
895915 void VoxelSystem::removeOutOfView() {
896916 PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()");
897917 removeOutOfViewArgs args(this);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t