Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DecalChunk.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using Unity.Collections;
  3. using Unity.Jobs;
  4. using UnityEngine.Jobs;
  5. using UnityEngine.Rendering;
  6. namespace UnityEngine.Rendering.Universal
  7. {
  8. internal abstract class DecalChunk : IDisposable
  9. {
  10. public int count { get; protected set; }
  11. public int capacity { get; protected set; }
  12. public JobHandle currentJobHandle { get; set; }
  13. public virtual void Push() { count++; }
  14. public abstract void RemoveAtSwapBack(int index);
  15. public abstract void SetCapacity(int capacity);
  16. public virtual void Dispose() { }
  17. protected void ResizeNativeArray(ref TransformAccessArray array, DecalProjector[] decalProjectors, int capacity)
  18. {
  19. var newArray = new TransformAccessArray(capacity);
  20. if (array.isCreated)
  21. {
  22. for (int i = 0; i < array.length; ++i)
  23. newArray.Add(decalProjectors[i].transform);
  24. array.Dispose();
  25. }
  26. array = newArray;
  27. }
  28. protected void RemoveAtSwapBack<T>(ref NativeArray<T> array, int index, int count) where T : struct
  29. {
  30. array[index] = array[count - 1];
  31. }
  32. protected void RemoveAtSwapBack<T>(ref T[] array, int index, int count)
  33. {
  34. array[index] = array[count - 1];
  35. }
  36. }
  37. }