Refactor ECS core, improve thread safety, add tests

- Switch Scene IDs to ushort, update invalid value logic
- Add thread safety to SceneManager and ComponentRegistry
- Add GHOST_ZERO_INIT_COMPONENT define for editor configs
- Update mesh header counts to use int, not uint
- Add Collect methods for archetype/component cleanup
- Add With/Without/AsView to ComponentSet for easier use
- Refactor World creation/destruction, version handling
- Refactor ResourceStreamingContext to use init-only props
- Add unit tests for entity queries and world lifecycle
- Minor code cleanups and formatting fixes
This commit is contained in:
2026-05-13 13:36:51 +09:00
parent bb07644580
commit cbaa129d9e
17 changed files with 305 additions and 108 deletions

View File

@@ -0,0 +1,28 @@
using Ghost.Entities;
namespace Ghost.UnitTest.ECS;
[TestClass]
[DoNotParallelize]
public class WorldTests
{
[TestMethod]
public void CreateWorld()
{
using var world = World.Create();
Assert.IsNotNull(world);
}
[TestMethod]
public void AddEntityThenClearWorld()
{
using var world = World.Create();
Assert.IsNotNull(world);
world.EntityManager.CreateEntity();
Assert.AreEqual(1, world.EntityManager.EntityCount);
world.Clear(default);
Assert.AreEqual(0, world.EntityManager.EntityCount);
}
}