Advertisement
Guest User

Untitled

a guest
Apr 18th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. void calculatevalid(){
  2. for (int i = 0; i < curp.Length; i++) //10ms !
  3. {
  4. if(curp[i].pos.z != 1000){
  5. validpos.Add(curp[i].pos);
  6. validcolor.Add(curp[i].color);
  7. }
  8. else{
  9. i += (int)curp[i].pos.x;
  10. }
  11.  
  12. if(i>curp.Length) break;
  13. }
  14. }
  15. void RunMain(AsyncGPUReadbackRequest r){
  16. //print("suc");
  17.  
  18.  
  19. //mp.GetComponent<TextMeshProUGUI>().text = (1f / Time.unscaledDeltaTime).ToString();
  20.  
  21.  
  22.  
  23. cg.SetInt("Size",size) ;
  24. camrel = Camera.main.transform.position + new Vector3(50,50,50);
  25. cg.SetFloats("Cameraposition",camrel.x,camrel.y,camrel.z) ;
  26. cg.SetBuffer(0,"Result",texpix);
  27. cg.SetBuffer(0,"ResultFinal",final);
  28. cg.SetBuffer(0,"Meta",meta);
  29. cg.Dispatch(0,size /8,size /8,size /8);
  30.  
  31.  
  32. validpos.Clear();
  33. validcolor.Clear();
  34.  
  35.  
  36. curp = r.GetData<voxel>();
  37. // print(curp.Length);
  38.  
  39.  
  40. readbackRequest = AsyncGPUReadback.Request(final,RunMain);
  41.  
  42.  
  43. thread1 = new Thread(calculatevalid);
  44. thread1.Start();
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement