History

Merge remote-tracking branch 'upstream/master'

matsukaze committed 12 years ago

Commit e800c802 parents 943b0b1 df7ffb355 files · +2362 −606Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+10−8
@@ -2382,7 +2382,7 @@ void VoxelSystem::hideOutOfView(bool forceFullFrustum) { · 2381 unmodified lines
23822382 bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraData) {
23832383 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
23842384 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2385−
2385+
23862386 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
23872387 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
23882388 // consider that case.
@@ -2418,7 +2418,7 @@ bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraDat · 29 unmodified lines
24182418 bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraData) {
24192419 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
24202420 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2421−
2421+
24222422 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
24232423 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
24242424 // consider that case.
@@ -2468,7 +2468,7 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat · 43 unmodified lines
24682468 bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData) {
24692469 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
24702470 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2471−
2471+
24722472 // If we're still recursing the tree using this operator, then we don't know if we're inside or outside...
24732473 // so before we move forward we need to determine our frustum location
24742474 ViewFrustum::location inFrustum = voxel->inFrustum(args->thisViewFrustum);
@@ -2485,7 +2485,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 10 unmodified lines
24852485 // ok, now do some processing for this node...
24862486 switch (inFrustum) {
24872487 case ViewFrustum::OUTSIDE: {
2488−
24892488 // If this node is outside the current view, then we might want to hide it... unless it was previously OUTSIDE,
24902489 // if it was previously outside, then we can safely assume it's already hidden, and we can also safely assume
24912490 // that all of it's children are outside both of our views, in which case we can just stop recursing...
@@ -2503,7 +2502,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 11 unmodified lines
25032502
25042503 } break;
25052504 case ViewFrustum::INSIDE: {
2506−
25072505 // If this node is INSIDE the current view, then we might want to show it... unless it was previously INSIDE,
25082506 // if it was previously INSIDE, then we can safely assume it's already shown, and we can also safely assume
25092507 // that all of it's children are INSIDE both of our views, in which case we can just stop recursing...
@@ -2517,12 +2515,10 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines
25172515 // we need to show it. Additionally we know that ALL of it's children are also fully INSIDE so we can recurse
25182516 // the children and simply mark them as visible (as appropriate based on LOD)
25192517 args->tree->recurseNodeWithOperation(voxel, showAllSubTreeOperation, args);
2520−
25212518 return false;
25222519 } break;
25232520 case ViewFrustum::INTERSECT: {
25242521 args->nodesScanned++;
2525−
25262522 // If this node INTERSECTS the current view, then we might want to show it... unless it was previously INSIDE
25272523 // the last known view, in which case it will already be visible, and we know that all it's children are also
25282524 // previously INSIDE and visible. So in this case stop recursing
@@ -2536,8 +2532,15 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines
25362532 // if the child node INTERSECTs the view, then we want to check to see if it thinks it should render
25372533 // if it should render but is missing it's VBO index, then we want to flip it on, and we can stop recursing from
25382534 // here because we know will block any children anyway
2535+
2536+ float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale();
2537+ int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust();
2538+ bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust);
2539+ voxel->setShouldRender(shouldRender);
2540+
25392541 if (voxel->getShouldRender() && !voxel->isKnownBufferIndex()) {
25402542 voxel->setDirtyBit(); // will this make it draw?
2543+ voxel->markWithChangedTime(); // both are needed to force redraw
25412544 args->nodesShown++;
25422545 return false;
25432546 }
@@ -2550,7 +2553,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 6 unmodified lines
25502553 } break;
25512554 } // switch
25522555
2553−
25542556 return true; // keep going!
25552557 }
25562558

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