Esempio n. 1
0
    public void OnPreCull()
    {
/*
 *      if (!Mojing.SDK.NeedDistortion && Mojing.SDK.VRModeEnabled)
 *          CurrentCamera.projectionMatrix = CreateMatrix();
 *      else
 *          CurrentCamera.ResetProjectionMatrix();
 */
        if (Mojing.SDK.bWaitForMojingWord)
        {
            EnableEye(false);
            return;
        }
        if (CurrentCamera != null)
        {
            SetUpEye();
            // --madi--
            //mojing2 render directly
            if (!Mojing.SDK.NeedDistortion)
            {
                return;
            }
            SetTargetTex(eye);
        }
        else
        {
            MojingLog.LogError(eye.ToString() + ": no camera found.");
        }
    }
Esempio n. 2
0
    public void EnableEye(bool enable)
    {
        MojingLog.LogTrace("Enable Camera " + eye.ToString() + ": " + enable.ToString());
        enabled = enable;
        if (eye == Mojing.Eye.Left || eye == Mojing.Eye.Right)
        {
            // Setup FOV
            GetComponent <Camera>().fieldOfView = MojingSDK.Unity_GetGlassesFOV();

            //*****Solve the problem of splash screen when start up
            if (enable)
            {
                if (Mojing.SDK.NeedDistortion)
                {
#if UNITY_EDITOR_OSX
#elif UNITY_EDITOR || UNITY_STANDALONE_WIN
                    if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.OpenGL2)
                    {
                        SetTargetTex(eye);
                    }
#else
                    SetTargetTex(eye);
#endif
                }
                else
                {
                    GetComponent <Camera>().targetTexture = null;
                }
            }
            //*****
            if ((!Mojing.SDK.bWaitForMojingWord) && Mojing.SDK.VRModeEnabled && Mojing.SDK.NeedDistortion)
            {
                GetComponent <Camera>().enabled = false;
            }
            else
            {
                GetComponent <Camera>().enabled = enable;
            }
        }
        else
        {
            GetComponent <Camera>().enabled = enable;
        }
    }
Esempio n. 3
0
    public void EnableEye(bool enable)
    {
        MojingLog.LogTrace("Enable Camera " + eye.ToString() + ": " + enable.ToString());
        enabled = enable;
        if (eye == Mojing.Eye.Left || eye == Mojing.Eye.Right)
        {
            // Setup FOV
            GetComponent <Camera>().fieldOfView = MojingSDK.Unity_GetGlassesFOV();

            //*****Solve the problem of splash screen when start up
            if (enable)
            {
                if (Mojing.SDK.NeedDistortion)
                {
#if !UNITY_EDITOR
                    switch (eye)
                    {
                    case Mojing.Eye.Left:
                        GetComponent <Camera>().targetTexture = MojingRender.StereoScreen[0];
                        break;

                    case Mojing.Eye.Right:
                        GetComponent <Camera>().targetTexture = MojingRender.StereoScreen[1];
                        break;
                    }
#endif
                }
                else
                {
                    GetComponent <Camera>().targetTexture = null;
                }
            }
            //*****
        }
        GetComponent <Camera>().enabled = enable;
    }