forked from Misaki/GhostEngine
Improve the usability of Result<T, E> and add new job schedule method to EntityQuery.
Added implicate conversion to Result<T, E> and RefResult<T, E>; Added new ScheduleChunkParallel in EntityQuery; Remove Ghost.SparseEntity from solution file. It's now completlty replaced by Ghost.Entities;
This commit is contained in:
@@ -54,7 +54,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 1; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -124,7 +124,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -147,10 +146,9 @@ public unsafe partial struct EntityQuery
|
||||
public readonly ComponentIterator<T0> GetComponentIterator<T0>()
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -223,7 +221,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 2; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -293,7 +291,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -317,10 +314,9 @@ public unsafe partial struct EntityQuery
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -402,7 +398,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 3; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -472,7 +468,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -497,10 +492,9 @@ public unsafe partial struct EntityQuery
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2, T3>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -591,7 +585,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 4; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -661,7 +655,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -687,10 +680,9 @@ public unsafe partial struct EntityQuery
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2, T3>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2, T3>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2, T3, T4>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -790,7 +782,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 5; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -860,7 +852,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -887,10 +878,9 @@ public unsafe partial struct EntityQuery
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2, T3, T4, T5>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -999,7 +989,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 6; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1069,7 +1059,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -1097,10 +1086,9 @@ public unsafe partial struct EntityQuery
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2, T3, T4, T5, T6>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -1218,7 +1206,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 7; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1288,7 +1276,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -1317,10 +1304,9 @@ public unsafe partial struct EntityQuery
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5, T6>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5, T6>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
public readonly ref struct ComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
@@ -1447,7 +1433,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 8; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1517,7 +1503,6 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -1547,8 +1532,7 @@ public unsafe partial struct EntityQuery
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < <#= i #>; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly ComponentIterator<<#= generics#>> GetComponentIterator<<#= generics#>>()
|
||||
<#= restrictions #>
|
||||
{
|
||||
return new ComponentIterator<<#= generics#>>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new ComponentIterator<<#= generics#>>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
<# } #>
|
||||
|
||||
@@ -77,7 +77,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 1; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly EntityComponentIterator<T0> GetEntityComponentIterator<T0>()
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1>
|
||||
@@ -251,7 +251,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 2; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public unsafe partial struct EntityQuery
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2>
|
||||
@@ -435,7 +435,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 3; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ public unsafe partial struct EntityQuery
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2, T3>
|
||||
@@ -629,7 +629,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 4; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -724,7 +724,7 @@ public unsafe partial struct EntityQuery
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2, T3>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2, T3>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2, T3, T4>
|
||||
@@ -833,7 +833,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 5; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -929,7 +929,7 @@ public unsafe partial struct EntityQuery
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2, T3, T4, T5>
|
||||
@@ -1047,7 +1047,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 6; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ public unsafe partial struct EntityQuery
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6>
|
||||
@@ -1271,7 +1271,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 7; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1369,7 +1369,7 @@ public unsafe partial struct EntityQuery
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
public readonly ref struct EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>
|
||||
@@ -1505,7 +1505,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 8; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -1604,7 +1604,7 @@ public unsafe partial struct EntityQuery
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<T0, T1, T2, T3, T4, T5, T6, T7>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < <#= i #>; index++)
|
||||
{
|
||||
var layout = _currentArchetype.GetLayout(_compTypeIDs[index])
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly EntityComponentIterator<<#= generics#>> GetEntityComponentIterator<<#= generics#>>()
|
||||
<#= restrictions #>
|
||||
{
|
||||
return new EntityComponentIterator<<#= generics#>>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success));
|
||||
return new EntityComponentIterator<<#= generics#>>(_matchingArchetypes.AsReadOnly(), _mask, World.GetWorld(_worldID).GetValueOrThrow());
|
||||
}
|
||||
|
||||
<# } #>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using Ghost.Core;
|
||||
|
||||
namespace Ghost.Entities;
|
||||
@@ -8,7 +7,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly void ForEach<T0>(ForEach<T0> action)
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value };
|
||||
var offsets = stackalloc int[1];
|
||||
@@ -21,7 +20,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 1; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -64,7 +63,7 @@ public unsafe partial struct EntityQuery
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value };
|
||||
var offsets = stackalloc int[2];
|
||||
@@ -77,7 +76,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 2; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -122,7 +121,7 @@ public unsafe partial struct EntityQuery
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value };
|
||||
var offsets = stackalloc int[3];
|
||||
@@ -135,7 +134,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 3; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -182,7 +181,7 @@ public unsafe partial struct EntityQuery
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value };
|
||||
var offsets = stackalloc int[4];
|
||||
@@ -195,7 +194,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 4; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -244,7 +243,7 @@ public unsafe partial struct EntityQuery
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value };
|
||||
var offsets = stackalloc int[5];
|
||||
@@ -257,7 +256,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 5; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -308,7 +307,7 @@ public unsafe partial struct EntityQuery
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value };
|
||||
var offsets = stackalloc int[6];
|
||||
@@ -321,7 +320,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 6; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -374,7 +373,7 @@ public unsafe partial struct EntityQuery
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value, ComponentTypeID<T6>.value };
|
||||
var offsets = stackalloc int[7];
|
||||
@@ -387,7 +386,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 7; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -442,7 +441,7 @@ public unsafe partial struct EntityQuery
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value, ComponentTypeID<T6>.value, ComponentTypeID<T7>.value };
|
||||
var offsets = stackalloc int[8];
|
||||
@@ -455,7 +454,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 8; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -504,7 +503,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly void ForEach<T0>(ForEachWithEntity<T0> action)
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value };
|
||||
var offsets = stackalloc int[1];
|
||||
@@ -517,7 +516,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 1; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -561,7 +560,7 @@ public unsafe partial struct EntityQuery
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value };
|
||||
var offsets = stackalloc int[2];
|
||||
@@ -574,7 +573,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 2; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -620,7 +619,7 @@ public unsafe partial struct EntityQuery
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value };
|
||||
var offsets = stackalloc int[3];
|
||||
@@ -633,7 +632,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 3; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -681,7 +680,7 @@ public unsafe partial struct EntityQuery
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value };
|
||||
var offsets = stackalloc int[4];
|
||||
@@ -694,7 +693,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 4; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -744,7 +743,7 @@ public unsafe partial struct EntityQuery
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value };
|
||||
var offsets = stackalloc int[5];
|
||||
@@ -757,7 +756,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 5; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -809,7 +808,7 @@ public unsafe partial struct EntityQuery
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value };
|
||||
var offsets = stackalloc int[6];
|
||||
@@ -822,7 +821,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 6; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -876,7 +875,7 @@ public unsafe partial struct EntityQuery
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value, ComponentTypeID<T6>.value };
|
||||
var offsets = stackalloc int[7];
|
||||
@@ -889,7 +888,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 7; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -945,7 +944,7 @@ public unsafe partial struct EntityQuery
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { ComponentTypeID<T0>.value, ComponentTypeID<T1>.value, ComponentTypeID<T2>.value, ComponentTypeID<T3>.value, ComponentTypeID<T4>.value, ComponentTypeID<T5>.value, ComponentTypeID<T6>.value, ComponentTypeID<T7>.value };
|
||||
var offsets = stackalloc int[8];
|
||||
@@ -958,7 +957,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < 8; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -1005,4 +1004,4 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ public unsafe partial struct EntityQuery
|
||||
#>
|
||||
<# for (var i = 1; i <= Amount; i++)
|
||||
{
|
||||
var generics = AppendGenerics(i);
|
||||
var compGenerics = AppendGenericRefParameters(i);
|
||||
var generics = AppendParameters(i, "T{0}");
|
||||
var restrictions = AppendGenericRestrictionsMultiline(i, "unmanaged, IComponent", 2);
|
||||
|
||||
var delegateTupe = isForEachWithEntity ? "ForEachWithEntity" : "ForEach";
|
||||
@@ -25,7 +24,7 @@ public unsafe partial struct EntityQuery
|
||||
public readonly void ForEach<<#= generics #>>(<#= delegateTupe #><<#= generics #>> action)
|
||||
<#= restrictions #>
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
var compTypeIDs = stackalloc int[] { <#= AppendGenerics(i, "ComponentTypeID<T{0}>.value") #> };
|
||||
var offsets = stackalloc int[<#= i #>];
|
||||
@@ -38,7 +37,7 @@ public unsafe partial struct EntityQuery
|
||||
for (var index = 0; index < <#= i #>; index++)
|
||||
{
|
||||
var layoutResult = archetype.GetLayout(compTypeIDs[index]);
|
||||
if (layoutResult.Status != ResultStatus.Success)
|
||||
if (!layoutResult)
|
||||
{
|
||||
hasAllComponents = false;
|
||||
break;
|
||||
@@ -75,9 +74,9 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
<# if (isForEachWithEntity) { #>
|
||||
var pEntity = (Entity*)(pChunkData + archetype.EntityIDsOffset + (sizeof(Entity) * entityIndex));
|
||||
action(*pEntity, <#= AppendRefParameters(i, "*pComp{0}") #>);
|
||||
action(*pEntity, <#= AppendParameters(i, "ref *pComp{0}") #>);
|
||||
<# } else { #>
|
||||
action(<#= AppendRefParameters(i, "*pComp{0}") #>);
|
||||
action(<#= AppendParameters(i, "ref *pComp{0}") #>);
|
||||
<# } #>
|
||||
}
|
||||
}
|
||||
@@ -86,4 +85,4 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
<# } #>
|
||||
<# } #>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Ghost.Entities;
|
||||
public interface IJobEntity<T0>
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0);
|
||||
void Execute(Entity entity, ref T0 component0, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0> : IJobParallelFor
|
||||
@@ -43,7 +43,7 @@ internal unsafe struct JobEntityBatch<TJob, T0> : IJobParallelFor
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public interface IJobEntity<T0, T1>
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1> : IJobParallelFor
|
||||
@@ -100,7 +100,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1> : IJobParallelFor
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public interface IJobEntity<T0, T1, T2>
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2> : IJobParallelFor
|
||||
@@ -171,7 +171,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2> : IJobParallelFor
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public interface IJobEntity<T0, T1, T2, T3>
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3> : IJobParallelFor
|
||||
@@ -256,7 +256,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3> : IJobParallelFor
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public interface IJobEntity<T0, T1, T2, T3, T4>
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4> : IJobParallelFor
|
||||
@@ -355,7 +355,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4> : IJobParallelFo
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -368,7 +368,7 @@ public interface IJobEntity<T0, T1, T2, T3, T4, T5>
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5> : IJobParallelFor
|
||||
@@ -468,7 +468,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5> : IJobParall
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -482,7 +482,7 @@ public interface IJobEntity<T0, T1, T2, T3, T4, T5, T6>
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5, T6> : IJobParallelFor
|
||||
@@ -595,7 +595,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5, T6> : IJobPa
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i], ref ptr6[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i], ref ptr6[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,7 +610,7 @@ public interface IJobEntity<T0, T1, T2, T3, T4, T5, T6, T7>
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6, ref T7 component7);
|
||||
void Execute(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6, ref T7 component7, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5, T6, T7> : IJobParallelFor
|
||||
@@ -736,7 +736,7 @@ internal unsafe struct JobEntityBatch<TJob, T0, T1, T2, T3, T4, T5, T6, T7> : IJ
|
||||
continue;
|
||||
}
|
||||
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i], ref ptr6[i], ref ptr7[i]);
|
||||
userJob.Execute(pEntity[i], ref ptr0[i], ref ptr1[i], ref ptr2[i], ref ptr3[i], ref ptr4[i], ref ptr5[i], ref ptr6[i], ref ptr7[i], threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,7 +768,7 @@ public unsafe partial struct EntityQuery
|
||||
where TJob : unmanaged, IJobEntity<T0>
|
||||
where T0 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -790,7 +790,7 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -871,7 +871,7 @@ public unsafe partial struct EntityQuery
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -896,9 +896,9 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -995,7 +995,7 @@ public unsafe partial struct EntityQuery
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1023,11 +1023,11 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -1140,7 +1140,7 @@ public unsafe partial struct EntityQuery
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1171,13 +1171,13 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -1306,7 +1306,7 @@ public unsafe partial struct EntityQuery
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1340,15 +1340,15 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -1493,7 +1493,7 @@ public unsafe partial struct EntityQuery
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1530,17 +1530,17 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -1701,7 +1701,7 @@ public unsafe partial struct EntityQuery
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1741,19 +1741,19 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout6 = arch.GetLayout(ComponentTypeID<T6>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
@@ -1930,7 +1930,7 @@ public unsafe partial struct EntityQuery
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -1973,21 +1973,21 @@ public unsafe partial struct EntityQuery
|
||||
|
||||
// Get offsets ONCE per archetype
|
||||
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout6 = arch.GetLayout(ComponentTypeID<T6>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
var layout7 = arch.GetLayout(ComponentTypeID<T7>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
|
||||
// Add all chunks from this archetype
|
||||
for (var i = 0; i < arch.ChunkCount; i++)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ghost.Entities;
|
||||
public interface IJobEntity<<#= generics #>>
|
||||
<#= restrictions #>
|
||||
{
|
||||
void Execute(Entity entity, <#= AppendParameters(i, "ref T{0} component{0}") #>);
|
||||
void Execute(Entity entity, <#= AppendParameters(i, "ref T{0} component{0}") #>, int threadIndex);
|
||||
}
|
||||
|
||||
internal unsafe struct JobEntityBatch<TJob, <#= generics #>> : IJobParallelFor
|
||||
@@ -62,7 +62,7 @@ internal unsafe struct JobEntityBatch<TJob, <#= generics #>> : IJobParallelFor
|
||||
}
|
||||
|
||||
<# } #>
|
||||
userJob.Execute(pEntity[i], <#= AppendParameters(i, "ref ptr{0}[i]") #>);
|
||||
userJob.Execute(pEntity[i], <#= AppendParameters(i, "ref ptr{0}[i]") #>, threadIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public unsafe partial struct EntityQuery
|
||||
where TJob : unmanaged, IJobEntity<<#= generics #>>
|
||||
<#= restrictions #>
|
||||
{
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow(ResultStatus.Success);
|
||||
var world = World.GetWorld(_worldID).GetValueOrThrow();
|
||||
|
||||
// 1. Flatten the World
|
||||
var chunkList = new UnsafeList<IntPtr>(128, allocator);
|
||||
@@ -129,7 +129,7 @@ public unsafe partial struct EntityQuery
|
||||
// Get offsets ONCE per archetype
|
||||
<# for (var j = 0; j < i; j++){ #>
|
||||
var layout<#= j #> = arch.GetLayout(ComponentTypeID<T<#= j #>>.value)
|
||||
.GetValueOrThrow(ResultStatus.Success);
|
||||
.GetValueOrThrow();
|
||||
<# } #>
|
||||
|
||||
// Add all chunks from this archetype
|
||||
|
||||
@@ -1,92 +1,35 @@
|
||||
|
||||
namespace Ghost.Entities;
|
||||
|
||||
public delegate void ForEach<T0>(ref T0 component0)
|
||||
where T0 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1>(ref T0 component0, ref T1 component1)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2>(ref T0 component0, ref T1 component1, ref T2 component2)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2, T3>(ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2, T3, T4>(ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2, T3, T4, T5>(ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2, T3, T4, T5, T6>(ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent where T6 : unmanaged, IComponent;
|
||||
public delegate void ForEach<T0, T1, T2, T3, T4, T5, T6, T7>(ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6, ref T7 component7)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent where T6 : unmanaged, IComponent where T7 : unmanaged, IComponent;
|
||||
|
||||
public delegate void ForEachWithEntity<T0>(Entity entity, ref T0 component0)
|
||||
where T0 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1>(Entity entity, ref T0 component0, ref T1 component1)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2, T3>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2, T3, T4>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2, T3, T4, T5>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2, T3, T4, T5, T6>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent where T6 : unmanaged, IComponent;
|
||||
public delegate void ForEachWithEntity<T0, T1, T2, T3, T4, T5, T6, T7>(Entity entity, ref T0 component0, ref T1 component1, ref T2 component2, ref T3 component3, ref T4 component4, ref T5 component5, ref T6 component6, ref T7 component7)
|
||||
where T0 : unmanaged, IComponent
|
||||
where T1 : unmanaged, IComponent
|
||||
where T2 : unmanaged, IComponent
|
||||
where T3 : unmanaged, IComponent
|
||||
where T4 : unmanaged, IComponent
|
||||
where T5 : unmanaged, IComponent
|
||||
where T6 : unmanaged, IComponent
|
||||
where T7 : unmanaged, IComponent;
|
||||
where T0 : unmanaged, IComponent where T1 : unmanaged, IComponent where T2 : unmanaged, IComponent where T3 : unmanaged, IComponent where T4 : unmanaged, IComponent where T5 : unmanaged, IComponent where T6 : unmanaged, IComponent where T7 : unmanaged, IComponent;
|
||||
|
||||
@@ -10,18 +10,18 @@ namespace Ghost.Entities;
|
||||
{
|
||||
var generics = AppendParameters(i, "T{0}");
|
||||
var compGenerics = AppendParameters(i, "ref T{0} component{0}");
|
||||
var restrictions = AppendGenericRestrictionsMultiline(i, "unmanaged, IComponent", 1);
|
||||
var restrictions = AppendGenericRestrictions(i, "unmanaged, IComponent");
|
||||
#>
|
||||
public delegate void ForEach<<#= generics #>>(<#= compGenerics #>)
|
||||
<#= restrictions #>;
|
||||
<#= restrictions #>;
|
||||
<# } #>
|
||||
|
||||
<# for (var i = 1; i <= Amount; i++)
|
||||
{
|
||||
var generics = AppendParameters(i, "T{0}");
|
||||
var compGenerics = AppendParameters(i, "ref T{0} component{0}");
|
||||
var restrictions = AppendGenericRestrictionsMultiline(i, "unmanaged, IComponent", 1);
|
||||
var restrictions = AppendGenericRestrictions(i, "unmanaged, IComponent");
|
||||
#>
|
||||
public delegate void ForEachWithEntity<<#= generics #>>(Entity entity, <#= compGenerics #>)
|
||||
<#= restrictions #>;
|
||||
<#= restrictions #>;
|
||||
<# } #>
|
||||
|
||||
@@ -144,4 +144,4 @@
|
||||
|
||||
return sb;
|
||||
}
|
||||
#>
|
||||
#>
|
||||
|
||||
Reference in New Issue
Block a user