mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 04:44:08 +02:00
some debug changes for testing occlusion culling
This commit is contained in:
parent
2e58a77180
commit
627f61badb
2 changed files with 24 additions and 6 deletions
|
@ -1899,6 +1899,20 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
|||
|
||||
// -1,-1 is 0,windowHeight
|
||||
// 1,1 is windowWidth,0
|
||||
|
||||
// -1,1 1,1
|
||||
// +-----------------------+
|
||||
// | | |
|
||||
// | | |
|
||||
// | -1,0 | |
|
||||
// |-----------+-----------|
|
||||
// | 0,0 |
|
||||
// | | |
|
||||
// | | |
|
||||
// | | |
|
||||
// +-----------------------+
|
||||
// -1,-1 1,-1
|
||||
|
||||
glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
|
||||
((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->height());
|
||||
|
||||
|
@ -1929,10 +1943,6 @@ void Application::renderVirtualOccluders() {
|
|||
boxB.scale(TREE_SCALE);
|
||||
VoxelProjectedShadow shadowB = _viewFrustum.getProjectedShadow(boxB);
|
||||
|
||||
//CoverageMap::StorageResult result;
|
||||
//result = map.storeInMap(&shadowB); // test this first since it's closer in Z-buffer
|
||||
//result = map.storeInMap(&shadowA);
|
||||
|
||||
bool shadowAoccludesB = shadowA.occludes(shadowB);
|
||||
bool shadowBoccludesA = shadowB.occludes(shadowA);
|
||||
|
||||
|
|
|
@ -1189,21 +1189,29 @@ void VoxelSystem::falseColorizeTestOccluded() {
|
|||
}
|
||||
|
||||
bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraData) {
|
||||
//node->printDebugDetails(">>>>>>>>>>>>>>> falseColorizeOccludedOperation() BEGIN >>>>>>>>>>>>>>");
|
||||
FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData;
|
||||
if (node->isColored() && node->isLeaf()) {
|
||||
if (node->isColored() && node->isLeaf() && !node->isStagedForDeletion() && node->getShouldRender()) {
|
||||
//printLog("***** falseColorizeOccludedOperation() NODE is colored, etc, so consider it *****\n");
|
||||
AABox voxelBox = node->getAABox();
|
||||
voxelBox.scale(TREE_SCALE);
|
||||
VoxelProjectedShadow* voxelShadow = new VoxelProjectedShadow(args->viewFrustum->getProjectedShadow(voxelBox));
|
||||
CoverageMap::StorageResult result = args->map->storeInMap(voxelShadow);
|
||||
if (result == CoverageMap::OCCLUDED) {
|
||||
//printLog("***** falseColorizeOccludedOperation() NODE is OCCLUDED *****\n");
|
||||
node->setFalseColor(255, 0, 0);
|
||||
} else if (result == CoverageMap::STORED) {
|
||||
//printLog("***** falseColorizeOccludedOperation() NODE is STORED *****\n");
|
||||
} else if (result == CoverageMap::DOESNT_FIT) {
|
||||
//printLog("***** falseColorizeOccludedOperation() NODE DOESNT_FIT???? *****\n");
|
||||
}
|
||||
}
|
||||
//printLog("<<<<<<<<<<<<<<<<< falseColorizeOccludedOperation() END <<<<<<<<<<<<<<<<<\n");
|
||||
return true; // keep going!
|
||||
}
|
||||
|
||||
void VoxelSystem::falseColorizeOccluded() {
|
||||
CoverageMap map(BoundingBox(glm::vec2(-1.f,-1.f), glm::vec2(2.f,2.f)), true);
|
||||
CoverageMap map(BoundingBox(glm::vec2(-2.f,-2.f), glm::vec2(4.f,4.f)), true);
|
||||
FalseColorizeOccludedArgs args;
|
||||
args.viewFrustum = Application::getInstance()->getViewFrustum();
|
||||
args.map = ↦
|
||||
|
|
Loading…
Reference in a new issue