optimisation: only render visible portals

This commit is contained in:
2022-10-09 17:06:21 +02:00
parent 3477601c5f
commit 3a343f8811

View File

@@ -60,6 +60,12 @@ namespace Escape_Room_Engine.Portal
private void Render(ScriptableRenderContext scriptableRenderContext, Camera camera)
{
// check whether the portal plane is visible from the player camera
var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(_playerCamera.camera);
if (!GeometryUtility.TestPlanesAABB(frustumPlanes, other.portalQuad.bounds))
// don't render this portal if it is not visible
return;
var t = transform;
foreach (var eye in Eyes)