5#include "imgui/imgui.h"
6#include "imgui_widgets/utils.h"
40 auto&
scene = ec.get_scene();
49 auto&
scene = ec.get_scene();
62 path.release_pipeline_resources(
scene);
66 if(m_skip_frames_ > 0)
74 is_visible_force_ =
false;
85 is_visible_force_ = visible;
97 if(m_skip_frames_ > 0)
99 auto spinner_size = ImGui::GetContentRegionAvail().y * 0.2f;
101 ImGui::SetCursorPosY(ImGui::GetContentRegionAvail().
y * 0.5f - spinner_size * 0.5f);
102 ImGui::AlignedItem(0.5f,
103 ImGui::GetContentRegionAvail().
x,
107 ImSpinner::Spinner<ImSpinner::SpinnerTypeT::e_st_eclipse>(
"spinner",
108 ImSpinner::Radius{spinner_size * 0.5f},
109 ImSpinner::Thickness{6.0f},
110 ImSpinner::Color{ImSpinner::white},
111 ImSpinner::Speed{6.0f});
131 auto size = ImGui::GetContentRegionAvail();
134 bool rendered =
false;
137 [&](
auto e,
auto&& camera_comp)
141 const auto&
camera = camera_comp.get_camera();
142 const auto& rview = camera_comp.get_render_view();
143 const auto& obuffer = rview.fbo_safe_get(
"OBUFFER");
147 auto tex = obuffer->get_texture(0);
148 auto tex_size = obuffer->get_size();
149 ImVec2 tex_size_v(tex_size.width, tex_size.height);
150 ImGui::ImageWithAspect(
ImGui::ToId(tex), tex_size_v,
size, ImVec2(0.5f, 0.5f));
152 ImVec2 min = ImGui::GetItemRectMin();
153 ImVec2 max = ImGui::GetItemRectMax();
158 work_zone.w = max.x - min.x;
159 work_zone.h = max.y - min.y;
167 ImVec2 padding(2.0f, 2.0f);
168 ImGui::RenderFocusFrame(ImGui::GetItemRectMin() - padding, ImGui::GetItemRectMax() + padding);
172 const auto& pipeline = camera_comp.get_pipeline_data().get_pipeline();
173 pipeline->set_debug_pass(visualize_passes_);
180 static const auto text =
"No cameras rendering";
181 ImGui::SetCursorPosY(
size.y * 0.5f);
182 ImGui::AlignedItem(0.5f,
184 ImGui::CalcTextSize(text).x,
187 ImGui::TextUnformatted(text);
203auto game_panel::begin_panel(
const char*
name, ImGuiWindowFlags flags) ->
bool
206 auto& play = ctx.get_cached<
play_mode>();
208 ImVec2 padding(is_playing ? 1.0f : 0.0f, is_playing ? 1.0f : 0.0f);
209 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, padding);
211 ImGui::PopStyleVar();
218 if(ImGui::BeginMenuBar())
220 ImGui::PushStyleColor(ImGuiCol_Header, ImGui::GetStyleColorVec4(ImGuiCol_TabSelected));
221 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::GetStyleColorVec4(ImGuiCol_TabSelected));
222 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImGui::GetStyleColorVec4(ImGuiCol_TabSelectedOverline));
227 auto& s = pm.get_settings();
228 int index = s.resolution.get_current_resolution_index();
231 s.resolution.set_current_resolution_index(
index);
232 pm.save_project_settings(ctx);
238 ImGui::RadioButton(
"Full", &visualize_passes_, -1);
239 ImGui::RadioButton(
"Base Color", &visualize_passes_, 0);
240 ImGui::RadioButton(
"Diffuse Color", &visualize_passes_, 1);
241 ImGui::RadioButton(
"Specular Color", &visualize_passes_, 2);
242 ImGui::RadioButton(
"Radiance", &visualize_passes_, 3);
243 ImGui::RadioButton(
"Irradiance", &visualize_passes_, 4);
244 ImGui::RadioButton(
"Ambient Occlusion", &visualize_passes_, 5);
245 ImGui::RadioButton(
"Normals (World Space)", &visualize_passes_, 6);
246 ImGui::RadioButton(
"Roughness", &visualize_passes_, 7);
247 ImGui::RadioButton(
"Metalness", &visualize_passes_, 8);
248 ImGui::RadioButton(
"Emissive Color", &visualize_passes_, 9);
249 ImGui::RadioButton(
"Subsurface Color", &visualize_passes_, 10);
250 ImGui::RadioButton(
"Depth", &visualize_passes_, 11);
251 ImGui::RadioButton(
"SSIL", &visualize_passes_, 12);
254 ImGui::SetItemTooltipEx(
"%s",
"Visualize Render Passes");
257 bool debugger_enabled = ui.is_debugger_enabled();
259 const char* debugger_preview = modes[int(!debugger_enabled)];
263 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
265 if(ImGui::MenuItem(debugger_preview,
"", debugger_enabled))
267 ui.set_debugger_enabled(!debugger_enabled);
271 ImGui::PopStyleColor();
273 ImGui::SetItemTooltipEx(
"%s", debugger_enabled ?
"Hide UI Debugger" :
"Show UI Debugger");
277 ImGui::PopStyleColor(3);
Class that contains core camera data, used for rendering and other purposes.
Class representing a camera. Contains functionality for manipulating and updating a camera....
void deinit(rtti::context &ctx)
void init(rtti::context &ctx)
void on_after_render(rtti::context &ctx) override
void on_frame_update(rtti::context &ctx, delta_t dt)
void draw_ui(rtti::context &ctx) override
void on_frame_render(rtti::context &ctx, delta_t dt)
void set_visible_force(bool visible)
game_panel(imgui_panels *parent, const char *name)
void on_frame_before_render(rtti::context &ctx, delta_t dt)
auto get_profiler_timeline_panel() -> profiler_timeline_panel &
virtual bool begin_panel(const char *name, ImGuiWindowFlags flags)
auto is_visible() const -> bool
auto is_focused() const -> bool
Base class for different rendering paths in the ACE framework.
void on_frame_update(scene &scn, delta_t dt)
Prepares the scene for rendering.
void on_frame_before_render(scene &scn, delta_t dt)
auto render_scene(scene &scn, delta_t dt) -> gfx::frame_buffer::ptr
Renders the scene and returns the frame buffer.
std::chrono::duration< float > delta_t
#define ICON_MDI_ARROW_DOWN_BOLD
#define ICON_MDI_BUG_CHECK
#define ICON_MDI_DRAWING_BOX
std::vector< size_t > parent_
ImTextureID ToId(gfx::texture_handle _handle, uint8_t _mip=0, uint8_t _flags=IMGUI_FLAGS_ALPHA_BLEND)
auto get_resolution(rtti::context &ctx, int index) -> const settings::resolution_settings::resolution *
Get the resolution preset at the given index (clamped against the configured presets)....
void apply_to_camera(camera_component &camera_comp, const settings::resolution_settings::resolution &res, ImVec2 avail_size)
Apply the resolution preset to the camera component using compute_viewport_size. Only viewport size i...
auto draw_menu(rtti::context &ctx, int ¤t_index) -> bool
Draw the resolution selection drop-down for the current menu bar. The selection is read and written t...
void draw(const rendering::pipeline_stats &pstats, state &overlay_state, const char *id)
Draw a statistics overlay child window at the top-right corner of the current ImGui window....
void draw_stats_toggle(state &overlay_state)
Draw a right-aligned "Stats" toggle button for the menu bar. Toggles the overlay visibility on click.
Manages the entity-component-system (ECS) operations for the ACE framework.
static auto context() -> rtti::context &
Owns play-mode state and orchestrates the splash -> running lifecycle.
auto is_active() const -> bool
void add_stats(const pipeline_stats &stats)
Represents a scene in the ACE framework, managing entities and their relationships.
static auto get_scene(entt::handle entity) -> scene *
Gets the scene from an entity handle.
bool open_profiler_requested