expose some enumerable iterators on Renderer
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
73ea4568ab
commit
0a30dab3c2
|
@ -118,11 +118,21 @@ namespace Encompass
|
||||||
return Lookup<TComponent>().AllComponents();
|
return Lookup<TComponent>().AllComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<TComponent> AllAsEnumerable<TComponent>() where TComponent : struct
|
||||||
|
{
|
||||||
|
return Lookup<TComponent>().AllComponentsAsEnumerable();
|
||||||
|
}
|
||||||
|
|
||||||
public ReadOnlySpan<Entity> AllEntities<TComponent>() where TComponent : struct
|
public ReadOnlySpan<Entity> AllEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return Lookup<TComponent>().AllEntities();
|
return Lookup<TComponent>().AllEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Entity> AllEntitiesAsEnumerable<TComponent>() where TComponent : struct
|
||||||
|
{
|
||||||
|
return Lookup<TComponent>().AllEntitiesAsEnumerable();
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear<TComponent>() where TComponent : struct
|
public void Clear<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
Lookup<TComponent>().Clear();
|
Lookup<TComponent>().Clear();
|
||||||
|
|
|
@ -132,9 +132,19 @@ namespace Encompass
|
||||||
return new ReadOnlySpan<Entity>(_storageIndexToEntities, 0, _nextID);
|
return new ReadOnlySpan<Entity>(_storageIndexToEntities, 0, _nextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Entity> AllEntitiesAsEnumerable()
|
||||||
|
{
|
||||||
|
return new ArraySegment<Entity>(_storageIndexToEntities, 0, _nextID);
|
||||||
|
}
|
||||||
|
|
||||||
public ReadOnlySpan<TComponent> AllComponents()
|
public ReadOnlySpan<TComponent> AllComponents()
|
||||||
{
|
{
|
||||||
return new ReadOnlySpan<TComponent>(_components, 0, _nextID);
|
return new ReadOnlySpan<TComponent>(_components, 0, _nextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<TComponent> AllComponentsAsEnumerable()
|
||||||
|
{
|
||||||
|
return new ArraySegment<TComponent>(_components, 0, _nextID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,11 @@ namespace Encompass
|
||||||
return _existingComponentStore.AllEntities<TComponent>();
|
return _existingComponentStore.AllEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal IEnumerable<Entity> GetExistingEntitiesAsEnumerable<TComponent>() where TComponent : struct
|
||||||
|
{
|
||||||
|
return _existingComponentStore.AllEntitiesAsEnumerable<TComponent>();
|
||||||
|
}
|
||||||
|
|
||||||
internal ref readonly Entity ExistingSingularEntity<TComponent>() where TComponent : struct
|
internal ref readonly Entity ExistingSingularEntity<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return ref _existingComponentStore.SingularEntity<TComponent>();
|
return ref _existingComponentStore.SingularEntity<TComponent>();
|
||||||
|
@ -231,6 +236,11 @@ namespace Encompass
|
||||||
return _existingComponentStore.All<TComponent>();
|
return _existingComponentStore.All<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal IEnumerable<TComponent> GetComponentsByTypeEnumerable<TComponent>() where TComponent : struct
|
||||||
|
{
|
||||||
|
return _existingComponentStore.AllAsEnumerable<TComponent>();
|
||||||
|
}
|
||||||
|
|
||||||
internal ref readonly TComponent GetComponentByEntityAndType<TComponent>(int entityID) where TComponent : struct
|
internal ref readonly TComponent GetComponentByEntityAndType<TComponent>(int entityID) where TComponent : struct
|
||||||
{
|
{
|
||||||
return ref _existingComponentStore.Get<TComponent>(entityID);
|
return ref _existingComponentStore.Get<TComponent>(entityID);
|
||||||
|
|
|
@ -23,6 +23,11 @@ namespace Encompass
|
||||||
return _componentManager.GetExistingEntities<TComponent>();
|
return _componentManager.GetExistingEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IEnumerable<Entity> ReadEntitiesAsEnumerable<TComponent>() where TComponent : struct, IComponent
|
||||||
|
{
|
||||||
|
return _componentManager.GetExistingEntitiesAsEnumerable<TComponent>();
|
||||||
|
}
|
||||||
|
|
||||||
protected ref readonly Entity ReadEntity<TComponent>() where TComponent : struct, IComponent
|
protected ref readonly Entity ReadEntity<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
return ref _componentManager.ExistingSingularEntity<TComponent>();
|
return ref _componentManager.ExistingSingularEntity<TComponent>();
|
||||||
|
@ -33,6 +38,11 @@ namespace Encompass
|
||||||
return _componentManager.GetComponentsByType<TComponent>();
|
return _componentManager.GetComponentsByType<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IEnumerable<TComponent> ReadComponentsAsEnumerable<TComponent>() where TComponent : struct, IComponent
|
||||||
|
{
|
||||||
|
return _componentManager.GetComponentsByTypeEnumerable<TComponent>();
|
||||||
|
}
|
||||||
|
|
||||||
protected ref readonly TComponent ReadComponent<TComponent>() where TComponent : struct, IComponent
|
protected ref readonly TComponent ReadComponent<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
return ref _componentManager.ExistingSingular<TComponent>();
|
return ref _componentManager.ExistingSingular<TComponent>();
|
||||||
|
|
Loading…
Reference in New Issue