Merged
Conversation
85a151d to
b7e664f
Compare
25a64f6 to
b9a0165
Compare
8b3c87d to
b96c0b1
Compare
Before the macros names were imported from the Terran Engine mono library and included the CORE keyword in their name (e.g. TR_CORE_TRACE) this no longer makes sense as these would be called from other libraries
e028649 to
02be680
Compare
The idea behind this change is to have AssetHandle control the lifetime of an Asset, i.e. when an asset is added/imported the AssetManager creates a strong AssetHandle. When all of the references to the AssetHandle drop, the destructor enqueues the corresponding Asset to be freed
a630873 to
d8543a4
Compare
There was a problem hiding this comment.
Pull request overview
This PR is part of the engine decoupling effort (#52 / #49) and moves the Scene system out of TerranEngine into a standalone LibScene, while also evolving the asset and logging infrastructure to support the new module layout.
Changes:
- Introduces
Libraries/LibScene(Scene/Entity/Components/Serializer/Manager/Events) and wires it into premake + sandbox. - Refactors
LibAssetto useRefPtr-based assets and typed importer results (AssetLoadResult), adding handle/metadata changes. - Adds/expands unit tests for
LibScene,LibAsset, andLibCoreplus updates CI coverage aggregation.
Reviewed changes
Copilot reviewed 76 out of 78 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| vendor/entt/LICENSE | Adds MIT license file for vendored entt. |
| premake-native.lua | Adds LibScene and new test projects to the workspace. |
| dependecies.lua | Adds Dependencies.entt and adjusts include directory usage. |
| Tests/LibScene/premake5.lua | New premake project for LibScene tests. |
| Tests/LibScene/SceneTests.cpp | Adds Scene behavior tests (entities, map, runtime events). |
| Tests/LibScene/Main.cpp | GTest entry point for LibScene tests. |
| Tests/LibScene/EntityTests.cpp | Adds Entity relationship/parenting error-path tests. |
| Tests/LibCore/RefPtrTests.cpp | Adds tests for new Core::RefPtr. |
| Tests/LibCore/ByteBufferTests.cpp | Removes incorrect #pragma once from .cpp. |
| Tests/LibAsset/premake5.lua | New premake project for LibAsset tests. |
| Tests/LibAsset/Main.cpp | GTest entry point for LibAsset tests. |
| Tests/LibAsset/AssetImporterRegistryTests.cpp | Adds registry tests for importer load/save behavior. |
| TerranEngine/src/Utils/SerializerUtils.cpp | Removes old YAML serializer operators (moved/rewritten elsewhere). |
| TerranEngine/src/Scene/Systems/SceneRenderer.h | Removes old engine-integrated scene renderer. |
| TerranEngine/src/Scene/Systems/SceneRenderer.cpp | Removes old engine-integrated scene renderer implementation. |
| TerranEngine/src/Scene/SceneSerializer.h | Removes old engine SceneSerializer API. |
| TerranEngine/src/Scene/SceneSerializer.cpp | Removes old engine SceneSerializer implementation. |
| TerranEngine/src/Scene/SceneManager.h | Removes old engine SceneManager. |
| TerranEngine/src/Scene/SceneManager.cpp | Removes old engine SceneManager implementation. |
| TerranEngine/src/Scene/Scene.h | Removes old engine Scene definition. |
| TerranEngine/src/Scene/Scene.cpp | Removes old engine Scene implementation. |
| TerranEngine/src/Scene/Entity.h | Removes old engine Entity wrapper. |
| TerranEngine/src/Scene/Components.h | Removes old engine Scene component definitions. |
| TerranEngine/src/Math/Math.h | Removes old engine Math API (moved to LibCore). |
| TerranEngine/src/Math/Math.cpp | Removes old engine Math implementation (moved to LibCore). |
| TerranEngine/src/Events/SceneEvent.h | Removes old engine scene events header. |
| TerranEngine/premake5.lua | Switches entt include to Dependencies.entt.include. |
| Sandbox/src/SandboxLayer.cpp | Updates sandbox includes to use new LibScene/LibAsset headers. |
| Sandbox/premake5.lua | Links Sandbox against LibScene and LibAsset, adds yaml include. |
| Libraries/LibWindow/WindowTypes.h | Introduces TR_LOG_WINDOW logger name constant. |
| Libraries/LibWindow/WindowSystem.h | Adds destroy() to remove a window from the system. |
| Libraries/LibWindow/WindowSystem.cpp | Adds window logger + improved GLFW init/terminate logging & error callback. |
| Libraries/LibWindow/Input.h | Moves input logging to the window logger. |
| Libraries/LibWindow/GLFWWindow.cpp | Removes per-window glfwTerminate() and improves window logging. |
| Libraries/LibScene/premake5.lua | New LibScene build configuration and dependencies. |
| Libraries/LibScene/SceneTypes.h | Introduces TR_LOG_SCENE logger name constant. |
| Libraries/LibScene/SceneSerializerError.h | Adds typed error for scene serialization. |
| Libraries/LibScene/SceneSerializer.h | New Scene serializer as an AssetImporter. |
| Libraries/LibScene/SceneSerializer.cpp | Implements YAML-based scene save/load in LibScene. |
| Libraries/LibScene/SceneManager.h | New SceneManager layer integrated with AssetSystem. |
| Libraries/LibScene/SceneManager.cpp | Implements scene creation/copying/transition event triggering. |
| Libraries/LibScene/SceneEvent.h | Adds scene transition + runtime start/stop events. |
| Libraries/LibScene/Scene.h | New LibScene Scene API (entities, hierarchy transforms, runtime state). |
| Libraries/LibScene/Scene.cpp | Implements the new LibScene Scene. |
| Libraries/LibScene/Entity.inl | Defines templated component helpers for Entity. |
| Libraries/LibScene/Entity.h | New LibScene Entity API incl. relationship ops + error results. |
| Libraries/LibScene/Entity.cpp | Implements parent/unparent semantics and error handling. |
| Libraries/LibScene/Components.h | Defines core LibScene components (Tag/Transform/Relationship). |
| Libraries/LibScene/ComponentSerializer.h | Adds ComponentSerializer concept for YAML serializers. |
| Libraries/LibCore/WeakRef.h | Introduces WeakPtr (non-owning pointer wrapper). |
| Libraries/LibCore/SerializerExtensions.h | Reworks YAML serialization helpers and conversion specializations. |
| Libraries/LibCore/Result.h | Fixes union lifetime UB using placement-new and manual destruction. |
| Libraries/LibCore/RefPtr.h | Introduces intrusive ref-counted smart pointer. |
| Libraries/LibCore/Math.h | Adds Core::Math transform matrix decompose/compose API. |
| Libraries/LibCore/Math.cpp | Implements Core::Math functions. |
| Libraries/LibCore/Log.h | Renames core logging macros (core vs non-core) and updates namespaces. |
| Libraries/LibCore/Log.cpp | Updates logging calls to new macros and improves includes. |
| Libraries/LibCore/LayerStack.h | Fixes forwarding in LayerStack::push template args. |
| Libraries/LibCore/Assert.h | Routes assert logging through new TR_ERROR macro. |
| Libraries/LibAsset/AssetTypes.h | Renames AssetHandle -> AssetId and makes TR_LOG_ASSET a constant. |
| Libraries/LibAsset/AssetSystem.h | Registers the asset logger on startup. |
| Libraries/LibAsset/AssetMetadataRegistry.h | Updates registry key types to AssetId. |
| Libraries/LibAsset/AssetMetadataRegistry.cpp | Updates implementation for AssetId and adds error logs. |
| Libraries/LibAsset/AssetMetadata.h | Updates metadata field from Handle to AssetId. |
| Libraries/LibAsset/AssetManager.h | Refactors APIs around AssetId/AssetHandle, RefPtr, and remove/purge flows. |
| Libraries/LibAsset/AssetManager.cpp | Implements updated import/reload/remove/purge logic and event triggers. |
| Libraries/LibAsset/AssetImporterRegistry.h | Updates registry API to return AssetLoadResult and accept RefPtr. |
| Libraries/LibAsset/AssetImporterRegistry.cpp | Implements new load/save behavior and importer-not-found errors. |
| Libraries/LibAsset/AssetImporterError.h | Adds typed error for importer failures. |
| Libraries/LibAsset/AssetImporter.h | Refactors importer interface to return AssetLoadResult. |
| Libraries/LibAsset/AssetHandle.h | Adds ref-counted handle wrapper for asset IDs. |
| Libraries/LibAsset/AssetHandle.cpp | Enqueues assets for deletion when handles are destroyed. |
| Libraries/LibAsset/AssetEvents.h | Updates asset events to use AssetId. |
| Libraries/LibAsset/AssetError.h | Adds a base error type for asset-related failures. |
| Libraries/LibAsset/Asset.h | Makes Asset ref-counted and switches internal id to AssetId. |
| Libraries/LibAsset/Asset.cpp | Removes unused implementation file. |
| .github/workflows/sonarcloud.yml | Updates coverage aggregation to include multiple test binaries correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WeakPtr was essentially broken, not checks for whether the actual object is still alive, and the lock tried to create a RefPtr without any regard, essentially doing an use-after-free is the original object was dead
ceafa37 to
a91ec26
Compare
|
Owner
Author
|
There are more changes/updates that need to be done to LibScene and LibAsset, however the foundational work is done here and in #55. Thus I'm merging this and logging issues for further improvements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes: #52