Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
19fc391
Initial plan
Copilot Apr 11, 2026
8aa2231
Phase 1: Expand UI:: namespace with Hazel-style helpers and fix ImGui…
Copilot Apr 11, 2026
4ce4c3f
Phase 2: add custom titlebar, frameless dockspace styling, and window…
Copilot Apr 11, 2026
036b2ef
Phase 1: add entity relationship and world transform foundation
Copilot Apr 12, 2026
4ae4133
Phase 1: address review nits and finalize hierarchy foundation
Copilot Apr 12, 2026
9259b45
Phase 2: add Mesh, MeshTag, and Prefab components
Copilot Apr 12, 2026
214042f
Phase 3: add Prefab asset creation and scene instantiation
Copilot Apr 12, 2026
b4fd07e
Phase 4: serialize hierarchy and new prefab/mesh components
Copilot Apr 12, 2026
26f2fb0
Phase 5: hierarchy tree reparenting and prefab drag-drop instantiation
Copilot Apr 12, 2026
88fd024
WIP: made the editor abit more likeable
sheazywi Apr 14, 2026
e686d57
Merge remote-tracking branch 'origin/copilot/phase-1-hazel-editor-set…
sheazywi Apr 14, 2026
d03b17b
WIP: aded Lux Shaders, not compiles them
sheazywi Apr 16, 2026
e89d7ac
Phase 3-7: add viewport overlays, picking raycast, and debug icon/bou…
Copilot Apr 18, 2026
c129f73
Fix ray normalization checks in viewport picking
Copilot Apr 18, 2026
d79e3ab
WIP: fix weird scene camera view, and error since i remove UI.h
sheazywi Apr 18, 2026
1006427
WIP: for some reason UI.h keeps coming back, update drawimage from im…
sheazywi Apr 18, 2026
d2537ef
Merge branch 'copilot/refactor-scene-system-entity-hierarchy' into co…
sheazywi Apr 18, 2026
ec6b614
WIP: new icon for github page
sheazywi Apr 18, 2026
44795e5
WIP: new console panel
sheazywi Apr 21, 2026
86d058e
WIP: trying to fix scene rendering problems, and editor
sheazywi Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions Core/Source/Lux/Core/Events/SceneEvents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#pragma once

#include "Event.h"
#include "Lux/Scene/Scene.h"
#include "Lux/Editor/SelectionManager.h"

#include <sstream>

namespace Lux {

class SceneEvent : public Event
{
public:
const Ref<Scene>& GetScene() const { return m_Scene; }
Ref<Scene> GetScene() { return m_Scene; }

EVENT_CLASS_CATEGORY(EventCategoryApplication | EventCategoryScene)
protected:
SceneEvent(const Ref<Scene>& scene)
: m_Scene(scene) {
}

Ref<Scene> m_Scene;
};

class ScenePreStartEvent : public SceneEvent
{
public:
ScenePreStartEvent(const Ref<Scene>& scene)
: SceneEvent(scene) {
}

std::string ToString() const override
{
std::stringstream ss;
ss << "ScenePreStartEvent: " << m_Scene->GetName();
return ss.str();
}

EVENT_CLASS_TYPE(ScenePreStart)
};

class ScenePostStartEvent : public SceneEvent
{
public:
ScenePostStartEvent(const Ref<Scene>& scene)
: SceneEvent(scene) {
}

std::string ToString() const override
{
std::stringstream ss;
ss << "ScenePostStartEvent: " << m_Scene->GetName();
return ss.str();
}

EVENT_CLASS_TYPE(ScenePostStart)
};

class ScenePreStopEvent : public SceneEvent
{
public:
ScenePreStopEvent(const Ref<Scene>& scene)
: SceneEvent(scene) {
}

std::string ToString() const override
{
std::stringstream ss;
ss << "ScenePreStopEvent: " << m_Scene->GetName();
return ss.str();
}

EVENT_CLASS_TYPE(ScenePreStop)
};

class ScenePostStopEvent : public SceneEvent
{
public:
ScenePostStopEvent(const Ref<Scene>& scene)
: SceneEvent(scene) {
}

std::string ToString() const override
{
std::stringstream ss;
ss << "ScenePostStopEvent: " << m_Scene->GetName();
return ss.str();
}

EVENT_CLASS_TYPE(ScenePostStop)
};

// TODO(Peter): Probably move this somewhere else...
class SelectionChangedEvent : public Event
{
public:
SelectionChangedEvent(SelectionContext contextID, UUID selectionID, bool selected)
: m_Context(contextID), m_SelectionID(selectionID), m_Selected(selected)
{
}

SelectionContext GetContextID() const { return m_Context; }
UUID GetSelectionID() const { return m_SelectionID; }
bool IsSelected() const { return m_Selected; }

std::string ToString() const override
{
std::stringstream ss;
ss << "EntitySelectionChangedEvent: Context(" << (int32_t)m_Context << "), Selection(" << m_SelectionID << "), " << m_Selected;
return ss.str();
}

EVENT_CLASS_CATEGORY(EventCategoryScene)
EVENT_CLASS_TYPE(SelectionChanged)
private:
SelectionContext m_Context;
UUID m_SelectionID;
bool m_Selected;
};

}
16 changes: 8 additions & 8 deletions Core/Source/Lux/Core/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/sinks/basic_file_sink.h"
//#include "Lux/Editor/EditorConsole/EditorConsoleSink.h"
#include "Lux/Editor/EditorConsole/EditorConsoleSink.h"

#include <filesystem>

Expand Down Expand Up @@ -58,34 +58,34 @@ namespace Lux {
std::make_shared<spdlog::sinks::stdout_color_sink_mt>()
#endif
};
/*

std::vector<spdlog::sink_ptr> editorConsoleSinks =
{
std::make_shared<spdlog::sinks::basic_file_sink_mt>("logs/APP.log", true),
#if LUX_HAS_CONSOLE
std::make_shared<EditorConsoleSink>(1),
//std::make_shared<EditorConsoleSink>(1),
std::make_shared<spdlog::sinks::stdout_color_sink_mt>()
#endif
};*/
};

luxSinks[0]->set_pattern("[%T] [%l] %n: %v");
appSinks[0]->set_pattern("[%T] [%l] %n: %v");
/*

#if LUX_HAS_CONSOLE
luxSinks[1]->set_pattern("%^[%T] %n: %v%$");
appSinks[1]->set_pattern("%^[%T] %n: %v%$");
for (auto sink : editorConsoleSinks)
sink->set_pattern("%^%v%$");
#endif*/
#endif

s_CoreLogger = std::make_shared<spdlog::logger>("LUX", luxSinks.begin(), luxSinks.end());
s_CoreLogger->set_level(spdlog::level::trace);

s_ClientLogger = std::make_shared<spdlog::logger>("APP", appSinks.begin(), appSinks.end());
s_ClientLogger->set_level(spdlog::level::trace);
/*

s_EditorConsoleLogger = std::make_shared<spdlog::logger>("Console", editorConsoleSinks.begin(), editorConsoleSinks.end());
s_EditorConsoleLogger->set_level(spdlog::level::trace);*/
s_EditorConsoleLogger->set_level(spdlog::level::trace);

SetDefaultTagSettings();
}
Expand Down
136 changes: 48 additions & 88 deletions Core/Source/Lux/Core/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,17 @@
#include <string>
#include <string_view>
#include <utility>
#include <functional>

// LUX_DIST may not be defined in Debug/Release builds
#ifndef LUX_DIST
#define LUX_DIST 0
#endif

#define LUX_ASSERT_MESSAGE_BOX (!LUX_DIST && LUX_PLATFORM_WINDOWS && false)

#if LUX_ASSERT_MESSAGE_BOX
#ifdef LUX_PLATFORM_WINDOWS
#include <Windows.h>
#endif
#ifdef LUX_PLATFORM_WINDOWS
#include <Windows.h>
#endif
#endif

namespace Lux {

// Callback function type for console message logging
// Parameters: level, message
using LogCallback = std::function<void(uint8_t level, const std::string& message)>;

class Log
{
public:
Expand Down Expand Up @@ -60,10 +50,6 @@ namespace Lux {
static std::map<std::string, TagDetails>& EnabledTags() { return s_EnabledTags; }
static void SetDefaultTagSettings();

// Console callback registration
static void SetConsoleCallback(LogCallback callback) { s_ConsoleCallback = std::move(callback); }
static void ClearConsoleCallback() { s_ConsoleCallback = nullptr; }

#if defined(LUX_PLATFORM_WINDOWS)
template<typename... Args>
static void PrintMessage(Log::Type type, Log::Level level, std::format_string<Args...> format, Args&&... args);
Expand All @@ -88,11 +74,11 @@ namespace Lux {
{
switch (level)
{
case Level::Trace: return "Trace";
case Level::Info: return "Info";
case Level::Warn: return "Warn";
case Level::Error: return "Error";
case Level::Fatal: return "Fatal";
case Level::Trace: return "Trace";
case Level::Info: return "Info";
case Level::Warn: return "Warn";
case Level::Error: return "Error";
case Level::Fatal: return "Fatal";
}
return "";
}
Expand All @@ -108,21 +94,12 @@ namespace Lux {
}

private:
// Internal helper to invoke the console callback
static void NotifyConsoleCallback(Level level, const std::string& message)
{
if (s_ConsoleCallback)
s_ConsoleCallback(static_cast<uint8_t>(level), message);
}

static std::shared_ptr<spdlog::logger> s_CoreLogger;
static std::shared_ptr<spdlog::logger> s_ClientLogger;
static std::shared_ptr<spdlog::logger> s_EditorConsoleLogger;

inline static std::map<std::string, TagDetails> s_EnabledTags;
static std::map<std::string, TagDetails> s_DefaultTagDetails;

inline static LogCallback s_ConsoleCallback;
};

}
Expand All @@ -148,13 +125,11 @@ namespace Lux {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Core Logging
#define LUX_CORE_TRACE(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Trace, __VA_ARGS__)
#define LUX_CORE_INFO(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Info, __VA_ARGS__)
#define LUX_CORE_WARN(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Warn, __VA_ARGS__)
#define LUX_CORE_ERROR(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Error, __VA_ARGS__)
#define LUX_CORE_FATAL(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Fatal, __VA_ARGS__)
#define LUX_CORE_CRITICAL(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Fatal, __VA_ARGS__)

#define LUX_CORE_TRACE(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Trace, __VA_ARGS__)
#define LUX_CORE_INFO(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Info, __VA_ARGS__)
#define LUX_CORE_WARN(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Warn, __VA_ARGS__)
#define LUX_CORE_ERROR(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Error, __VA_ARGS__)
#define LUX_CORE_FATAL(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Core, ::Lux::Log::Level::Fatal, __VA_ARGS__)
// Client Logging
#define LUX_TRACE(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Client, ::Lux::Log::Level::Trace, __VA_ARGS__)
#define LUX_INFO(...) ::Lux::Log::PrintMessage(::Lux::Log::Type::Client, ::Lux::Log::Level::Info, __VA_ARGS__)
Expand Down Expand Up @@ -183,29 +158,24 @@ namespace Lux {
if (detail.Enabled && detail.LevelFilter <= level)
{
auto logger = (type == Type::Core) ? GetCoreLogger() : GetClientLogger();
std::string formatted = std::format(format, std::forward<Args>(args)...);

switch (level)
{
case Level::Trace:
logger->trace("{}", formatted);
logger->trace(format, std::forward<Args>(args)...);
break;
case Level::Info:
logger->info("{}", formatted);
logger->info(format, std::forward<Args>(args)...);
break;
case Level::Warn:
logger->warn("{}", formatted);
logger->warn(format, std::forward<Args>(args)...);
break;
case Level::Error:
logger->error("{}", formatted);
logger->error(format, std::forward<Args>(args)...);
break;
case Level::Fatal:
logger->critical("{}", formatted);
logger->critical(format, std::forward<Args>(args)...);
break;
}

// Notify the console callback
NotifyConsoleCallback(level, formatted);
}
}

Expand All @@ -218,29 +188,24 @@ namespace Lux {
{
auto logger = (type == Type::Core) ? GetCoreLogger() : GetClientLogger();
std::string formatted = std::format(format, std::forward<Args>(args)...);
std::string taggedMessage = std::format("[{}] {}", tag, formatted);

switch (level)
{
case Level::Trace:
logger->trace("{}", taggedMessage);
break;
case Level::Info:
logger->info("{}", taggedMessage);
break;
case Level::Warn:
logger->warn("{}", taggedMessage);
break;
case Level::Error:
logger->error("{}", taggedMessage);
break;
case Level::Fatal:
logger->critical("{}", taggedMessage);
break;
case Level::Trace:
logger->trace("[{0}] {1}", tag, formatted);
break;
case Level::Info:
logger->info("[{0}] {1}", tag, formatted);
break;
case Level::Warn:
logger->warn("[{0}] {1}", tag, formatted);
break;
case Level::Error:
logger->error("[{0}] {1}", tag, formatted);
break;
case Level::Fatal:
logger->critical("[{0}] {1}", tag, formatted);
break;
}

// Notify the console callback
NotifyConsoleCallback(level, taggedMessage);
}
}

Expand All @@ -251,29 +216,24 @@ namespace Lux {
if (detail.Enabled && detail.LevelFilter <= level)
{
auto logger = (type == Type::Core) ? GetCoreLogger() : GetClientLogger();
std::string taggedMessage = std::format("[{}] {}", tag, message);

switch (level)
{
case Level::Trace:
logger->trace("{}", taggedMessage);
break;
case Level::Info:
logger->info("{}", taggedMessage);
break;
case Level::Warn:
logger->warn("{}", taggedMessage);
break;
case Level::Error:
logger->error("{}", taggedMessage);
break;
case Level::Fatal:
logger->critical("{}", taggedMessage);
break;
case Level::Trace:
logger->trace("[{0}] {1}", tag, message);
break;
case Level::Info:
logger->info("[{0}] {1}", tag, message);
break;
case Level::Warn:
logger->warn("[{0}] {1}", tag, message);
break;
case Level::Error:
logger->error("[{0}] {1}", tag, message);
break;
case Level::Fatal:
logger->critical("[{0}] {1}", tag, message);
break;
}

// Notify the console callback
NotifyConsoleCallback(level, taggedMessage);
}
}

Expand Down
Loading
Loading