/// <summary> /// Connect to the FOVE Compositor system. This will hard reset the compositor connection even if there is /// already a valid connection. You could call this after a call to `DisconnectCompositor` if you found any /// significant reason to do so. /// </summary> public virtual bool ConnectCompositor() { if (_compositor == null) { SFVR_ClientInfo clientInfo; clientInfo.api = EFVR_GraphicsAPI.DirectX; switch (SystemInfo.graphicsDeviceType) { case Rendering.GraphicsDeviceType.Direct3D11: case Rendering.GraphicsDeviceType.Direct3D12: case Rendering.GraphicsDeviceType.Direct3D9: break; #if UNITY_5_4 case Rendering.GraphicsDeviceType.OpenGL2: #endif case Rendering.GraphicsDeviceType.OpenGLCore: case Rendering.GraphicsDeviceType.OpenGLES2: case Rendering.GraphicsDeviceType.OpenGLES3: clientInfo.api = EFVR_GraphicsAPI.OpenGL; break; default: Debug.LogError("Unrecognized device type, unable to grant compositor support: " + SystemInfo.graphicsDeviceType); break; } Debug.Log("Detected rendering api: " + clientInfo.api); // Create the compositor and submit layer at the same time _compositor = new FVRCompositor(); } var createInfo = new SFVR_CompositorLayerCreateInfo { alphaMode = EFVR_AlphaMode.Auto, disableDistortion = disableDistortion, disableFading = disableFading, disableTimewarp = disableTimewarp, type = layerType }; var err = _compositor.CreateLayer(createInfo, out _compositorLayer); if (err != EFVR_ErrorCode.None) { Debug.LogWarning("compositor could not get a layer: " + err); return(false); } Debug.Log("FOVE Compositor layer acquired: " + _compositorLayer.layerId); return(true); }
public FoveCameraPair(FVRCompositor compositor, FoveInterfaceBase xface) { left = null; right = null; var createInfo = new SFVR_CompositorLayerCreateInfo { alphaMode = EFVR_AlphaMode.Auto, disableDistortion = xface.DistortionDisabled, disableTimewarp = xface.TimewarpDisabled, disableFading = xface.FadingDisabled, type = xface.LayerType }; var err = compositor.CreateLayer(createInfo, out layer); if (err != EFVR_ErrorCode.None) { Debug.LogError("[FOVE] Error getting layer: " + err); } Debug.Log("[FOVE] Layer requested no distortion? " + createInfo.disableDistortion); }
/// <summary> /// Disconnect and destroy the underlying compositor system. This leaves your game in a state where no data is /// being sent on to the FOVE compositor. You might call this in situations where you want to disable VR, or if /// you know that another program will be trying to take control of the HMD's screen. If you want to reconnect, /// you would call `ConnectCompositor`. /// </summary> public virtual void DisconnectCompositor() { _compositor.DisconnectImmediately(); _compositor = null; }