diff --git a/source/re/core.d b/source/re/core.d index 4326bf3..441d0e9 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 b35457f..15241d6 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);