Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Framer : MonoBehaviour
- {
- public Links links;
- public Camera camera_in;
- public Camera camera_preview;
- public Material frameMat;
- float offset = 0.002f;
- void OnPostRender()
- {
- if (camera_in.gameObject.active)
- Draw(camera_in);
- if (links.guiManager.onPreview && camera_preview.gameObject.active)
- Draw(camera_preview);
- }
- void Draw(Camera cam)
- {
- GL.PushMatrix();
- frameMat.SetPass(0);
- GL.LoadOrtho();
- GL.Begin(GL.QUADS);
- GL.Color(Color.white);
- GL.Vertex3(cam.rect.xMin - offset, cam.rect.yMin - offset, 0.3f);
- GL.Vertex3(cam.rect.xMin - offset, cam.rect.yMax + offset, 0.3f);
- GL.Vertex3(cam.rect.xMax + offset, cam.rect.yMax + offset, 0.3f);
- GL.Vertex3(cam.rect.xMax + offset, cam.rect.yMin - offset, 0.3f);
- GL.End();
- GL.PopMatrix();
- }
- }
Add Comment
Please, Sign In to add comment