Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Filter_Left(ref Texture2D source)
- {
- // If we haven't initialized our history buffer, do so.
- // Match the size/format of whatever render target
- // we were passed as a source.
- if (_historyPages == null)
- {
- _historyPages = new Texture2D[HISTORY_CAPACITY];
- for (int i = 0; i < HISTORY_CAPACITY; i++)
- {
- _historyPages[i] = new Texture2D(width, height);
- filterMaterialAssetLeft.SetTexture(_historyIDs[i], _historyPages[i]);
- }
- }
- filterMaterialAssetLeft.SetFloat(_dataDeltaID, dataDelta);
- filterMaterialAssetLeft.SetFloat("_blurRadius", _blurRadius);
- filterMaterialAssetLeft.SetFloat("_StandardDeviation", _StandardDeviation);
- Graphics.Blit(source, destination_left, filterMaterialAssetLeft);
- // Our source becomes the newest sample in our history.
- // (Or, if it's supposed to be your destination, use that instead).
- // The oldest history page takes its place as a new writable source texture.
- var newPage = source;
- source = _historyPages[_oldestPage];
- _historyPages[_oldestPage] = newPage;
- filterMaterialAssetLeft.SetTexture(_historyIDs[_oldestPage], newPage);
- _oldestPage = (_oldestPage + 1) % HISTORY_CAPACITY;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement