Advertisement
Guest User

PIXELBOY

a guest
Mar 31st, 2016
2,577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. //PIXELBOY BY @WTFMIG EAT A BUTT WORLD BAHAHAHAHA POOP MY PANTS
  2. // - edited by @Nothke to use screen height for #LOWREZJAM
  3. using UnityEngine;
  4. using System.Collections;
  5.  
  6. [ExecuteInEditMode]
  7. [AddComponentMenu("Image Effects/PixelBoy")]
  8. public class PixelBoy : MonoBehaviour
  9. {
  10.     public int h = 64;
  11.     int w;
  12.     protected void Start()
  13.     {
  14.         if (!SystemInfo.supportsImageEffects)
  15.         {
  16.             enabled = false;
  17.             return;
  18.         }
  19.     }
  20.     void Update()
  21.     {
  22.  
  23.         float ratio = ((float)Camera.main.pixelWidth) / (float)Camera.main.pixelHeight;
  24.         w = Mathf.RoundToInt(h * ratio);
  25.  
  26.     }
  27.     void OnRenderImage(RenderTexture source, RenderTexture destination)
  28.     {
  29.         source.filterMode = FilterMode.Point;
  30.         RenderTexture buffer = RenderTexture.GetTemporary(w, h, -1);
  31.         buffer.filterMode = FilterMode.Point;
  32.         Graphics.Blit(source, buffer);
  33.         Graphics.Blit(buffer, destination);
  34.         RenderTexture.ReleaseTemporary(buffer);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement