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
160 }160 }
161 161
162 double sinceLastViewCulling = (start - _lastViewCulling) / 1000.0;162 double sinceLastViewCulling = (start - _lastViewCulling) / 1000.0;
163 // If the view frustum has changed, since last time, then remove nodes that are out of view163 // 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)) && hasViewChanged()) {164 if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS))
165 && !isViewChanging() && hasViewChanged()) {
165 _lastViewCulling = start;166 _lastViewCulling = start;
166 167
167 // When we call removeOutOfView() voxels, we don't actually remove the voxels from the VBOs, but we do remove168 // When we call removeOutOfView() voxels, we don't actually remove the voxels from the VBOs, but we do remove
168 // them from tree, this makes our tree caclulations faster, but doesn't require us to fully rebuild the VBOs (which169 // them from tree, this makes our tree caclulations faster, but doesn't require us to fully rebuild the VBOs (which
169 // can be expensive).170 // can be expensive).
171printLog("CALLING---removeOutOfView(); sinceLastViewCulling=%lf \n",sinceLastViewCulling);
170 removeOutOfView();172 removeOutOfView();
171 173
172 // Once we call cleanupRemovedVoxels() we do need to rebuild our VBOs (if anything was actually removed). So,174 // 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
883 return true; // keep going!885 return true; // keep going!
884}886}
885 887
886bool VoxelSystem::hasViewChanged() {888
889bool VoxelSystem::isViewChanging() {
887 bool result = false; // assume the best890 bool result = false; // assume the best
891 // If our viewFrustum has changed since our _lastKnowViewFrustum
888 if (_viewFrustum && !_lastKnowViewFrustum.matches(_viewFrustum)) {892 if (_viewFrustum && !_lastKnowViewFrustum.matches(_viewFrustum)) {
889 result = true;893 result = true;
890 _lastKnowViewFrustum = *_viewFrustum; // save last known894 _lastKnowViewFrustum = *_viewFrustum; // save last known
@@ -892,6 +896,22 @@ bool VoxelSystem::hasViewChanged() { · 1 unmodified line
892 return result;896 return result;
893}897}
894 898
899bool 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
895void VoxelSystem::removeOutOfView() {915void VoxelSystem::removeOutOfView() {
896 PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()");916 PerformanceWarning warn(_renderWarningsOn, "removeOutOfView()");
897 removeOutOfViewArgs args(this);917 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