fix frustum culling for portals

This commit is contained in:
2023-03-08 17:12:48 +01:00
parent 4be8380a40
commit 574ae42c93
2 changed files with 144 additions and 2 deletions

View File

@@ -81,8 +81,12 @@ namespace EscapeRoomEngine.Portal.Runtime
context.ExecuteCommandBuffer(_commandBuffer);
_commandBuffer.Clear();
// frustum culling
camera.TryGetCullingParameters(true, out var cullingParameters);
var cullingResults = context.Cull(ref cullingParameters);
// render the portal
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filteringSettings, ref _renderStateBlock);
context.DrawRenderers(cullingResults, ref drawingSettings, ref filteringSettings, ref _renderStateBlock);
// reset
RenderingUtils.SetViewAndProjectionMatrices(_commandBuffer, cameraData.GetViewMatrix(), cameraData.GetGPUProjectionMatrix(), false);