[nostalgia/scene/studio] Simplify check for framebuffer resizing

This commit is contained in:
Gary Talent 2023-12-09 23:53:34 -06:00
parent 4a9f035014
commit e923c73c91
2 changed files with 4 additions and 3 deletions

View File

@ -21,9 +21,8 @@ ox::Error SceneEditorView::setupScene() noexcept {
void SceneEditorView::draw(ox::Size const&targetSz) noexcept {
auto const scaleSz = targetSz / core::gl::drawSize(1);
auto const scale = ox::max(1, ox::max(scaleSz.width, scaleSz.height));
if (m_scale != scale) {
m_scale = scale;
if (m_scaleSz != scaleSz) [[unlikely]] {
m_scale = ox::max(1, ox::max(scaleSz.width, scaleSz.height));
glutils::resizeInitFrameBuffer(m_frameBuffer, core::gl::drawSize(m_scale));
}
glutils::FrameBufferBind const frameBufferBind(m_frameBuffer);

View File

@ -7,6 +7,7 @@
#include <glutils/glutils.hpp>
#include <nostalgia/core/context.hpp>
#include <nostalgia/core/gfx.hpp>
#include <nostalgia/scene/scene.hpp>
namespace nostalgia::scene {
@ -19,6 +20,7 @@ class SceneEditorView {
Scene m_scene;
glutils::FrameBuffer m_frameBuffer;
int m_scale = 1;
ox::Size m_scaleSz = core::gl::drawSize(m_scale);
public:
SceneEditorView(turbine::Context &ctx, SceneStatic const&sceneStatic);