示例#1
0
 void OnPreCull()
 {
     if (!Cardboard.SDK.VRModeEnabled || !monoCamera.enabled)
     {
         // Keep stereo enabled flag in sync with parent mono camera.
         cam.enabled = false;
         return;
     }
     SetupStereo();
     if (!controller.directRender && Cardboard.SDK.StereoScreen != null)
     {
         // Some image effects clobber the whole screen.  Add a final image effect to the chain
         // which restores side-by-side stereo.
         stereoEffect = GetComponent <StereoRenderEffect>();
         if (stereoEffect == null)
         {
             stereoEffect = gameObject.AddComponent <StereoRenderEffect>();
         }
         stereoEffect.enabled = true;
     }
     else if (stereoEffect != null)
     {
         // Don't need the side-by-side image effect.
         stereoEffect.enabled = false;
     }
 }
示例#2
0
    void OnPreCull()
    {
        if (!GvrViewer.Instance.VRModeEnabled || !monoCamera.enabled)
        {
            // Keep stereo enabled flag in sync with parent mono camera.
            cam.enabled = false;
            return;
        }
        SetupStereo(/*forceUpdate=*/ false);
        bool doStereoEffect = GvrViewer.Instance.StereoScreen != null;

#if UNITY_IOS
        doStereoEffect &= !controller.directRender;
#endif  // UNITY_IOS
        if (doStereoEffect)
        {
            // Some image effects clobber the whole screen.  Add a final image effect to the chain
            // which restores side-by-side stereo.
            stereoEffect = GetComponent <StereoRenderEffect>();
            if (stereoEffect == null)
            {
                stereoEffect = gameObject.AddComponent <StereoRenderEffect>();
            }
            stereoEffect.enabled = true;
        }
        else if (stereoEffect != null)
        {
            // Don't need the side-by-side image effect.
            stereoEffect.enabled = false;
        }
    }
    void OnPreCull()
    {
        // cam.transform.position =new Vector3(0,Random.value/6,0);

        if (!NvrViewer.Instance.VRModeEnabled || !monoCamera.enabled)
        {
            // Keep stereo enabled flag in sync with parent mono camera.
            cam.enabled = false;
            return;
        }
        SetupStereo(/*forceUpdate=*/ false);
        int eyeType = eye == NvrViewer.Eye.Left ? 0 : 1;

        if (!NvrViewer.Instance.DirectRender && NvrViewer.Instance.GetStereoScreen(eyeType) != null)
        {
            // Some image effects clobber the whole screen.  Add a final image effect to the chain
            // which restores side-by-side stereo.
            stereoEffect = GetComponent <StereoRenderEffect>();
            if (stereoEffect == null)
            {
                stereoEffect = gameObject.AddComponent <StereoRenderEffect>();
            }
            stereoEffect.enabled = true;
        }
        else if (stereoEffect != null)
        {
            // Don't need the side-by-side image effect.
            stereoEffect.enabled = false;
        }
    }
示例#4
0
    void Start()
    {
        var ctlr = Controller;

        if (ctlr == null)
        {
            Debug.LogError("GvrEye must be child of a StereoController.");
            enabled = false;
            return;
        }
        // Save reference to the found controller and it's camera.
        controller = ctlr;
        monoCamera = controller.GetComponent <Camera>();

        SetupStereo(/*forceUpdate=*/ true);
        //disable stereo effect default
        stereoEffect = GetComponent <StereoRenderEffect>();
        if (stereoEffect)
        {
            stereoEffect.enabled = false;
        }
    }
示例#5
0
 void OnPreCull()
 {
     if (!GvrViewer.Instance.VRModeEnabled || !monoCamera.enabled) {
       // Keep stereo enabled flag in sync with parent mono camera.
       cam.enabled = false;
       return;
     }
     SetupStereo();
     if (!controller.directRender && GvrViewer.Instance.StereoScreen != null) {
       // Some image effects clobber the whole screen.  Add a final image effect to the chain
       // which restores side-by-side stereo.
       stereoEffect = GetComponent<StereoRenderEffect>();
       if (stereoEffect == null) {
     stereoEffect = gameObject.AddComponent<StereoRenderEffect>();
       }
       stereoEffect.enabled = true;
     } else if (stereoEffect != null) {
       // Don't need the side-by-side image effect.
       stereoEffect.enabled = false;
     }
 }