コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }