暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Surface.cs 883B

1234567891011121314151617181920212223242526272829303132333435
  1. using Unity.Collections;
  2. using Unity.Collections.LowLevel.Unsafe;
  3. using UnityEngine;
  4. namespace PDNWrapper
  5. {
  6. internal class Surface
  7. {
  8. NativeArray<Color32> m_Color;
  9. public Surface(int w, int h)
  10. {
  11. width = w;
  12. height = h;
  13. m_Color = new NativeArray<Color32>(width * height, Allocator.Persistent);
  14. }
  15. public void Dispose()
  16. {
  17. var handle = NativeArrayUnsafeUtility.GetAtomicSafetyHandle(m_Color);
  18. if (m_Color.IsCreated && AtomicSafetyHandle.IsHandleValid(handle))
  19. {
  20. m_Color.Dispose();
  21. m_Color = default;
  22. }
  23. }
  24. public NativeArray<Color32> color
  25. {
  26. get { return m_Color; }
  27. }
  28. public int width { get; private set; }
  29. public int height { get; private set; }
  30. }
  31. }