VerticeComputeShader.compute 515 B

123456789101112131415161718
  1. // Each #kernel tells which function to compile; you can have many kernels
  2. #pragma kernel VerticesComputer
  3. // Create a RenderTexture with enableRandomWrite flag and set it
  4. // with cs.SetTexture
  5. RWStructuredBuffer<float3> Result;
  6. RWStructuredBuffer<float> InputArray;
  7. //int MemoryIndex;
  8. [numthreads(389,1,1)]
  9. void VerticesComputer(uint3 id : SV_DispatchThreadID)
  10. {
  11. int index = id.x * 3;
  12. Result[id.x].x = InputArray[index];
  13. Result[id.x].y = InputArray[index + 1];
  14. Result[id.x].z = -InputArray[index + 2];
  15. }