Mirror of Svelto.ECS because we're a fan of it
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.

88 lines
2.8KB

  1. namespace Svelto.ECS
  2. {
  3. public readonly struct BT<BufferT1, BufferT2, BufferT3, BufferT4>
  4. {
  5. public readonly BufferT1 buffer1;
  6. public readonly BufferT2 buffer2;
  7. public readonly BufferT3 buffer3;
  8. public readonly BufferT4 buffer4;
  9. public readonly int count;
  10. BT(in (BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, BufferT4 bufferT4, int count) buffer) :
  11. this()
  12. {
  13. buffer1 = buffer.bufferT1;
  14. buffer2 = buffer.bufferT2;
  15. buffer3 = buffer.bufferT3;
  16. buffer4 = buffer.bufferT4;
  17. count = buffer.count;
  18. }
  19. public static implicit operator BT<BufferT1, BufferT2, BufferT3, BufferT4>(
  20. in (BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, BufferT4 bufferT4, int count) buffer)
  21. {
  22. return new BT<BufferT1, BufferT2, BufferT3, BufferT4>(buffer);
  23. }
  24. }
  25. public readonly struct BT<BufferT1, BufferT2, BufferT3>
  26. {
  27. public readonly BufferT1 buffer1;
  28. public readonly BufferT2 buffer2;
  29. public readonly BufferT3 buffer3;
  30. public readonly int count;
  31. BT(in (BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, int count) buffer) : this()
  32. {
  33. buffer1 = buffer.bufferT1;
  34. buffer2 = buffer.bufferT2;
  35. buffer3 = buffer.bufferT3;
  36. count = buffer.count;
  37. }
  38. public static implicit operator BT<BufferT1, BufferT2, BufferT3>(
  39. in (BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, int count) buffer)
  40. {
  41. return new BT<BufferT1, BufferT2, BufferT3>(buffer);
  42. }
  43. }
  44. public readonly struct BT<BufferT1>
  45. {
  46. public readonly BufferT1 buffer;
  47. public readonly int count;
  48. BT(in (BufferT1 bufferT1, int count) buffer) : this()
  49. {
  50. this.buffer = buffer.bufferT1;
  51. count = buffer.count;
  52. }
  53. public static implicit operator BT<BufferT1>(in (BufferT1 bufferT1, int count) buffer)
  54. {
  55. return new BT<BufferT1>(buffer);
  56. }
  57. public static implicit operator BufferT1(BT<BufferT1> t) => t.buffer;
  58. }
  59. public readonly struct BT<BufferT1, BufferT2>
  60. {
  61. public readonly BufferT1 buffer1;
  62. public readonly BufferT2 buffer2;
  63. public readonly int count;
  64. BT(in (BufferT1 bufferT1, BufferT2 bufferT2, int count) buffer) : this()
  65. {
  66. buffer1 = buffer.bufferT1;
  67. buffer2 = buffer.bufferT2;
  68. count = buffer.count;
  69. }
  70. public static implicit operator BT<BufferT1, BufferT2>(
  71. in (BufferT1 bufferT1, BufferT2 bufferT2, int count) buffer)
  72. {
  73. return new BT<BufferT1, BufferT2>(buffer);
  74. }
  75. }
  76. }