optimisation: only render visible portals
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user