feat: add scene serialization (JSON + binary) with import pipeline
Implement scene save/load for editor and runtime. Editor JSON (.gscene) uses Utf8JsonWriter for inline component objects. Runtime binary (.imported) stores marshalled component data with entity field offset metadata for AOT-safe remapping. - SceneSerializationService: save from EditorWorld, load into EditorWorld - SceneAsset + SceneAssetHandler: .gscene import/pack pipeline - AssetManager.Scene + SceneLoader: runtime binary deserialization - Scene: [JsonConstructor] + [JsonIgnore] for round-trip - Component: GetComponentIDByName for editor-side type lookup - 10 unit tests (save, load, round-trip, unknown comp, invalid version) Also guard DSLShaderCompiler editor code with #if GHOST_EDITOR, add GC.SuppressFinalize to EditorWorldService, and switch Archetype debug fields from #if GHOST_EDITOR to #if DEBUG.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Ghost.Entities;
|
||||
using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ghost.Engine.Core;
|
||||
|
||||
@@ -19,6 +20,7 @@ public readonly struct Scene : IEquatable<Scene>
|
||||
/// <summary>
|
||||
/// Gets whether this scene is valid.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool IsValid => _id >= 0;
|
||||
|
||||
/// <summary>
|
||||
@@ -26,7 +28,8 @@ public readonly struct Scene : IEquatable<Scene>
|
||||
/// </summary>
|
||||
public static Scene Invalid => new(-1);
|
||||
|
||||
internal Scene(short id)
|
||||
[JsonConstructor]
|
||||
public Scene(short id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user