Qualcomm_Snapdragon_VR_SDK SvrPluginAndroid脚本简介(12)

本文将介绍SvrPluginAndroid脚本中的Submit方法,该方法的作用是渲染左右眼图像,是SvrPlugin中VR模式实现的核心代码。

    public override void SubmitFrame(int frameIndex, float fieldOfView, int frameType)
	{
        int i;
        int eyeCount = 0;
        if (eyes != null) for (i = 0; i < eyes.Length; i++)
        {
            var eye = eyes[i];
            if (eyes[i].isActiveAndEnabled == false || eye.TextureId == 0 || eye.Side == 0) continue;
            if (eye.imageTransform != null && eye.imageTransform.gameObject.activeSelf == false) continue;
            SvrSetupLayerData(0, eyeCount, (int)eye.Side, eye.TextureId, eye.ImageType == SvrEye.eType.EglTexture ? 1 : 0);
            float[] lowerLeft = { eye.clipLowerLeft.x, eye.clipLowerLeft.y, eye.clipLowerLeft.z, eye.clipLowerLeft.w, eye.uvLowerLeft.x, eye.uvLowerLeft.y };
            float[] upperLeft = { eye.clipUpperLeft.x, eye.clipUpperLeft.y, eye.clipUpperLeft.z, eye.clipUpperLeft.w, eye.uvUpperLeft.x, eye.uvUpperLeft.y };
            float[] upperRight = { eye.clipUpperRight.x, eye.clipUpperRight.y, eye.clipUpperRight.z, eye.clipUpperRight.w, eye.uvUpperRight.x, eye.uvUpperRight.y };
            float[] lowerRight = { eye.clipLowerRight.x, eye.clipLowerRight.y, eye.clipLowerRight.z, eye.clipLowerRight.w, eye.uvLowerRight.x, eye.uvLowerRight.y };
            SvrSetupLayerCoords(0, eyeCount, lowerLeft, lowerRight, upperLeft, upperRight);
            eyeCount++;
        }
        for (i = eyeCount; i < SvrManager.EyeLayerMax; i++)
        {
            SvrSetupLayerData(0, i, 0, 0, 0);
        }

        int overlayCount = 0;
        if (overlays != null) for (i = 0; i < overlays.Length; i++)
        {
            var overlay = overlays[i];
            if (overlay.isActiveAndEnabled == false || overlay.TextureId == 0 || overlay.Side == 0) continue;
            if (overlay.imageTransform != null && overlay.imageTransform.gameObject.activeSelf == false) continue;
            SvrSetupLayerData(1, overlayCount, (int)overlay.Side, overlay.TextureId, overlay.ImageType == SvrOverlay.eType.EglTexture ? 1 : 0);
            float[] lowerLeft = { overlay.clipLowerLeft.x, overlay.clipLowerLeft.y, overlay.clipLowerLeft.z, overlay.clipLowerLeft.w, overlay.uvLowerLeft.x, overlay.uvLowerLeft.y };
            float[] upperLeft = { overlay.clipUpperLeft.x, overlay.clipUpperLeft.y, overlay.clipUpperLeft.z, overlay.clipUpperLeft.w, overlay.uvUpperLeft.x, overlay.uvUpperLeft.y };
            float[] upperRight = { overlay.clipUpperRight.x, overlay.clipUpperRight.y, overlay.clipUpperRight.z, overlay.clipUpperRight.w, overlay.uvUpperRight.x, overlay.uvUpperRight.y };
            float[] lowerRight = { overlay.clipLowerRight.x, overlay.clipLowerRight.y, overlay.clipLowerRight.z, overlay.clipLowerRight.w, overlay.uvLowerRight.x, overlay.uvLowerRight.y };
            SvrSetupLayerCoords(1, overlayCount, lowerLeft, lowerRight, upperLeft, upperRight); overlayCount++;
        }
        for (i = overlayCount; i < SvrManager.OverlayLayerMax; i++)
        {
            SvrSetupLayerData(1, i, 0, 0, 0);
        }

        SvrSubmitFrameEventData(frameIndex, fieldOfView, frameType);
		IssueEvent (RenderEvent.SubmitFrame);
	}

首先先看该方法传入的参数。

frameIndex表示当前程序运行的帧数。

fieldOfView表示当前左右眼Camera的fov参数。

frameType表示当前帧类型。

在这个方法中首先遍历了eyes数据。

eyes数组在前几篇文章中已经提到的,表示的是当前场景中的SvrEye数组。

并依次设置左右眼的屏幕坐标。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Qualcomm_mde.win 是指高通移动开发平台(Qualcomm Mobile Development Environment)的一个软件组件。 高通是一家全球领先的无线通信技术公司,它开发了一系列芯片和软件解决方案,用于移动通信设备,如智能手机、平板电脑和智能穿戴设备等。Qualcomm_mde.win 是高通移动开发平台的一个重要组成部分,旨在为开发者提供一个集成的开发环境和工具,以便他们能够更轻松地开发和测试基于高通芯片的应用程序和软件。 Qualcomm_mde.win 提供了多种功能和工具,包括调试器、编译器、模拟器和性能分析器等。开发者可以使用这些工具来进行应用程序的开发、调试和测试。它还支持多种开发语言和框架,如C++、Java和Android等,使开发者能够根据自己的喜好和需求选择适合的开发方法。同时,Qualcomm_mde.win 还提供了丰富的开发文档和示例代码,帮助开发者快速上手和解决问题。 使用 Qualcomm_mde.win 可以帮助开发者更高效地进行移动应用程序的开发和测试工作。它提供了许多强大的工具和功能,使开发者能够更好地理解和调试应用程序在高通芯片上的运行情况。无论是入门级的开发者还是经验丰富的专业人士,都可以从 Qualcomm_mde.win 中受益,并提高其开发工作的效率和质量。 总之,Qualcomm_mde.win 是高通移动开发平台的一个重要组件,为开发者提供了丰富的开发工具和环境,使他们能够更轻松地开发和测试基于高通芯片的应用程序和软件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值