瀏覽代碼

GPU visibility tests: Fixing bugs

Panagiotis Christopoulos Charitos 10 年之前
父節點
當前提交
6693bfa567
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 5 3
      src/renderer/Tiler.cpp
  2. 1 1
      testapp/Main.cpp

+ 5 - 3
src/renderer/Tiler.cpp

@@ -142,6 +142,7 @@ Bool Tiler::test(const CollisionShape& cs, const Aabb& aabb) const
 	}
 
 	dist += m_near;
+	dist = -dist; // Because m_nearPlaneWspace has negatives
 
 	// Find the tiles that affect it
 	const Vec4& minv = aabb.getMin();
@@ -192,6 +193,7 @@ Bool Tiler::test(const CollisionShape& cs, const Aabb& aabb) const
 		&& yEnd >= 0 && yBegin <= tcountY);
 
 	// Check every tile
+	U visibleCount = (yEnd - yBegin) * (xEnd - xBegin);
 	for(I y = yBegin; y < yEnd; y++)
 	{
 		for(I x = xBegin; x < xEnd; x++)
@@ -199,14 +201,14 @@ Bool Tiler::test(const CollisionShape& cs, const Aabb& aabb) const
 			U tileIdx = y * tcountX + x;
 			F32 tileMaxDist = m_currentMinMax[tileIdx].y();
 
-			if(dist > tileMaxDist)
+			if(dist < tileMaxDist)
 			{
-				return false;
+				--visibleCount;
 			}
 		}
 	}
 
-	return true;
+	return visibleCount > 0;
 }
 
 } // end namespace anki

+ 1 - 1
testapp/Main.cpp

@@ -475,7 +475,7 @@ Error initSubsystems(int argc, char* argv[])
 	config.set("is.sm.poissonEnabled", true);
 	config.set("is.sm.resolution", 1024);
 	config.set("lf.maxFlares", 32);
-	config.set("pps.enabled", false);
+	config.set("pps.enabled", true);
 	config.set("pps.bloom.enabled", true);
 	config.set("pps.bloom.renderingQuality", 0.5);
 	config.set("pps.bloom.blurringDist", 1.0);