Major ECS API overhaul: added ComponentSet, refactored ComponentRegistry, and updated all entity/component creation methods. Introduced robust custom serialization infrastructure and per-component source generators for registration and (de)serialization. Updated editor, engine, and test code to use new APIs. Improved code quality, naming, and performance throughout. Removed obsolete code and updated dependencies.
55 lines
1.2 KiB
C#
55 lines
1.2 KiB
C#
using Ghost.Entities;
|
|
using Misaki.HighPerformance.Jobs;
|
|
|
|
namespace Ghost.Engine;
|
|
|
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
|
internal class EngineEntryAttribute : Attribute
|
|
{
|
|
}
|
|
|
|
internal partial class EngineCoreImpl : IDisposable
|
|
{
|
|
internal readonly JobScheduler _jobScheduler;
|
|
|
|
internal EngineCoreImpl()
|
|
{
|
|
_jobScheduler = new JobScheduler(Environment.ProcessorCount - 2); // We -2 here, one for main thread, one for render thread
|
|
}
|
|
|
|
internal void IncrementCPUFenceValue()
|
|
{
|
|
//GraphicsPipeline.SignalCPUReady();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_jobScheduler.Dispose();
|
|
JobScheduler.ReleaseTempAllocator();
|
|
}
|
|
}
|
|
|
|
[EngineEntry]
|
|
public static partial class EngineCore
|
|
{
|
|
internal static readonly EngineCoreImpl s_impl;
|
|
|
|
public static JobScheduler JobScheduler => s_impl._jobScheduler;
|
|
|
|
static EngineCore()
|
|
{
|
|
s_impl = new EngineCoreImpl();
|
|
|
|
ComponentRegistry.GetOrRegisterComponent<ManagedEntityRef>();
|
|
RegisterIComponentTypes();
|
|
}
|
|
|
|
internal static void Init()
|
|
{
|
|
}
|
|
|
|
internal static void Dispose()
|
|
{
|
|
s_impl.Dispose();
|
|
}
|
|
} |