From dd8497a0256a5e35ac6f469e2f756bc0726f4532 Mon Sep 17 00:00:00 2001 From: redthing1 Date: Mon, 15 Jul 2024 20:51:42 -0700 Subject: [PATCH] scene: add output_rect --- source/re/core.d | 3 +-- source/re/ng/scene.d | 11 +++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/re/core.d b/source/re/core.d index 4326bf34..441d0e90 100644 --- a/source/re/core.d +++ b/source/re/core.d @@ -240,9 +240,8 @@ abstract class Core { raylib.BeginShaderMode(vr.distortion_shader); } - auto render_target_rect = Rectangle(0, 0, window.screen_width, window.screen_height); RenderExt.draw_render_target( - scene.render_target, render_target_rect, scene.composite_mode.color + scene.render_target, scene.output_rect, scene.composite_mode.color ); version (vr) { diff --git a/source/re/ng/scene.d b/source/re/ng/scene.d index b35457fb..15241d6a 100644 --- a/source/re/ng/scene.d +++ b/source/re/ng/scene.d @@ -34,6 +34,8 @@ abstract class Scene { public PostProcessor[] postprocessors; /// updatable managers public Manager[] managers; + /// the render target's output rectangle + public Rectangle output_rect; /// the mode for compositing a scene onto the display buffer public struct CompositeMode { @@ -43,6 +45,10 @@ abstract class Scene { /// creates a new scene this() { + output_rect = Rectangle( + 0, 0, + Core.window.screen_width, Core.window.screen_height + ); } /// gets the render resolution. initialized to Core.default_resolution @@ -138,8 +144,9 @@ abstract class Scene { } // create render target // TODO: use scene resolution instead of window resolution - render_target = RenderExt.create_render_target(cast(int) resolution.x, cast(int) resolution - .y); + render_target = RenderExt.create_render_target( + cast(int) resolution.x, cast(int) resolution.y + ); Core.log.info(format("recreated render target of size %s", resolution)); // apply texture filter raylib.SetTextureFilter(render_target.texture, Core.default_filter_mode);