Created
September 5, 2017 04:20
-
-
Save yoshitaka-xvi/47306adb930c806fd065c7aa8150ea03 to your computer and use it in GitHub Desktop.
Unity 2017.2.0b10で、Immersiveヘッドセット向け描画でNearClipとFarClipを変更するためのUnityコンポーネント
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class ProjectionMatrixSetter : MonoBehaviour { | |
Camera main; | |
[SerializeField] | |
float nearClip = 0.01f; | |
[SerializeField] | |
float farClip = 500.0f; | |
[SerializeField] | |
float fieldOfView = 102.0456f; | |
private void Start() { | |
main = Camera.main; | |
var projection = Matrix4x4.Perspective(fieldOfView, 1440.0f / 1440.0f, nearClip, farClip); | |
main.SetStereoProjectionMatrix(Camera.StereoscopicEye.Left, projection); | |
main.SetStereoProjectionMatrix(Camera.StereoscopicEye.Right, projection); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment