[nostalgia/scene/studio] Cleanup
This commit is contained in:
parent
79e6838ab3
commit
220f272867
@ -14,11 +14,7 @@ ox::Vector<studio::EditorMaker> StudioModule::editors(core::Context *ctx) noexce
|
|||||||
{
|
{
|
||||||
{"nscn"},
|
{"nscn"},
|
||||||
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
||||||
try {
|
return ox::makeCatch<SceneEditorImGui>(ctx, path);
|
||||||
return ox::make<SceneEditorImGui>(ctx, path);
|
|
||||||
} catch (const ox::Exception &ex) {
|
|
||||||
return ex.toError();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
|
||||||
#include <keel/media.hpp>
|
#include <keel/media.hpp>
|
||||||
#include <ox/std/memory.hpp>
|
|
||||||
|
#include <nostalgia/core/gfx.hpp>
|
||||||
|
|
||||||
#include "sceneeditor-imgui.hpp"
|
#include "sceneeditor-imgui.hpp"
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ void SceneEditorImGui::draw(core::Context*) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorImGui::onActivated() noexcept {
|
void SceneEditorImGui::onActivated() noexcept {
|
||||||
m_view.setupScene();
|
oxLogError(m_view.setupScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error SceneEditorImGui::saveItem() noexcept {
|
ox::Error SceneEditorImGui::saveItem() noexcept {
|
||||||
|
@ -2,31 +2,29 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <nostalgia/core/gfx.hpp>
|
||||||
|
|
||||||
#include "sceneeditorview.hpp"
|
#include "sceneeditorview.hpp"
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
|
||||||
SceneEditorView::SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept:
|
SceneEditorView::SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept:
|
||||||
m_ctx(*ctx),
|
m_ctx(ctx),
|
||||||
m_sceneStatic(sceneStatic),
|
m_sceneStatic(sceneStatic),
|
||||||
m_scene(m_sceneStatic) {
|
m_scene(m_sceneStatic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorView::setupScene() noexcept {
|
ox::Error SceneEditorView::setupScene() noexcept {
|
||||||
oxIgnoreError(m_scene.setupDisplay(&m_ctx));
|
return m_scene.setupDisplay(m_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorView::draw(int width, int height) noexcept {
|
void SceneEditorView::draw(int width, int height) noexcept {
|
||||||
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
||||||
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
|
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
|
||||||
core::gl::setRenderSize(&m_ctx, width, height);
|
|
||||||
oxIgnoreError(m_scene.setupDisplay(&m_ctx));
|
|
||||||
}
|
}
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer);
|
glutils::bind(m_frameBuffer);
|
||||||
glViewport(0, 0, m_frameBuffer.width, m_frameBuffer.height);
|
core::gl::setRenderSize(m_ctx, width, height);
|
||||||
// draw begin
|
core::gl::drawMainView(m_ctx);
|
||||||
core::gl::drawMainView(&m_ctx);
|
|
||||||
// draw end
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace nostalgia::scene {
|
|||||||
class SceneEditorView {
|
class SceneEditorView {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
core::Context &m_ctx;
|
core::Context *const m_ctx = nullptr;
|
||||||
const SceneStatic &m_sceneStatic;
|
const SceneStatic &m_sceneStatic;
|
||||||
Scene m_scene;
|
Scene m_scene;
|
||||||
glutils::FrameBuffer m_frameBuffer;
|
glutils::FrameBuffer m_frameBuffer;
|
||||||
@ -21,7 +21,7 @@ class SceneEditorView {
|
|||||||
public:
|
public:
|
||||||
SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept;
|
SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept;
|
||||||
|
|
||||||
void setupScene() noexcept;
|
ox::Error setupScene() noexcept;
|
||||||
|
|
||||||
void draw(int width, int height) noexcept;
|
void draw(int width, int height) noexcept;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user