feat: implement complete scene graph system with hierarchical editor support

- Add SceneNode and EntityNode classes for editor-only metadata storage
- Implement SceneGraph view-model with O(1) entity lookup via internal caching
- Create IdRemapTable for file-local to global entity ID remapping on load
- Implement SceneSerializationContext for load/save operation tracking
- Add JSON-serializable SceneAssetData, EntityData, and ComponentData models
- Implement SceneSerializer for save/load with validation and reference remapping
- Add comprehensive documentation: README.md, IMPLEMENTATION_GUIDE.md, SYSTEM_SUMMARY.md
- Update Ghost.Editor.Core.csproj to reference Ghost.Entities assembly
- Support parent-child relationships via Hierarchy component
- Enforce no cross-scene entity references
- Keep runtime minimal: only SceneID, Hierarchy, LocalToWorld components
- All editor metadata (names, UI state) stored in editor-only SceneNode/EntityNode classes

This implements the architecture from SceneGraph Plan.md with clean separation of concerns,
minimal runtime footprint, and AOT compatibility.
This commit is contained in:
2026-01-25 21:42:03 +09:00
parent ba5dc2159e
commit fdf831630b
12 changed files with 1520 additions and 294 deletions

View File

@@ -5,8 +5,8 @@ The Scene Graph is a hierarchical structure that represents all the objects and
## Scene Graph (Editor representation of runtime data)
There should be two main types of nodes in the Scene Graph:
1. **Entity Node**: Represents an individual entity within a scene.
2. **Scene Node**: Represents a Scene object, which can contain multiple entities.
1. **Entity Node**: Represents an individual entity within a scene. Name stored here, not runtime component.
2. **Scene Node**: Represents a Scene object, which can contain multiple entities. Name stored here not runtime data.
### Editor World
@@ -56,7 +56,7 @@ When loading a scene, we need to reconstruct the entities and their relationship
### Data format
The scene data should be stored in a structured format (e.g., JSON or binary) that includes:
- Scene metadata (e.g., name, ID)
- Scene metadata (e.g., name, ID. Note that name of entity and scene are editor only data, should be included inside SceneNode and EntityNode, not runtime data)
- List of entities with their components and properties (Entities must in the order that file local id directly maps to the index in the list)
- References between entities using file local IDs