Skip to content

Commit

Permalink
scene: add output_rect
Browse files Browse the repository at this point in the history
  • Loading branch information
redthing1 committed Jul 16, 2024
1 parent 55f06d8 commit dd8497a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 1 addition & 2 deletions source/re/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 9 additions & 2 deletions source/re/ng/scene.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dd8497a

Please sign in to comment.