From e0ae2984ae8875e761e55189861bc28789d77121 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Thu, 18 Mar 2021 18:59:32 +0100 Subject: [PATCH] UICanvas frustum culling. --- Source/Engine/UI/UICanvas.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/UICanvas.cs b/Source/Engine/UI/UICanvas.cs index 6dfe6958d..5e9d340d2 100644 --- a/Source/Engine/UI/UICanvas.cs +++ b/Source/Engine/UI/UICanvas.cs @@ -57,7 +57,8 @@ namespace FlaxEngine /// public override void Render(GPUContext context, ref RenderContext renderContext, GPUTexture input, GPUTexture output) { - // TODO: apply frustum culling to skip rendering if canvas is not in a viewport + if (renderContext.View.Frustum.Contains(Canvas.Bounds.GetBoundingBox()) == ContainmentType.Disjoint) + return; Profiler.BeginEventGPU("UI Canvas");