Advertisement
Guest User

Untitled

a guest
Nov 27th, 2020
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public void Filter_Left(ref Texture2D source)
  2. {
  3.  
  4.  
  5. // If we haven't initialized our history buffer, do so.
  6. // Match the size/format of whatever render target
  7. // we were passed as a source.
  8. if (_historyPages == null)
  9. {
  10. _historyPages = new Texture2D[HISTORY_CAPACITY];
  11. for (int i = 0; i < HISTORY_CAPACITY; i++)
  12. {
  13. _historyPages[i] = new Texture2D(width, height);
  14. filterMaterialAssetLeft.SetTexture(_historyIDs[i], _historyPages[i]);
  15.  
  16. }
  17. }
  18. filterMaterialAssetLeft.SetFloat(_dataDeltaID, dataDelta);
  19. filterMaterialAssetLeft.SetFloat("_blurRadius", _blurRadius);
  20. filterMaterialAssetLeft.SetFloat("_StandardDeviation", _StandardDeviation);
  21. Graphics.Blit(source, destination_left, filterMaterialAssetLeft);
  22.  
  23.  
  24. // Our source becomes the newest sample in our history.
  25. // (Or, if it's supposed to be your destination, use that instead).
  26. // The oldest history page takes its place as a new writable source texture.
  27. var newPage = source;
  28. source = _historyPages[_oldestPage];
  29. _historyPages[_oldestPage] = newPage;
  30. filterMaterialAssetLeft.SetTexture(_historyIDs[_oldestPage], newPage);
  31.  
  32. _oldestPage = (_oldestPage + 1) % HISTORY_CAPACITY;
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement