Guest User

Untitled

a guest
Oct 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. public class Framer : MonoBehaviour
  2. {
  3.     public Links links;
  4.     public Camera camera_in;
  5.     public Camera camera_preview;
  6.     public Material frameMat;
  7.     float offset = 0.002f;
  8.  
  9.     void OnPostRender()
  10.     {
  11.         if (camera_in.gameObject.active)
  12.             Draw(camera_in);
  13.         if (links.guiManager.onPreview && camera_preview.gameObject.active)
  14.             Draw(camera_preview);
  15.     }
  16.  
  17.     void Draw(Camera cam)
  18.     {
  19.         GL.PushMatrix();
  20.         frameMat.SetPass(0);
  21.         GL.LoadOrtho();
  22.         GL.Begin(GL.QUADS);
  23.         GL.Color(Color.white);
  24.  
  25.         GL.Vertex3(cam.rect.xMin - offset, cam.rect.yMin - offset, 0.3f);
  26.         GL.Vertex3(cam.rect.xMin - offset, cam.rect.yMax + offset, 0.3f);
  27.         GL.Vertex3(cam.rect.xMax + offset, cam.rect.yMax + offset, 0.3f);
  28.         GL.Vertex3(cam.rect.xMax + offset, cam.rect.yMin - offset, 0.3f);
  29.  
  30.         GL.End();
  31.         GL.PopMatrix();
  32.     }
  33. }
Add Comment
Please, Sign In to add comment