wren
Vulkan-based game engine
Loading...
Searching...
No Matches
editor.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <imgui.h>
4#include <imgui_impl_vulkan.h>
5#include <imgui_internal.h>
6
7#include <filesystem>
8#include <memory>
9#include <tracy/Tracy.hpp>
10#include <vulkan/vulkan.hpp>
11#include <wren/application.hpp>
12#include <wren/math/vector.hpp>
13#include <wren/mesh.hpp>
16#include <wren/scene/scene.hpp>
18#include <wren/utils/result.hpp>
19
20#include "camera.hpp"
21#include "context.hpp"
22#include "ui.hpp"
23
24namespace editor {
25
26class Editor {
27 public:
28 static auto create(const std::shared_ptr<wren::Application> &app,
29 const std::filesystem::path &project_path)
31
32 Editor(const std::shared_ptr<wren::Context> &ctx);
33
34 void on_update();
35
36 private:
38
39 auto build_render_graph(const std::shared_ptr<wren::Context> &ctx)
41
42 // Project
44
45 // Editor camera
47
48 // Panels
49 std::optional<flecs::entity> selected_entity_;
50
51 // Scene management
52 std::shared_ptr<wren::scene::Scene> scene_;
53
54 std::shared_ptr<wren::Context> wren_ctx_;
55
56 std::shared_ptr<wren::vk::Shader> mesh_shader_;
57 std::shared_ptr<wren::vk::Shader> viewer_shader_;
58
59 // Scene viewer
60 std::vector<VkDescriptorSet> dset_{};
61 vk::Sampler texture_sampler_;
62
63 std::optional<wren::math::Vec2f> scene_resized_;
65};
66
67} // namespace editor
Definition camera.hpp:9
Definition editor.hpp:26
Editor(const std::shared_ptr< wren::Context > &ctx)
Definition editor.cpp:73
std::shared_ptr< wren::Context > wren_ctx_
Definition editor.hpp:54
std::shared_ptr< wren::vk::Shader > viewer_shader_
Definition editor.hpp:57
auto load_scene() -> wren::expected< void >
Definition editor.cpp:198
wren::math::Vec2f last_scene_size_
Definition editor.hpp:64
std::shared_ptr< wren::vk::Shader > mesh_shader_
Definition editor.hpp:56
void on_update()
Definition editor.cpp:78
vk::Sampler texture_sampler_
Definition editor.hpp:61
Camera camera_
Definition editor.hpp:46
Context editor_context_
Definition editor.hpp:43
static auto create(const std::shared_ptr< wren::Application > &app, const std::filesystem::path &project_path) -> wren::expected< std::shared_ptr< Editor > >
Definition editor.cpp:11
std::optional< wren::math::Vec2f > scene_resized_
Definition editor.hpp:63
std::vector< VkDescriptorSet > dset_
Definition editor.hpp:60
std::shared_ptr< wren::scene::Scene > scene_
Definition editor.hpp:52
auto build_render_graph(const std::shared_ptr< wren::Context > &ctx) -> wren::expected< wren::GraphBuilder >
Definition editor.cpp:210
std::optional< flecs::entity > selected_entity_
Definition editor.hpp:49
Definition camera.hpp:8
std::expected< T, Err > expected
Definition result.hpp:49
Definition context.hpp:8
Definition vector.hpp:124