From 0cfc409afecc5397e43ed22cf8bcd4acf1dedbbf Mon Sep 17 00:00:00 2001 From: eduardodoria Date: Sat, 21 Sep 2024 20:33:38 -0300 Subject: [PATCH] Added startFrameBuffer with width and height --- engine/core/render/CameraRender.cpp | 4 ++++ engine/core/render/CameraRender.h | 1 + engine/renders/sokol/SokolCamera.cpp | 12 ++++++++---- engine/renders/sokol/SokolCamera.h | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engine/core/render/CameraRender.cpp b/engine/core/render/CameraRender.cpp index e40c558c..03156918 100644 --- a/engine/core/render/CameraRender.cpp +++ b/engine/core/render/CameraRender.cpp @@ -27,6 +27,10 @@ void CameraRender::startFrameBuffer(FramebufferRender* framebuffer, size_t face) backend.startFrameBuffer(framebuffer, face); } +void CameraRender::startFrameBuffer(int width, int height){ + backend.startFrameBuffer(width, height); +} + void CameraRender::startFrameBuffer(){ backend.startFrameBuffer(); } diff --git a/engine/core/render/CameraRender.h b/engine/core/render/CameraRender.h index 15115643..f716baa2 100644 --- a/engine/core/render/CameraRender.h +++ b/engine/core/render/CameraRender.h @@ -23,6 +23,7 @@ namespace Supernova{ void setClearColor(Vector4 clearColor); void startFrameBuffer(FramebufferRender* framebuffer, size_t face = 0); + void startFrameBuffer(int width, int height); void startFrameBuffer(); void applyViewport(Rect rect); diff --git a/engine/renders/sokol/SokolCamera.cpp b/engine/renders/sokol/SokolCamera.cpp index 7044a558..246658d3 100644 --- a/engine/renders/sokol/SokolCamera.cpp +++ b/engine/renders/sokol/SokolCamera.cpp @@ -33,16 +33,20 @@ void SokolCamera::setClearColor(Vector4 clearColor){ } void SokolCamera::startFrameBuffer(FramebufferRender* framebuffer, size_t face){ - //sg_pass pass = {0}; - //pass.action = pass_action; pass.attachments = framebuffer->backend.get(face); //SokolCmdQueue::add_command_begin_pass(pass); sg_begin_pass(pass); } +void SokolCamera::startFrameBuffer(int width, int height){ + pass.swapchain = System::instance().getSokolSwapchain(); + pass.swapchain.width = width; + pass.swapchain.height = height; + //SokolCmdQueue::add_command_begin_pass(pass); + sg_begin_pass(pass); +} + void SokolCamera::startFrameBuffer(){ - //sg_pass pass = {0}; - //pass.action = pass_action; pass.swapchain = System::instance().getSokolSwapchain(); //SokolCmdQueue::add_command_begin_pass(pass); sg_begin_pass(pass); diff --git a/engine/renders/sokol/SokolCamera.h b/engine/renders/sokol/SokolCamera.h index 4e5b3534..7a7475c9 100644 --- a/engine/renders/sokol/SokolCamera.h +++ b/engine/renders/sokol/SokolCamera.h @@ -26,6 +26,7 @@ namespace Supernova{ void setClearColor(Vector4 clearColor); void startFrameBuffer(FramebufferRender* framebuffer, size_t face); + void startFrameBuffer(int width, int height); void startFrameBuffer(); void applyViewport(Rect rect);