Unravel Engine C++ Reference
Loading...
Searching...
No Matches
scene_panel.h
Go to the documentation of this file.
1#pragma once
2#include "../entity_panel.h"
4#include <math/math.h>
5
7
8namespace unravel
9{
11
12{
13public:
15
16 void init(rtti::context& ctx);
17 void deinit(rtti::context& ctx);
18
22 void on_frame_ui_render(rtti::context& ctx, const char* name);
23
24 auto get_camera() -> entt::handle;
25 auto get_center() -> entt::handle;
26 void set_visible(bool visible);
27 auto is_focused() const -> bool;
28
29 auto get_auto_save_prefab() const -> bool;
30
31 // Drag selection methods
32 auto is_drag_selection_active() const -> bool { return is_drag_selecting_; }
33 auto get_drag_selection_rect() const -> ImRect { return ImRect(drag_start_pos_, drag_current_pos_); }
34 auto get_drag_selection_bounds() const -> std::pair<ImVec2, ImVec2>
35 {
36 return {
37 ImVec2(std::min(drag_start_pos_.x, drag_current_pos_.x), std::min(drag_start_pos_.y, drag_current_pos_.y)),
38 ImVec2(std::max(drag_start_pos_.x, drag_current_pos_.x), std::max(drag_start_pos_.y, drag_current_pos_.y))
39 };
40 }
41
42private:
43 void draw_scene(rtti::context& ctx, delta_t dt);
44
45 void draw_ui(rtti::context& ctx);
46 void draw_menubar(rtti::context& ctx);
47 void draw_selected_camera(rtti::context& ctx, entt::handle editor_camera, const ImVec2& size);
48
49 // Menu bar drawing functions
50 void draw_prefab_mode_header(rtti::context& ctx);
51 void draw_transform_tools(editing_manager& em);
52 void draw_gizmo_pivot_mode_menu(bool& gizmo_at_center);
53 void draw_coordinate_system_menu(editing_manager& em);
54 void draw_grid_settings_menu(editing_manager& em);
55 void draw_gizmos_settings_menu(editing_manager& em);
56 void draw_visualization_menu();
57 void draw_snapping_menu(editing_manager& em);
58 void draw_inverse_kinematics_menu(editing_manager& em);
59 void draw_camera_settings_menu(rtti::context& ctx);
60 void draw_framerate_display();
61
62
63 // Drag selection helper functions
64 void handle_drag_selection(rtti::context& ctx, const camera& camera, editing_manager& em);
65 void draw_drag_selection_rect(const ImVec2& start_pos, const ImVec2& current_pos);
66
67 // UI interaction functions
68 void handle_viewport_interaction(rtti::context& ctx, const camera& camera, editing_manager& em);
69 void handle_keyboard_shortcuts(editing_manager& em);
70 void setup_camera_viewport(camera_component& camera_comp, const ImVec2& size, const ImVec2& pos);
71 void draw_scene_viewport(rtti::context& ctx, const ImVec2& size);
72
73 // Handle prefab mode changes
74 void handle_prefab_mode_changes(rtti::context& ctx);
75
76 bool is_visible_{};
77 bool is_focused_{};
78 bool is_dragging_{};
79 int visualize_passes_{-1};
80 scene panel_scene_{"scene_panel"};
81
82 bool gizmo_at_center_{true};
83
84 float acceleration_{};
85 math::vec3 move_dir_{};
86
87 gizmos_renderer gizmos_{};
88
89 // Track prefab mode state
90 bool was_prefab_mode_{false};
91
92 // Auto-save prefabs when exiting prefab mode
93 bool auto_save_prefab_{true};
94
95 // Drag selection state
96 bool is_drag_selecting_{false};
97 ImVec2 drag_start_pos_{};
98 ImVec2 drag_current_pos_{};
99 bool was_using_gizmo_{false};
100};
101} // namespace unravel
Class that contains core camera data, used for rendering and other purposes.
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:35
auto is_focused() const -> bool
void on_frame_render(rtti::context &ctx, delta_t dt)
void on_frame_update(rtti::context &ctx, delta_t dt)
scene_panel(imgui_panels *parent)
void init(rtti::context &ctx)
auto get_auto_save_prefab() const -> bool
auto is_drag_selection_active() const -> bool
Definition scene_panel.h:32
void set_visible(bool visible)
auto get_drag_selection_bounds() const -> std::pair< ImVec2, ImVec2 >
Definition scene_panel.h:34
auto get_drag_selection_rect() const -> ImRect
Definition scene_panel.h:33
void on_frame_before_render(rtti::context &ctx, delta_t dt)
auto get_center() -> entt::handle
void deinit(rtti::context &ctx)
auto get_camera() -> entt::handle
std::chrono::duration< float > delta_t
std::string name
Definition hub.cpp:27