Chunk_T_.md
November 22, 2024 ยท View on GitHub
Friflo.Engine.ECS
Friflo.Engine.ECS
Chunk Struct
A Chunk<T> is container of struct components of Type T.
public readonly struct Chunk<T>
where T : struct, System.ValueType, System.ValueType
Type parameters
T
IComponent type of a struct component.
Remarks
Chunk<T>'s are typically returned a ArchetypeQuery<T1>.Chunks enumerator.
Its items can be accessed or changed with this[int] or Span.
The Chunk<T> implementation also support vectorization
of Vector types
by AsSpan128<TTo>(), AsSpan256<TTo>() and AsSpan512<TTo>().
See vectorization example at AsSpan256<TTo>().
| Fields | |
|---|---|
| ArchetypeComponents | |
| Length | Return the number of components in a Chunk<T>. |
| Properties | |
|---|---|
| Span | Return the components in a Chunk<T> as a Span. |
| StepSpan128 | The step value in a for loop when converting a AsSpan128<TTo>() value to a Vector128{T}. See example at AsSpan256<TTo>(). |
| StepSpan256 | The step value in a for loop when converting a AsSpan256<TTo>() value to a Vector256{T}. See example at AsSpan256<TTo>(). |
| StepSpan512 | The step value in a for loop when converting a AsSpan512<TTo>() value to a Vector512{T}See example at AsSpan256<TTo>(). |
| this[int] | Return the component at the passed index as a reference. |
| Methods | |
|---|---|
| AsSpan128<TTo>() | Return the components as a System.Span<> of type TTo. The returned System.Span<> contains padding elements on its tail to enable assignment to Vector128{TTo}. See Example.. |
| AsSpan256<TTo>() | Return the components as a System.Span<> of type TTo - which can be assigned to Vector256{TTo}'s. The returned System.Span<> contains padding elements on its tail to enable safe conversion to a Vector256{TTo}. See Example.. |
| AsSpan512<TTo>() | Return the components as a System.Span<> of type TTo. The returned System.Span<> contains padding elements on its tail to enable assignment to Vector512. See Example.. |
| ToString() |