You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
707 B

//http://docs.unity3d.com/412/Documentation/ScriptReference/Camera.OnPreCull.html
using UnityEngine;
using System.Collections;
namespace Spout{
[RequireComponent (typeof(Camera))]
[ExecuteInEditMode]
public class InvertCamera : MonoBehaviour {
//public Camera camera;
void Start () {
//camera = get
}
void OnPreCull () {
GetComponent<Camera>().ResetWorldToCameraMatrix();
GetComponent<Camera>().ResetProjectionMatrix();
GetComponent<Camera>().projectionMatrix = GetComponent<Camera>().projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1));
}
void OnPreRender () {
GL.invertCulling = true;
}
void OnPostRender () {
GL.invertCulling = false;
}
}
}