public static void CopyWithIndex <T, TCopy>(NativeBufferArray <T> fromArr, ref NativeBufferArray <T> arr, TCopy copy) where TCopy : IArrayElementCopyWithIndex <T> where T : struct { if (fromArr.isCreated == false) { if (arr.isCreated == true) { NativeArrayUtils.RecycleWithIndex(ref arr, copy); } arr = NativeBufferArray <T> .Empty; return; } if (arr.isCreated == false || fromArr.Length != arr.Length) { if (arr.isCreated == true) { NativeArrayUtils.RecycleWithIndex(ref arr, copy); } arr = PoolArrayNative <T> .Spawn(fromArr.Length); } for (int i = 0; i < fromArr.Length; ++i) { copy.Copy(i, fromArr.arr[i], ref arr.arr.GetRef(i)); } }
public void Recycle(ref NativeBufferArray <T> value) { if (value != null) { value.Dispose(); } }
public static void Recycle(ref NativeBufferArray <T> buffer) { if (buffer.isCreated == true) { buffer.Dispose(); } buffer = NativeBufferArray <T> .Empty; }
public static void RecycleWithIndex <T, TCopy>(ref NativeBufferArray <T> item, TCopy copy) where TCopy : IArrayElementCopyWithIndex <T> where T : struct { for (int i = 0; i < item.Length; ++i) { copy.Recycle(i, ref item.arr.GetRef(i)); } item = item.Dispose(); }
public static void Recycle <T, TCopy>(ref NativeBufferArray <T> item, TCopy copy) where TCopy : IArrayElementCopy <T> where T : struct { for (int i = 0; i < item.Length; ++i) { copy.Recycle(item.arr[i]); } item = item.Dispose(); }
public static NativeBufferArray <T> Spawn(int length, bool realSize = false, Unity.Collections.Allocator allocator = Unity.Collections.Allocator.Persistent) { var arrSize = PoolArray <T> .GetSize(length); var arr = new Unity.Collections.NativeArray <T>(arrSize, allocator); var size = (realSize == true ? arr.Length : length); var buffer = new NativeBufferArray <T>(arr, length, realSize == true ? arr.Length : -1); NativeArrayUtils.Clear(buffer, 0, size); return(buffer); }
public static void Clear <T>(NativeBufferArray <T> arr, int index, int length) where T : struct { arr.Clear(index, length); }
public static void Clear <T>(NativeBufferArray <T> arr) where T : struct { arr.Clear(); }
public void Clone(NativeBufferArray <T> from, ref NativeBufferArray <T> to) { to = NativeBufferArray <T> .From(from); }
public void Set(NativeBufferArray <T> value) { this.dataObject.Set(value); }
public NativeDataBufferArray(NativeBufferArray <T> data) { this.dataObject = new DataObject <NativeBufferArray <T>, NativeDataBufferArrayProvider <T> >(data); this.Length = data.Length; }
public Enumerator(NativeBufferArray <T> bufferArray) { this.bufferArray = bufferArray; this.index = -1; }