| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | 
							- using Unity.Collections;
 
- using Unity.Mathematics;
 
- using UnityEngine;
 
- namespace Core.BRG
 
- {
 
-     public class BatchShaderBind
 
-     {
 
-         public BRGShaderValue shaderValue;
 
-         public int offset;
 
-         private NativeArray<float4x4> _f4x4Buffer;
 
-         private NativeArray<float3x4> _f3x4Buffer;
 
-         private NativeArray<float4> _f4Buffer;
 
-         private NativeArray<float> _f1Buffer;
 
-         private int _count;
 
-         private int _size;
 
-         public int updateMinIndex;
 
-         public int updateMaxIndex;
 
-         public void InitBuffer(int count)
 
-         {
 
-             this._count = count;
 
-             _size = shaderValue.GetSize();
 
-             switch (shaderValue.ValueType)
 
-             {
 
-                 case BRGShaderValueType.F4X4:
 
-                     _f4x4Buffer = new NativeArray<float4x4>(count, Allocator.Persistent);
 
-                     break;
 
-                 case BRGShaderValueType.F3X4:
 
-                     _f3x4Buffer = new NativeArray<float3x4>(count, Allocator.Persistent);
 
-                     break;
 
-                 case BRGShaderValueType.F4:
 
-                     _f4Buffer = new NativeArray<float4>(count, Allocator.Persistent);
 
-                     break;
 
-                 case BRGShaderValueType.F1:
 
-                     _f1Buffer = new NativeArray<float>(count, Allocator.Persistent);
 
-                     break;
 
-             }
 
-         }
 
-         public void SetData(int index, float4 data)
 
-         {
 
-             _f4Buffer[index] = data;
 
-         }
 
-         public void SetData(int index, float4x4 data)
 
-         {
 
-             _f4x4Buffer[index] = data;
 
-         }
 
-         public void SetData(int index, float3x4 data)
 
-         {
 
-             _f3x4Buffer[index] = data;
 
-         }
 
-         public void SetData(int index, float data)
 
-         {
 
-             _f1Buffer[index] = data;
 
-         }
 
-         public void SetData(GraphicsBuffer graphicsBuffer,int maxCount)
 
-         {
 
-             // IitBuffer(graphicsBuffer.count);
 
-             switch (shaderValue.ValueType)
 
-             {
 
-                 case BRGShaderValueType.F4X4:
 
-                     graphicsBuffer.SetData(_f4x4Buffer, 0, offset / _size, maxCount);
 
-                     break;
 
-                 case BRGShaderValueType.F3X4:
 
-                     graphicsBuffer.SetData(_f3x4Buffer, 0, offset / _size, maxCount);
 
-                     break;
 
-                 case BRGShaderValueType.F4:
 
-                     graphicsBuffer.SetData(_f4Buffer, 0, offset / _size, maxCount);
 
-                     break;
 
-                 case BRGShaderValueType.F1:
 
-                     graphicsBuffer.SetData(_f1Buffer, 0, offset / _size, maxCount);
 
-                     break;
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |