예제 #1
0
    void SetTargetTex(Mojing.Eye eye)
    {
#if UNITY_EDITOR_OSX
#elif UNITY_EDITOR || UNITY_STANDALONE_WIN
        if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.OpenGL2 || SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.OpenGLCore)
        {
            switch (eye)
            {
            case Mojing.Eye.Left:
                CurrentCamera.targetTexture = Mojing.SDK.StereoScreen[Mojing.SDK.iFrameIndex * 2];
                break;

            case Mojing.Eye.Right:
                CurrentCamera.targetTexture = Mojing.SDK.StereoScreen[Mojing.SDK.iFrameIndex * 2 + 1];
                break;
            }
        }
        else
        {
            Debug.LogWarning("UNITY_EDITOR, current Graphics API is D3D, Please transfer to OpenGL");
        }
#else
        switch (eye)
        {
        case Mojing.Eye.Left:
            CurrentCamera.targetTexture = Mojing.SDK.StereoScreen[Mojing.SDK.iFrameIndex * 2];
            break;

        case Mojing.Eye.Right:
            CurrentCamera.targetTexture = Mojing.SDK.StereoScreen[Mojing.SDK.iFrameIndex * 2 + 1];
            break;
        }
#endif
    }
예제 #2
0
    void SetTargetTex(Mojing.Eye eye)
    {
        int iFrameIndex = 0;

        if (MojingSDK.Unity_IsATW_ON())
        {
            // Unity_ATW_GetModelFrameIndex 接口中自带睡眠代码
            iFrameIndex = MojingSDK.Unity_ATW_GetModelFrameIndex();
            MojingLog.LogTrace("Unity get iFrameIndex = " + iFrameIndex);
        }
        switch (eye)
        {
        case Mojing.Eye.Left:
            GetComponent <Camera>().targetTexture = MojingRender.StereoScreen[iFrameIndex * 2];
            MojingLog.LogTrace("Use Texture " + (iFrameIndex * 2) + " id = " + MojingRender.StereoScreen[iFrameIndex * 2].GetNativeTexturePtr());

            break;

        case Mojing.Eye.Right:
            GetComponent <Camera>().targetTexture = MojingRender.StereoScreen[iFrameIndex * 2 + 1];
            MojingLog.LogTrace("Use Texture " + (iFrameIndex * 2 + 1) + " id = " + MojingRender.StereoScreen[iFrameIndex * 2 + 1].GetNativeTexturePtr());
            break;
        }
    }