/****************************************************************************************************\ * Private utility functions * \****************************************************************************************************/ private Camera SetupFoveViewCamera(float ipd, string identifier, out GameObject go) { GameObject temp = null; Camera cam = null; BarrelDistortion dist = null; if (eyePrototype == null) { temp = new GameObject(); cam = temp.AddComponent <Camera>(); dist = temp.AddComponent <BarrelDistortion>(); cam.backgroundColor = new Color(0.2f, 0.2f, 0.2f, 1.0f); cam.fieldOfView = 85.0f; cam.hdr = true; } else { FOVEEyeCamera ec = Instantiate(eyePrototype); dist = ec.GetComponent <BarrelDistortion>(); temp = dist.gameObject; cam = dist.GetComponent <Camera>(); } temp.name = string.Format("FOVE Eye ({0})", identifier); temp.transform.parent = transform; temp.transform.localPosition = new Vector3(ipd, eyeHeight, eyeForward); temp.transform.localRotation = UnityEngine.Quaternion.identity; //ShaderBlit sb = go.AddComponent<ShaderBlit> (); dist.right = identifier.ToLower().Contains("right"); go = temp; return(cam); }
public void SetFovRadius(float dist) { fovRadius = dist; foreach (GameObject cam in vrCamera) { BarrelDistortion barrel = cam.GetComponent <BarrelDistortion>(); barrel.enabled = true; barrel.FOV_Radians = fovRadius; } }