Skip to content

WIP: Editor and Scene refactor#26

Merged
sheazywi merged 20 commits intodevfrom
copilot/phase-1-hazel-editor-setup
Apr 21, 2026
Merged

WIP: Editor and Scene refactor#26
sheazywi merged 20 commits intodevfrom
copilot/phase-1-hazel-editor-setup

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 11, 2026

  • Inspect current editor implementation for viewport rendering, gizmos, camera controls, overlays, and panels
  • Run baseline build before edits (blocked in sandbox: missing premake5 and Vulkan SDK path)
  • Add viewport-focused floating overlay UI (gizmo toolbar, central play/sim controls, viewport settings gear popup)
  • Add viewport settings state (snap controls, display options, bounding box/icon toggles) and wire into existing gizmo/render options
  • Implement editor mouse picking raycast from viewport mouse position to static meshes/colliders and update hovered/selected entity flow
  • Add 2D billboard entity icons and selected mesh AABB debug rendering overlays
  • Ensure camera interaction is gated to viewport hover/focus and viewport resize updates remain correct
  • Re-run available validation commands and summarize environment blockers (Linux build still blocked by missing premake5/Vulkan SDK path)
  • Address code-review feedback for picking ray normalization guards
Original prompt

Execute Phase 1 of the Hazel Editor plan for LuxEngine. Establish the Hazel visual language, fonts, and ImGui configuration.

Please implement the following:

  1. ImGui Configuration: Ensure the ImGui setup has the Docking branch enabled and ImGuiConfigFlags_DockingEnable and ImGuiConfigFlags_ViewportsEnable active.
  2. Fonts & Icons: Implement a UI font system (e.g., loading Regular, Bold, and Large fonts). Load icons as Texture2D resources (Play, Stop, Pause, Translate, Rotate, Scale, Gears, File/Folder icons).
  3. Theme Colors: Create a Colors::Theme namespace/struct mapping exactly to Hazel's dark theme (e.g., titlebar, titlebarGreen, backgroundDark, text, muted, accent).
  4. UI Utility Wrapping: Replicate the UI:: namespace helpers (e.g., UI::ScopedStyle, UI::ScopedColour, UI::ShiftCursorY, UI::DrawButtonImage) used heavily throughout Hazel.

Look at the relevant ImGui setup files, editor layer, and UI utility files to implement these foundational features.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Could you make a plan for the Copilot agent, to make my LuxEngine's Editor exactly looking like and feeling like the Hazel Editor's

Assistant: Here is a comprehensive, step-by-step plan for the GitHub Copilot coding agent to transform LuxEngine's editor into a Hazel-style Editor. This plan breaks down the massive EditorLayer.cpp and EditorLayer.h implementation into manageable, sequential phases that an AI agent can implement via separate Pull Requests (PRs).

Phase 1: Foundational UI & Theming Setup

Goal: Establish the Hazel visual language, fonts, and ImGui configuration.

  1. ImGui Configuration: Ensure the ImGui setup has the Docking branch enabled and ImGuiConfigFlags_DockingEnable and ImGuiConfigFlags_ViewportsEnable active.
  2. Fonts & Icons: Implement a UI font system (e.g., loading Regular, Bold, and Large fonts). Load icons as Texture2D resources (Play, Stop, Pause, Translate, Rotate, Scale, Gears, File/Folder icons).
  3. Theme Colors: Create a Colors::Theme namespace/struct mapping exactly to Hazel's dark theme (e.g., titlebar, titlebarGreen, backgroundDark, text, muted, accent).
  4. UI Utility Wrapping: Replicate the UI:: namespace helpers (e.g., UI::ScopedStyle, UI::ScopedColour, UI::ShiftCursorY, UI::DrawButtonImage) used heavily throughout Hazel.

Phase 2: Custom Titlebar & Frameless Window

Goal: Remove the OS window borders and implement the custom draggable Hazel titlebar.

  1. Window Modification: Modify LuxEngine's application window creation (GLFW/Win32) to remove standard decorations (titlebar and borders).
  2. Main Dockspace: Implement the fullscreen dockspace in OnImGuiRender with zero padding and no background.
  3. Titlebar Implementation: Port UI_DrawTitlebar(). Include the engine logo, project name, current scene name, and right-aligned custom Window control buttons (Minimize, Maximize, Close).
  4. Menubar Integration: Port UI_DrawMenubar() to embed the File, Edit, View, Tools, and Help menus directly into the custom titlebar.

Phase 3: The Viewport & Render Targets

Goal: Set up the main central viewport where the game scene is rendered.

  1. Framebuffer Rendering: Ensure LuxEngine's renderer outputs to a Framebuffer, and expose the color attachment to ImGui via ImGui::Image.
  2. Viewport Panel: Create the "Viewport" window. Calculate its bounds (m_ViewportBounds) to allow for accurate mouse picking and raycasting.
  3. Camera Controllers: Implement or adapt the EditorCamera to handle Maya-style panning, zooming, and orbiting when the viewport is hovered/focused.
  4. Resize Handling: Send resize events to the Framebuffer and EditorCamera when the ImGui Viewport panel size changes.

Phase 4: Overlaid Toolbars (Floating UI)

Goal: Add the floating transparent toolbars inside the viewport.

  1. Gizmos Toolbar: Port UI_GizmosToolbar(). Render a small borderless window in the top-left of the viewport containing Select, Translate, Rotate, and Scale icons.
  2. Central Toolbar: Port UI_CentralToolbar(). Render a centered overlay at the top of the viewport containing Play, Simulate, and Stop buttons to toggle the SceneState.
  3. Viewport Settings: Port UI_ViewportSettings(). Add the gear icon overlay in the top-right that opens a popup for grid snapping, bounding box rendering, and display modes.

Phase 5: ImGuizmo & Scene Interaction

Goal: Enable visual scene manipulation.

  1. ImGuizmo Setup: Integrate ImGuizmo::BeginFrame(), ImGuizmo::SetOrthographic(false), and ImGuizmo::SetRect() tied to the Viewport bounds.
  2. Transform Manipulation: Port UI_DrawGizmos(). Fetch the selected entity's transform, pass it to ImGuizmo::Manipulate, and decompose the resulting matrix back into the entity's Local Translation, Rotation, and Scale.
  3. Mouse Picking: Port the raycasting logic (`C...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Execute Phase 1 of Hazel Editor plan for LuxEngine Phase 1: Establish Hazel-style UI:: namespace helpers Apr 11, 2026
Copilot AI requested a review from sheazywi April 11, 2026 06:26
Copilot AI and others added 9 commits April 12, 2026 01:30
…up' into copilot/refactor-scene-system-entity-hierarchy
Copilot AI and others added 2 commits April 18, 2026 17:37
@sheazywi sheazywi changed the title Phase 1: Establish Hazel-style UI:: namespace helpers WIP: Editor and Scene refactor Apr 21, 2026
@sheazywi sheazywi marked this pull request as ready for review April 21, 2026 02:54
Copilot AI review requested due to automatic review settings April 21, 2026 02:54
@sheazywi sheazywi merged commit f689197 into dev Apr 21, 2026
2 of 5 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a broad editor + scene architecture refactor aimed at moving LuxEngine’s editor toward a Hazel-style workflow (custom titlebar/dockspace, viewport overlay toolbars, hierarchy parenting, picking, and updated rendering/logging plumbing).

Changes:

  • Add entity hierarchy (RelationshipComponent), world-space transform support, and prefab instantiation/serialization.
  • Refactor editor UI to use a custom titlebar + viewport overlay toolbars/settings and add mouse-picking + debug overlays (AABB/icons).
  • Replace the old ConsolePanel with an EditorConsolePanel + spdlog sink integration and adjust renderer/shader/pipeline wiring.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
Editor/Source/Panels/SceneHierarchyPanel.cpp Adds hierarchy-aware tree rendering + drag/drop parenting and prefab dropping.
Editor/Source/Panels/ConsolePanel.h Removes legacy console panel (replaced by EditorConsolePanel).
Editor/Source/Panels/ConsolePanel.cpp Removes legacy console panel implementation.
Editor/Source/EditorLayer.h Adds titlebar/viewport UI APIs, picking helpers, viewport settings state, and EditorConsolePanel reference.
Editor/Source/EditorLayer.cpp Implements custom titlebar/menubar, viewport overlays, mouse picking, and selection/overlay rendering updates.
Editor/SandboxProject/Assets/Scenes/Physics2D.luxscene Updates sample scene with RelationshipComponent data and transform tweaks.
Editor/Resources/Shaders/LuxPBR_Transparent.glsl Introduces Lux transparent PBR shader variant for the scene renderer.
Editor/Resources/Shaders/LuxPBR_Static.glsl Introduces Lux static PBR shader variant for the scene renderer.
Core/Source/Lux/UI/UI.h Removes legacy UI scoped color helper header.
Core/Source/Lux/Scene/SceneSerializer.cpp Serializes/deserializes RelationshipComponent + new mesh/prefab components; defers parent linking.
Core/Source/Lux/Scene/Scene.h Adds prefab APIs, const GetEntityByUUID, world transform helper, and const entity views.
Core/Source/Lux/Scene/Scene.cpp Adds RelationshipComponent on entity creation, prefab instantiation, world-space transforms, and hierarchy-aware usage in multiple systems.
Core/Source/Lux/Scene/Prefab.h Adds Prefab asset type definition.
Core/Source/Lux/Scene/Prefab.cpp Implements prefab creation by cloning an entity hierarchy.
Core/Source/Lux/Scene/Entity.h Adds parenting API surface (GetParent/SetParent/Children/HasParent) and GetScene accessor.
Core/Source/Lux/Scene/Entity.cpp Implements parenting logic, including cycle prevention and child list maintenance.
Core/Source/Lux/Scene/Components.h Adds RelationshipComponent and new mesh/prefab-related components; updates AllComponents list.
Core/Source/Lux/Renderer/SceneRenderer.h Adds storage buffers for visible light index lists.
Core/Source/Lux/Renderer/SceneRenderer.cpp Wires new light buffers/uniforms into geometry passes and binds spot shadow texture placeholder.
Core/Source/Lux/Renderer/Renderer2D.h Adds circle render pass handle for framebuffer retargeting.
Core/Source/Lux/Renderer/Renderer2D.cpp Refactors circle rendering to use a RenderPass and supports retargeting circle pass to a framebuffer.
Core/Source/Lux/ImGui/ImGuiLayer.cpp Tweaks cursor handling and style/theme parameters.
Core/Source/Lux/ImGui/ImGuiEx.h Includes Prefab and removes remaining UI::-qualified calls in some helpers.
Core/Source/Lux/Editor/EditorConsolePanel.h Adds Hazel-style editor log panel API.
Core/Source/Lux/Editor/EditorConsolePanel.cpp Implements log panel UI, filtering, details popup, and message ingestion.
Core/Source/Lux/Editor/EditorConsole/EditorConsoleSink.h Adds spdlog sink to push messages into the editor console panel.
Core/Source/Lux/Editor/EditorConsole/ConsoleMessage.h Adds console message model + flags.
Core/Source/Lux/Core/Window.cpp Simplifies undecorated window hinting for custom titlebar support.
Core/Source/Lux/Core/Log.h Removes legacy callback-based console plumbing and adjusts log formatting usage.
Core/Source/Lux/Core/Log.cpp Enables editor console logger construction and includes the editor sink header.
Core/Source/Lux/Core/Events/SceneEvents.h Adds new scene lifecycle/selection event types (currently not wired).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for (auto entityID : view)
{
auto& transform = view.template get<TransformComponent>(entityID);
m_Renderer2D->DrawQuadBillboard(transform.Translation, glm::vec2(0.35f), iconTexture, 1.0f, glm::vec4(1.0f));
Comment on lines +1209 to +1210
const TransformComponent& transform = selectedEntity.GetComponent<TransformComponent>();
const glm::mat4 worldTransform = transform.GetTransform();
Comment on lines 134 to +136
auto& tag = entity.GetComponent<TagComponent>().Tag;
const auto& relationship = entity.GetComponent<RelationshipComponent>();
const bool hasChildren = !relationship.Children.empty();
void ImGuiLayer::Begin()
{
ImGui::SetMouseCursor(Input::GetCursorMode() == CursorMode::Normal ? ImGui::GetMouseCursor() : ImGuiMouseCursor_None);
ImGui::SetMouseCursor(Input::GetCursorMode() == CursorMode::Normal ? ImGuiMouseCursor_Arrow : ImGuiMouseCursor_None);
Comment on lines +47 to +48
for (const auto& message : m_MessageBuffer)
EditorConsolePanel::PushMessage(message);
Comment on lines +243 to +255
void EditorConsolePanel::PushMessage(const ConsoleMessage& message)
{
if (s_Instance == nullptr)
return;

{
std::scoped_lock<std::mutex> lock(s_Instance->m_MessageBufferMutex);
s_Instance->m_MessageBuffer.push_back(message);
}

if (s_Instance->m_EnableScrollToLatest)
s_Instance->m_ScrollToLatest = true;
}
Comment on lines +185 to +186

color = vec4(m_Params.Albedo, u_MaterialUniforms.Transparency);
Comment on lines +1037 to +1038
const TransformComponent& transformComponent = entity.GetComponent<TransformComponent>();
const glm::mat4 worldTransform = transformComponent.GetTransform();
Comment on lines +1043 to +1055
const glm::mat4 inverseTransform = glm::inverse(worldTransform * localTransform);
const glm::vec3 localOrigin = glm::vec3(inverseTransform * glm::vec4(rayOrigin, 1.0f));
const glm::vec3 localDirectionVector = glm::vec3(inverseTransform * glm::vec4(rayDirection, 0.0f));
if (glm::dot(localDirectionVector, localDirectionVector) <= std::numeric_limits<float>::epsilon())
return;
const glm::vec3 localDirection = glm::normalize(localDirectionVector);

Ray localRay(localOrigin, localDirection);
float t = 0.0f;
if (localRay.IntersectsAABB(localAABB, t) && t >= 0.0f && t < outDistance)
{
outDistance = t;
hit = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants