コード例 #1
0
ファイル: Pvr_UnitySDKEye.cs プロジェクト: zq47/EyeTracking
    /************************************ Private Interfaces  *********************************/
    #region Private Interfaces
    private void Setup(Eye eyeSide)
    {
        eyecamera = GetComponent <Camera>();
        if (eyeSide == Eye.LeftEye || eyeSide == Eye.RightEye)
        {
            transform.localPosition = Pvr_UnitySDKManager.SDK.EyeOffset(eyeSide);
        }
        else if (eyeSide == Eye.BothEye)
        {
            transform.localPosition = Vector3.zero;
        }
        eyecamera.aspect = Pvr_UnitySDKManager.SDK.EyesAspect;
        eyecamera.rect   = new Rect(0, 0, 1, 1);
#if UNITY_EDITOR
        eyecamera.rect = Pvr_UnitySDKManager.SDK.EyeRect(eyeSide);
#endif
        //  AW
        if (Pvr_UnitySDKManager.StereoRenderPath == StereoRenderingPathPico.MultiPass)
        {
            eventType = (eyeSide == Eye.LeftEye) ?
                        RenderEventType.LeftEyeEndFrame :
                        RenderEventType.RightEyeEndFrame;
        }
        else
        {
            eventType = RenderEventType.BothEyeEndFrame;
        }
    }
コード例 #2
0
    /************************************ Private Interfaces  *********************************/
    #region Private Interfaces
    private void Setup(Eye eye)
    {
        eyecamera = GetComponent <Camera>();
        transform.localPosition = Pvr_UnitySDKManager.SDK.EyeOffset(eye);
        eyecamera.aspect        = 1.0f;
        eyecamera.rect          = new Rect(0, 0, 1, 1);
#if UNITY_EDITOR
        eyecamera.rect = Pvr_UnitySDKManager.SDK.EyeRect(eye);
#endif

        //  AW

        if (Pvr_UnitySDKManager.SDK.IsViewerLogicFlow)
        {
            eyecamera.rect = Pvr_UnitySDKManager.SDK.EyeRect(eye);
            Rect left  = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
            Rect right = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
            if (eye == Eye.LeftEye)
            {
                eyecamera.rect = left;
            }
            else
            {
                eyecamera.rect = right;
            }
            eyecamera.fieldOfView = Pvr_UnitySDKManager.SDK.EyeFov;
        }
        //  AW
        eventType = (eye == Pvr_UnitySDKAPI.Eye.LeftEye) ?
                    RenderEventType.LeftEyeEndFrame :
                    RenderEventType.RightEyeEndFrame;
    }
コード例 #3
0
    public static void Issue(RenderEventType eventType)
    {
#if (UNITY_ANDROID && !UNITY_EDITOR)
        GL.IssuePluginEvent(EncodeType((int)eventType));
#else
        GL.IssuePluginEvent((int)eventType);
#endif
    }
コード例 #4
0
    /// <summary>
    /// Issues Camera EndFrame Plugin Event
    /// </summary>
    public void CameraEndFrame(RenderEventType eventType)
    {
        int offs  = (eventType == RenderEventType.LeftEyeEndFrame) ? 0 : 1;
        int texId = CameraTextureIds[EyeBufferNum[CurrEyeBufferIdx] * 2 + offs];

        //Debug.Log( "CameraTextureId[ " + offs + "] = " + texId );
        OVRPluginEvent.IssueWithData(eventType, texId);
    }
コード例 #5
0
    /// <summary>

    /// <summary>
    /// Immediately issues the given event.
    /// </summary>
    public static void Issue(RenderEventType eventType)
    {
                #if IOS_DEVICE
        Pvr_UnitySDKAPI.Render.UnityRenderEventIOS((int)eventType, 0);
                #else
        GL.IssuePluginEvent(EncodeType((int)eventType));
                #endif
    }
コード例 #6
0
	public static void Issue( RenderEventType eventType )
	{
#if (UNITY_ANDROID && !UNITY_EDITOR)
		GL.IssuePluginEvent( EncodeType( (int)eventType ) );
#else
		GL.IssuePluginEvent( (int)eventType );
#endif
	}
コード例 #7
0
    public static void EndEye(OVREye eye, int eyeTextureId)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        RenderEventType eventType = (eye == OVREye.Left) ?
                                    RenderEventType.LeftEyeEndFrame :
                                    RenderEventType.RightEyeEndFrame;

        OVRPluginEvent.IssueWithData(eventType, eyeTextureId);
#endif
    }
コード例 #8
0
	/// <summary>
	/// Create a data channel through the single 32-bit integer we are given to
	/// communicate with the plugin.
	/// Split the 32-bit integer event data into two separate "send-two-bytes"
	/// plugin events. Then issue the explicit event that makes use of the data.
	/// </summary>
	public static void IssueWithData(RenderEventType eventType, int eventData)
	{
		// Encode and send-two-bytes of data
		GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 0));

		// Encode and send remaining two-bytes of data
		GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 1));

		// Explicit event that uses the data
		GL.IssuePluginEvent(EncodeType((int)eventType));
	}
コード例 #9
0
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="eventData"></param>
    public static void IssueWithData(RenderEventType eventType, int eventData)
    {
        // Encode and send-two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 0));

        // Encode and send remaining two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 1));

        // Explicit event that uses the data
        GL.IssuePluginEvent(EncodeType((int)eventType));
    }
コード例 #10
0
    /************************************ Private Interfaces  *********************************/
    #region Private Interfaces
    private void Setup(Eye eye)
    {
        eyecamera = GetComponent <Camera>();
        transform.localPosition = Pvr_UnitySDKManager.SDK.EyeOffset(eye);
        eyecamera.aspect        = 1.0f;
        eyecamera.rect          = new Rect(0, 0, 1, 1);
#if UNITY_EDITOR
        eyecamera.rect = Pvr_UnitySDKManager.SDK.EyeRect(eye);
#endif
        eventType = (eye == Pvr_UnitySDKAPI.Eye.LeftEye) ?
                    RenderEventType.LeftEyeEndFrame :
                    RenderEventType.RightEyeEndFrame;
    }
コード例 #11
0
	// Create a data channel through the single 32-bit integer we are given to
	// communicate with the plugin.
	// Split the 32-bit integer event data into two separate "send-two-bytes"
	// plugin events. Then issue the explicit event that makes use of the data.
	public static void IssueWithData( RenderEventType eventType, int eventData )
	{
#if (UNITY_ANDROID && !UNITY_EDITOR)
		// Encode and send-two-bytes of data
		GL.IssuePluginEvent( EncodeData( (int)eventType, eventData, 0 ) );

		// Encode and send remaining two-bytes of data
		GL.IssuePluginEvent( EncodeData( (int)eventType, eventData, 1 ) );

		// Explicit event that uses the data
		GL.IssuePluginEvent( EncodeType( (int)eventType ) );
#else
		GL.IssuePluginEvent( (int)eventType );
#endif
	}
コード例 #12
0
    void OnPostRender()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        DrawVignetteLine();
        RenderEventType eventType = (eye == PicoVRManager.Eye.LeftEye) ?
                                    RenderEventType.LeftEyeEndFrame :
                                    RenderEventType.RightEyeEndFrame;
        int eyeTextureId = PicoVRManager.SDK.currentDevice.eyeTextureIds[PicoVRManager.SDK.currentDevice.currEyeTextureIdx + (int)eye * bufferSize];

        PVRPluginEvent.IssueWithData(eventType, eyeTextureId);
    }
コード例 #13
0
    // Create a data channel through the single 32-bit integer we are given to
    // communicate with the plugin.
    // Split the 32-bit integer event data into two separate "send-two-bytes"
    // plugin events. Then issue the explicit event that makes use of the data.
    public static void IssueWithData(RenderEventType eventType, int eventData)
    {
#if (UNITY_ANDROID && !UNITY_EDITOR)
        // Encode and send-two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 0));

        // Encode and send remaining two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 1));

        // Explicit event that uses the data
        GL.IssuePluginEvent(EncodeType((int)eventType));
#else
        GL.IssuePluginEvent((int)eventType);
#endif
    }
コード例 #14
0
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="eventData"></param>
    public static void IssueWithData(RenderEventType eventType, int eventData)
    {
                #if IOS_DEVICE
        Pvr_UnitySDKAPI.Render.UnityRenderEventIOS((int)eventType, eventData);
                #else
        // Encode and send-two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 0));

        // Encode and send remaining two-bytes of data
        GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 1));

        // Explicit event that uses the data
        GL.IssuePluginEvent(EncodeType((int)eventType));
                #endif
    }
コード例 #15
0
    void OnPostRender()
    {
        if (NvrViewer.USE_DTR && NvrGlobal.supportDtr)
        {
            // 左右眼绘制结束
            RenderEventType eventType = eye == NvrViewer.Eye.Left ?  RenderEventType.LeftEyeEndFrame :  RenderEventType.RightEyeEndFrame;
            // 左右眼绘制结束事件
            // int eyeTextureId = (int)cam.targetTexture.GetNativeTexturePtr();
            if (cacheTextureId == -1)
            {
                cacheTextureId = (int)cam.targetTexture.GetNativeTexturePtr();
            }
            NvrPluginEvent.IssueWithData(eventType, cacheTextureId);
        }

        if (NvrViewer.USE_DTR)
        {
            NvrViewer.Instance.EnterVRMode();
        }

        Shader.DisableKeyword("NVR_DISTORTION");
    }
コード例 #16
0
    IEnumerator EndOfFrame()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

#if !UNITY_EDITOR
            if (!Pvr_UnitySDKManager.SDK.isEnterVRMode)
            {
                // Call GL.clear before Enter VRMode to avoid unexpected graph breaking.
                GL.Clear(false, true, Color.black);
            }
#endif
            if (isFirstStartup && frameNum == this.WaitSplashScreenFrames)
            {
                Pvr_UnitySDKAPI.System.UPvr_RemovePlatformLogo();
                Pvr_UnitySDKAPI.System.UPvr_StartVRModel();
                isFirstStartup = false;
            }
            else if (isFirstStartup && frameNum < this.WaitSplashScreenFrames)
            {
                Debug.Log("+++++++++++++++++++++++++++++++" + frameNum);
                frameNum++;
            }

            #region Eyebuffer
#if UNITY_2018_1_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null)
            {
                for (int i = 0; i < Eyes.Length; i++)
                {
                    if (!Eyes[i].isActiveAndEnabled)
                    {
                        continue;
                    }

                    switch (Eyes[i].eyeSide)
                    {
                    case Pvr_UnitySDKAPI.Eye.LeftEye:
                        eyeTextureId      = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx];
                        eventType         = RenderEventType.LeftEyeEndFrame;
                        boundaryEventType = RenderEventType.BoundaryRenderLeft;
                        break;

                    case Pvr_UnitySDKAPI.Eye.RightEye:
                        if (!Pvr_UnitySDKManager.SDK.Monoscopic)
                        {
                            eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx + 3];
                        }
                        else
                        {
                            eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx];
                        }
                        eventType         = RenderEventType.RightEyeEndFrame;
                        boundaryEventType = RenderEventType.BoundaryRenderRight;
                        break;

                    default:
                        break;
                    }

                    // eyebuffer
                    Pvr_UnitySDKPluginEvent.IssueWithData(eventType, eyeTextureId);
                    // boundary
                    if (!Pvr_UnitySDKManager.SDK.HmdOnlyrot)
                    {
                        Pvr_UnitySDKPluginEvent.IssueWithData(boundaryEventType, Pvr_UnitySDKManager.SDK.RenderviewNumber);
                    }
                    Pvr_UnitySDKPluginEvent.Issue(RenderEventType.EndEye);
                }
            }
#endif
            #endregion


            // Compositor Layers: if find Overlay then Open Compositor Layers feature
            #region Compositor Layers
            if (Pvr_UnitySDKEyeOverlay.Instances.Count > 0)
            {
                overlayLayerDepth  = 1;
                underlayLayerDepth = 0;

                Pvr_UnitySDKEyeOverlay.Instances.Sort();
                for (int i = 0; i < Overlays.Length; i++)
                {
                    if (!Overlays[i].isActiveAndEnabled)
                    {
                        continue;
                    }
                    if (Overlays[i].layerTextures[0] == null && Overlays[i].layerTextures[1] == null)
                    {
                        continue;
                    }
                    if (Overlays[i].layerTransform != null && !Overlays[i].layerTransform.gameObject.activeSelf)
                    {
                        continue;
                    }

                    if (Overlays[i].imageType == Pvr_UnitySDKEyeOverlay.ImageType.StandardTexture)
                    {
                        if (Overlays[i].overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Overlay)
                        {
                            isHeadLocked = false;
                            if (Overlays[i].layerTransform != null && Overlays[i].layerTransform.parent == this.transform)
                            {
                                isHeadLocked = true;
                            }

                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, Overlays[i].layerTextureIds[0], (int)Pvr_UnitySDKAPI.Eye.LeftEye, overlayLayerDepth, isHeadLocked, Overlays[i].MVMatrixs[0]);
                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, Overlays[i].layerTextureIds[1], (int)Pvr_UnitySDKAPI.Eye.RightEye, overlayLayerDepth, isHeadLocked, Overlays[i].MVMatrixs[1]);

                            overlayLayerDepth++;
                        }
                        else if (Overlays[i].overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Underlay)
                        {
                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, Overlays[i].layerTextureIds[0], (int)Pvr_UnitySDKAPI.Eye.LeftEye, underlayLayerDepth, false, Overlays[i].MVMatrixs[0]);
                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, Overlays[i].layerTextureIds[1], (int)Pvr_UnitySDKAPI.Eye.RightEye, underlayLayerDepth, false, Overlays[i].MVMatrixs[1]);

                            underlayLayerDepth++;
                        }
                    }
                    else if (Overlays[i].imageType == Pvr_UnitySDKEyeOverlay.ImageType.EquirectangularTexture)
                    {
                        // 360 Overlay Equirectangular Texture
                        Pvr_UnitySDKAPI.Render.UPvr_SetupLayerData(0, (int)Pvr_UnitySDKAPI.Eye.LeftEye, Overlays[i].layerTextureIds[0], (int)Overlays[i].imageType, 0);
                        Pvr_UnitySDKAPI.Render.UPvr_SetupLayerData(0, (int)Pvr_UnitySDKAPI.Eye.RightEye, Overlays[i].layerTextureIds[1], (int)Overlays[i].imageType, 0);
                    }
                }
                #endregion
            }


            // Begin TimeWarp
            Pvr_UnitySDKPluginEvent.IssueWithData(RenderEventType.TimeWarp, Pvr_UnitySDKManager.SDK.RenderviewNumber);
            Pvr_UnitySDKManager.SDK.currEyeTextureIdx = Pvr_UnitySDKManager.SDK.nextEyeTextureIdx;
            Pvr_UnitySDKManager.SDK.nextEyeTextureIdx = (Pvr_UnitySDKManager.SDK.nextEyeTextureIdx + 1) % 3;
        }
    }
コード例 #17
0
	/// <summary>
	/// Immediately issues the given event.
	/// </summary>
	public static void Issue(RenderEventType eventType)
	{
		GL.IssuePluginEvent(EncodeType((int)eventType));
	}
コード例 #18
0
    IEnumerator EndOfFrame()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

#if !UNITY_EDITOR
            if (!Pvr_UnitySDKManager.SDK.isEnterVRMode)
            {
                // Call GL.clear before Enter VRMode to avoid unexpected graph breaking.
                GL.Clear(false, true, Color.black);
            }
#endif
            if (isFirstStartup && frameNum == this.WaitSplashScreenFrames)
            {
                Pvr_UnitySDKAPI.System.UPvr_RemovePlatformLogo();
                if (Pvr_UnitySDKManager.SDK.ResetTrackerOnLoad)
                {
                    Debug.Log("Reset Tracker OnLoad");
                    Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 1);
                }

                Pvr_UnitySDKAPI.System.UPvr_StartVRModel();
                isFirstStartup = false;
            }
            else if (isFirstStartup && frameNum < this.WaitSplashScreenFrames)
            {
                PLOG.I("frameNum:" + frameNum);
                frameNum++;
            }

            #region Eyebuffer
#if UNITY_2018_1_OR_NEWER && !UNITY_2019_1_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null)
            {
                for (int i = 0; i < Eyes.Length; i++)
                {
                    if (!Eyes[i].isActiveAndEnabled || !Eyes[i].eyecamera.enabled)
                    {
                        continue;
                    }

                    switch (Eyes[i].eyeSide)
                    {
                    case Pvr_UnitySDKAPI.Eye.LeftEye:
                        eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx];
                        eventType    = RenderEventType.LeftEyeEndFrame;
                        break;

                    case Pvr_UnitySDKAPI.Eye.RightEye:
                        if (!Pvr_UnitySDKManager.SDK.Monoscopic)
                        {
                            eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx + 3];
                        }
                        else
                        {
                            eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx];
                        }
                        eventType = RenderEventType.RightEyeEndFrame;
                        break;

                    case Pvr_UnitySDKAPI.Eye.BothEye:
                        eyeTextureId = Pvr_UnitySDKManager.SDK.eyeTextureIds[Pvr_UnitySDKManager.SDK.currEyeTextureIdx];
                        eventType    = RenderEventType.BothEyeEndFrame;
                        break;

                    default:
                        break;
                    }

                    // eyebuffer
                    Pvr_UnitySDKAPI.System.UPvr_UnityEventData(Pvr_UnitySDKAPI.System.UPvr_GetEyeBufferData(eyeTextureId));;
                    Pvr_UnitySDKPluginEvent.Issue(eventType);

                    Pvr_UnitySDKPluginEvent.Issue(RenderEventType.EndEye);
                }
            }
#endif
            #endregion

            // Compositor Layers: if find Overlay then Open Compositor Layers feature
            #region Compositor Layers
            int boundaryState = BoundarySystem.UPvr_GetSeeThroughState();
            if (Pvr_UnitySDKEyeOverlay.Instances.Count > 0 && boundaryState != 2)
            {
                overlayLayerDepth  = 1;
                underlayLayerDepth = 0;

                Pvr_UnitySDKEyeOverlay.Instances.Sort();
                for (int i = 0; i < Overlays.Length; i++)
                {
                    if (!Overlays[i].isActiveAndEnabled)
                    {
                        continue;
                    }
                    if (Overlays[i].layerTextures[0] == null && Overlays[i].layerTextures[1] == null && !Overlays[i].isExternalAndroidSurface)
                    {
                        continue;
                    }
                    if (Overlays[i].layerTransform != null && !Overlays[i].layerTransform.gameObject.activeSelf)
                    {
                        continue;
                    }

                    layerFlags = 0;

                    if (Overlays[i].overlayShape == Pvr_UnitySDKEyeOverlay.OverlayShape.Quad || Overlays[i].overlayShape == Pvr_UnitySDKEyeOverlay.OverlayShape.Cylinder)
                    {
                        if (Overlays[i].overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Overlay)
                        {
                            isHeadLocked = false;
                            if (Overlays[i].layerTransform != null && Overlays[i].layerTransform.parent == this.transform)
                            {
                                isHeadLocked = true;
                            }

                            // external surface
                            if (Overlays[i].isExternalAndroidSurface)
                            {
                                layerFlags = 1;
                                this.CreateExternalSurface(Overlays[i], overlayLayerDepth);
                            }

                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, (int)Overlays[i].overlayShape, Overlays[i].layerTextureIds[0], (int)Pvr_UnitySDKAPI.Eye.LeftEye, overlayLayerDepth, isHeadLocked, layerFlags, Overlays[i].MVMatrixs[0],
                                                                                  Overlays[i].ModelScales[0], Overlays[i].ModelRotations[0], Overlays[i].ModelTranslations[0], Overlays[i].CameraRotations[0], Overlays[i].CameraTranslations[0], Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());

                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, (int)Overlays[i].overlayShape, Overlays[i].layerTextureIds[1], (int)Pvr_UnitySDKAPI.Eye.RightEye, overlayLayerDepth, isHeadLocked, layerFlags, Overlays[i].MVMatrixs[1],
                                                                                  Overlays[i].ModelScales[1], Overlays[i].ModelRotations[1], Overlays[i].ModelTranslations[1], Overlays[i].CameraRotations[1], Overlays[i].CameraTranslations[1], Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());

                            overlayLayerDepth++;
                        }
                        else if (Overlays[i].overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Underlay)
                        {
                            // external surface
                            if (Overlays[i].isExternalAndroidSurface)
                            {
                                layerFlags = 1;
                                this.CreateExternalSurface(Overlays[i], underlayLayerDepth);
                            }

                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, (int)Overlays[i].overlayShape, Overlays[i].layerTextureIds[0], (int)Pvr_UnitySDKAPI.Eye.LeftEye, underlayLayerDepth, false, layerFlags, Overlays[i].MVMatrixs[0],
                                                                                  Overlays[i].ModelScales[0], Overlays[i].ModelRotations[0], Overlays[i].ModelTranslations[0], Overlays[i].CameraRotations[0], Overlays[i].CameraTranslations[0], Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());

                            Pvr_UnitySDKAPI.Render.UPvr_SetOverlayModelViewMatrix((int)Overlays[i].overlayType, (int)Overlays[i].overlayShape, Overlays[i].layerTextureIds[1], (int)Pvr_UnitySDKAPI.Eye.RightEye, underlayLayerDepth, false, layerFlags, Overlays[i].MVMatrixs[1],
                                                                                  Overlays[i].ModelScales[1], Overlays[i].ModelRotations[1], Overlays[i].ModelTranslations[1], Overlays[i].CameraRotations[1], Overlays[i].CameraTranslations[1], Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());

                            underlayLayerDepth++;
                        }
                    }
                    else if (Overlays[i].overlayShape == Pvr_UnitySDKEyeOverlay.OverlayShape.Equirect)
                    {
                        // external surface
                        if (Overlays[i].isExternalAndroidSurface)
                        {
                            layerFlags = 1;
                            this.CreateExternalSurface(Overlays[i], 0);
                        }

                        // 360 Overlay Equirectangular Texture
                        Pvr_UnitySDKAPI.Render.UPvr_SetupLayerData(0, (int)Pvr_UnitySDKAPI.Eye.LeftEye, Overlays[i].layerTextureIds[0], (int)Overlays[i].overlayShape, layerFlags, Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());
                        Pvr_UnitySDKAPI.Render.UPvr_SetupLayerData(0, (int)Pvr_UnitySDKAPI.Eye.RightEye, Overlays[i].layerTextureIds[1], (int)Overlays[i].overlayShape, layerFlags, Overlays[i].GetLayerColorScale(), Overlays[i].GetLayerColorOffset());
                    }
                }
                #endregion
            }

            // Begin TimeWarp
            //Pvr_UnitySDKPluginEvent.IssueWithData(RenderEventType.TimeWarp, Pvr_UnitySDKManager.SDK.RenderviewNumber);
            Pvr_UnitySDKAPI.System.UPvr_UnityEventData(Pvr_UnitySDKAPI.System.UPvr_GetEyeBufferData(0));
            Pvr_UnitySDKPluginEvent.Issue(RenderEventType.TimeWarp);
            Pvr_UnitySDKManager.SDK.currEyeTextureIdx = Pvr_UnitySDKManager.SDK.nextEyeTextureIdx;
            Pvr_UnitySDKManager.SDK.nextEyeTextureIdx = (Pvr_UnitySDKManager.SDK.nextEyeTextureIdx + 1) % 3;
        }
    }
コード例 #19
0
	/// <summary>
	/// Issues Camera EndFrame Plugin Event
	/// </summary>
	public void CameraEndFrame( RenderEventType eventType )
	{
		int offs = (eventType == RenderEventType.LeftEyeEndFrame) ? 0 : 1;
		int texId = CameraTextureIds[EyeBufferNum[CurrEyeBufferIdx] * 2 + offs];
		//Debug.Log( "CameraTextureId[ " + offs + "] = " + texId );
		OVRPluginEvent.IssueWithData( eventType, texId );
	}
コード例 #20
0
    /// <summary>
    /// Immediately issues the given event.
    /// </summary>
    public static void Issue(RenderEventType eventType)
    {
#if ANDROID_DEVICE
        GL.IssuePluginEvent(Pvr_UnitySDKAPI.System.GetRenderEventFunc(), (int)eventType);
#endif
    }
コード例 #21
0
 /// <summary>
 /// Immediately issues the given event.
 /// </summary>
 public static void Issue(RenderEventType eventType)
 {
     GL.IssuePluginEvent(EncodeType((int)eventType));
 }