Skip to content

Commit f3e1b00

Browse files
committed
Minimize Gui interface; update docs
1 parent aa681ca commit f3e1b00

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

lib/engine/src/engine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ struct DearImGui : Gui {
129129
pool = init_imgui(info);
130130
}
131131

132-
void new_frame() final {
132+
void new_frame() {
133133
if (state == State::eEndFrame) { end_frame(); }
134134
ImGui_ImplVulkan_NewFrame();
135135
ImGui_ImplGlfw_NewFrame();
136136
ImGui::NewFrame();
137137
state = State::eEndFrame;
138138
}
139139

140-
void end_frame() final {
140+
void end_frame() {
141141
// ImGui::Render calls ImGui::EndFrame
142142
ImGui::Render();
143143
state = State::eNewFrame;
@@ -151,9 +151,9 @@ struct RenderWindow {
151151
Vulkan vulkan;
152152
Gfx gfx;
153153
Renderer renderer;
154-
std::unique_ptr<Gui> gui;
154+
std::unique_ptr<DearImGui> gui;
155155

156-
RenderWindow(UniqueWin window, std::unique_ptr<Gui> gui, std::uint8_t msaa, bool validation)
156+
RenderWindow(UniqueWin window, std::unique_ptr<DearImGui> gui, std::uint8_t msaa, bool validation)
157157
: window(std::move(window)), vulkan(GlfwWsi{this->window}, validation), gfx(vulkan.gfx()),
158158
renderer(gfx, this->window, gui.get(), Renderer::CreateInfo{command_buffers_v, msaa}), gui(std::move(gui)) {}
159159
};

lib/render/include/facade/render/gui.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include <facade/vk/gfx.hpp>
55

66
namespace facade {
7-
///
8-
/// \brief Creates a window and a renderer.
9-
///
7+
///
8+
/// \brief Abstract interface for GUI (concrete DearImGui authored and owned by Engine).
9+
///
1010
class Gui {
1111
public:
1212
struct InitInfo {
@@ -20,9 +20,6 @@ class Gui {
2020
virtual ~Gui() = default;
2121

2222
virtual void init(InitInfo const& info) = 0;
23-
24-
virtual void new_frame() = 0;
25-
virtual void end_frame() = 0;
2623
virtual void render(vk::CommandBuffer cb) = 0;
2724
};
2825
} // namespace facade

lib/render/include/facade/render/renderer.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
#include <memory>
99

1010
namespace facade {
11-
1211
///
13-
/// \brief Handles all information about the frame and what is happening.
12+
/// \brief Stores various frame statistics.
1413
///
1514
struct FrameStats {
16-
1715
///
1816
/// \brief Name of the GPU
1917
///
@@ -23,7 +21,7 @@ struct FrameStats {
2321
/// \brief Total frames so far
2422
///
2523
std::uint64_t frame_counter{};
26-
24+
2725
///
2826
/// \brief Triangles drawn in previous frame
2927
///
@@ -33,33 +31,33 @@ struct FrameStats {
3331
/// \brief Draw calls in previous frame
3432
///
3533
std::uint32_t draw_calls{};
36-
34+
3735
///
3836
/// \brief Framerate (until previous frame)
3937
///
4038
std::uint32_t fps{};
41-
39+
4240
///
4341
/// \brief Current present mode
4442
///
4543
vk::PresentModeKHR mode{};
46-
44+
4745
///
4846
/// \brief Multi-sampled anti-aliasing level
4947
///
5048
vk::SampleCountFlagBits msaa{};
5149
};
5250

5351
///
54-
/// \brief
52+
/// \brief Initialization data for constructing a Renderer.
5553
///
5654
struct RendererCreateInfo {
5755
std::size_t command_buffers{1};
5856
std::uint8_t desired_msaa{1};
5957
};
6058

6159
///
62-
/// \brief Creates a window and a renderer.
60+
/// \brief Owns a Vulkan Swapchain and RenderPass, a Shader::Db and Pipes instance each, and renders to the Window passed in constructor.
6361
///
6462
class Renderer {
6563
public:

lib/scene/include/facade/scene/camera.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ struct ViewPlane {
1212
float far{};
1313
};
1414

15-
////////////////////////////////////////////////////////////
16-
/// \brief A camera inside of a 3d plane
1715
///
18-
////////////////////////////////////////////////////////////
16+
/// \brief Models a 3D camera with either perspective or orthographic projection parameters.
17+
///
18+
/// The view matrix is modelled through a Transform that's passed in as a parameter.
19+
///
1920
struct Camera {
2021
struct Perspective {
2122
ViewPlane view_plane{1.0f, 1000.0f};

lib/scene/include/facade/scene/id.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
#pragma once
2+
#include <concepts>
23
#include <cstdint>
34

45
namespace facade {
5-
////////////////////////////////////////////////////////////
6-
/// \brief A ID assigned to items inside of the GLTF viewer.
76
///
8-
////////////////////////////////////////////////////////////
9-
template <typename T>
7+
/// \brief Represents a strongly-typed integral ID.
8+
///
9+
/// Primarily used for items owned by a Scene.
10+
///
11+
template <typename Type, std::integral Value = std::size_t>
1012
class Id {
1113
public:
12-
using id_type = std::size_t;
14+
using id_type = Value;
1315

14-
////////////////////////////////////////////////////////////
15-
/// \brief ADD MORE INFO.
1616
///
17-
/// \param value ADD MORE INFO.
17+
/// \brief Implicit constructor
18+
/// \param value The underlying value of this instance
1819
///
19-
////////////////////////////////////////////////////////////
20-
constexpr Id(std::size_t value = {}) : m_value(value) {}
20+
constexpr Id(Value value = {}) : m_value(value) {}
2121

22-
constexpr std::size_t value() const { return m_value; }
23-
constexpr operator std::size_t() const { return value(); }
22+
constexpr Value value() const { return m_value; }
23+
constexpr operator Value() const { return value(); }
2424

2525
bool operator==(Id const&) const = default;
2626

2727
private:
28-
std::size_t m_value{};
28+
Value m_value{};
2929
};
3030
} // namespace facade

0 commit comments

Comments
 (0)