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