Updated entity query

This commit is contained in:
2025-12-04 20:37:52 +09:00
parent 93bc8e55a3
commit f9db047a5f
6 changed files with 378 additions and 36 deletions

View File

@@ -110,13 +110,13 @@ public unsafe class EntityManager : IDisposable
ref Archetype newArch, int newChunk, int newRow)
{
// Iterate every component type in the OLD archetype
for (var i = 0; i < oldArch.Layouts.Count; i++)
for (var i = 0; i < oldArch._layouts.Count; i++)
{
var layout = oldArch.Layouts[i];
var layout = oldArch._layouts[i];
var src = oldArch.Chunks[oldChunk].GetUnsafePtr() + layout.offset + (layout.size * oldRow);
var src = oldArch._chunks[oldChunk].GetUnsafePtr() + layout.offset + (layout.size * oldRow);
var newOffset = newArch.GetOffset(layout.componentID); // O(1) Lookup
var dst = oldArch.Chunks[oldChunk].GetUnsafePtr() + newOffset + (layout.size * newRow);
var dst = oldArch._chunks[oldChunk].GetUnsafePtr() + newOffset + (layout.size * newRow);
MemoryUtility.MemCpy(src, dst, (nuint)layout.size);
}
@@ -133,7 +133,7 @@ public unsafe class EntityManager : IDisposable
// Build new archetype signature
ref var oldArchetype = ref _world.GetArchetypeReference(location.archetypeID);
var oldSignature = oldArchetype.Signature;
var oldSignature = oldArchetype._signature;
// TODO: Check edge cache first.
var newArcID = oldArchetype.GetEdgeAdd(componentID);