public override bool RefreshSetup() { #if UNITY_2017_2_OR_NEWER if (!XRSettings.enabled) #else if (!VRSettings.enabled) #endif { Debug.LogError("FoveInterface2 requires VR to be enabled in project settings to work correctly."); } if (!base.RefreshSetup()) { return(false); } if (!_isAuthoritative) { return(true); } if (_camera == null) { _camera = GetComponent <Camera>(); } if (!ConnectCompositor()) { return(false); } _idealResolution = _compositorLayer.idealResolutionPerEye; _desiredRenderHeight = (int)(_idealResolution.y * oversamplingRatio); _needsResolutionUpdate = true; _layerSubmitInfo.left.bounds = new SFVR_TextureBounds { left = 0, right = 1, top = 1, bottom = 0 }; _layerSubmitInfo.right.bounds = new SFVR_TextureBounds { left = 0, right = 1, top = 1, bottom = 0 }; _layerSubmitInfo.layerId = _compositorLayer.layerId; return(true); }
void Start() { _headset = FoveInterfaceBase.GetFVRHeadset(); _lastScale = resolutionScale; _lastAA = antiAliasing; FoveCameraPair myPair = GetNextLayerPair(whichEye, this); myPair.SetCamera(whichEye, this); SFVR_CompositorLayer layer = myPair.layer; SFVR_Vec2i res = layer.idealResolutionPerEye; var rt = new RenderTexture((int)(res.x * resolutionScale), (int)(res.y * resolutionScale), 24); rt.antiAliasing = antiAliasing; _cam = gameObject.GetComponent <Camera>(); _cam.targetTexture = rt; _cam.enabled = false; switch (whichEye) { case EFVR_Eye.Left: SetSubmitBounds(ref _layerSubmitInfo.left); _layerSubmitInfo.left.texInfo.colorSpace = EFVR_ColorSpace.Linear; break; case EFVR_Eye.Right: SetSubmitBounds(ref _layerSubmitInfo.right); _layerSubmitInfo.left.texInfo.colorSpace = EFVR_ColorSpace.Linear; break; } _layerSubmitInfo.layerId = myPair.layer.layerId; }