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
2382bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraData) {2382bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraData) {
2383 VoxelTreeElement* voxel = (VoxelTreeElement*)element;2383 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
2384 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;2384 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2385 2385
2386 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine2386 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
2387 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not2387 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
2388 // consider that case.2388 // consider that case.
@@ -2418,7 +2418,7 @@ bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraDat · 29 unmodified lines
2418bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraData) {2418bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraData) {
2419 VoxelTreeElement* voxel = (VoxelTreeElement*)element;2419 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
2420 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;2420 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2421 2421
2422 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine2422 // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
2423 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not2423 // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
2424 // consider that case.2424 // consider that case.
@@ -2468,7 +2468,7 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat · 43 unmodified lines
2468bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData) {2468bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData) {
2469 VoxelTreeElement* voxel = (VoxelTreeElement*)element;2469 VoxelTreeElement* voxel = (VoxelTreeElement*)element;
2470 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;2470 hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData;
2471 2471
2472 // If we're still recursing the tree using this operator, then we don't know if we're inside or outside...2472 // If we're still recursing the tree using this operator, then we don't know if we're inside or outside...
2473 // so before we move forward we need to determine our frustum location2473 // so before we move forward we need to determine our frustum location
2474 ViewFrustum::location inFrustum = voxel->inFrustum(args->thisViewFrustum);2474 ViewFrustum::location inFrustum = voxel->inFrustum(args->thisViewFrustum);
@@ -2485,7 +2485,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 10 unmodified lines
2485 // ok, now do some processing for this node...2485 // ok, now do some processing for this node...
2486 switch (inFrustum) {2486 switch (inFrustum) {
2487 case ViewFrustum::OUTSIDE: {2487 case ViewFrustum::OUTSIDE: {
2488
2489 // If this node is outside the current view, then we might want to hide it... unless it was previously OUTSIDE,2488 // If this node is outside the current view, then we might want to hide it... unless it was previously OUTSIDE,
2490 // if it was previously outside, then we can safely assume it's already hidden, and we can also safely assume2489 // if it was previously outside, then we can safely assume it's already hidden, and we can also safely assume
2491 // that all of it's children are outside both of our views, in which case we can just stop recursing...2490 // 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
2503 2502
2504 } break;2503 } break;
2505 case ViewFrustum::INSIDE: {2504 case ViewFrustum::INSIDE: {
2506
2507 // If this node is INSIDE the current view, then we might want to show it... unless it was previously INSIDE,2505 // If this node is INSIDE the current view, then we might want to show it... unless it was previously INSIDE,
2508 // if it was previously INSIDE, then we can safely assume it's already shown, and we can also safely assume2506 // if it was previously INSIDE, then we can safely assume it's already shown, and we can also safely assume
2509 // that all of it's children are INSIDE both of our views, in which case we can just stop recursing...2507 // 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
2517 // we need to show it. Additionally we know that ALL of it's children are also fully INSIDE so we can recurse2515 // we need to show it. Additionally we know that ALL of it's children are also fully INSIDE so we can recurse
2518 // the children and simply mark them as visible (as appropriate based on LOD)2516 // the children and simply mark them as visible (as appropriate based on LOD)
2519 args->tree->recurseNodeWithOperation(voxel, showAllSubTreeOperation, args);2517 args->tree->recurseNodeWithOperation(voxel, showAllSubTreeOperation, args);
2520
2521 return false;2518 return false;
2522 } break;2519 } break;
2523 case ViewFrustum::INTERSECT: {2520 case ViewFrustum::INTERSECT: {
2524 args->nodesScanned++;2521 args->nodesScanned++;
2525
2526 // If this node INTERSECTS the current view, then we might want to show it... unless it was previously INSIDE2522 // If this node INTERSECTS the current view, then we might want to show it... unless it was previously INSIDE
2527 // the last known view, in which case it will already be visible, and we know that all it's children are also2523 // the last known view, in which case it will already be visible, and we know that all it's children are also
2528 // previously INSIDE and visible. So in this case stop recursing2524 // previously INSIDE and visible. So in this case stop recursing
@@ -2536,8 +2532,15 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines
2536 // if the child node INTERSECTs the view, then we want to check to see if it thinks it should render2532 // if the child node INTERSECTs the view, then we want to check to see if it thinks it should render
2537 // if it should render but is missing it's VBO index, then we want to flip it on, and we can stop recursing from2533 // if it should render but is missing it's VBO index, then we want to flip it on, and we can stop recursing from
2538 // here because we know will block any children anyway2534 // 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
2539 if (voxel->getShouldRender() && !voxel->isKnownBufferIndex()) {2541 if (voxel->getShouldRender() && !voxel->isKnownBufferIndex()) {
2540 voxel->setDirtyBit(); // will this make it draw?2542 voxel->setDirtyBit(); // will this make it draw?
2543 voxel->markWithChangedTime(); // both are needed to force redraw
2541 args->nodesShown++;2544 args->nodesShown++;
2542 return false;2545 return false;
2543 }2546 }
@@ -2550,7 +2553,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 6 unmodified lines
2550 } break;2553 } break;
2551 } // switch2554 } // switch
2552 2555
2553
2554 return true; // keep going!2556 return true; // keep going!
2555}2557}
2556 2558

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