基于PicoVR与AVPro Video实现3D影片观看

导入PicoSDK和AVPro Video后,编写代码如下:

using RenderHeads.Media.AVProVideo;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour
{
    public MediaPlayer mediaPlayer;
    public ApplyToMesh applyToMesh;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.T))
        {
            //3D左右
            mediaPlayer.m_StereoPacking = StereoPacking.LeftRight;
            RefreshMesh();
        }else if (Input.GetKeyDown(KeyCode.Y))
        {
            //3D上下
            mediaPlayer.m_StereoPacking = StereoPacking.TopBottom;
            RefreshMesh();
        }
        else if (Input.GetKeyDown(KeyCode.U))
        {
            //2D
            mediaPlayer.m_StereoPacking = StereoPacking.None;
            RefreshMesh();
        }
    }

    //调用ApplyToMesh OnEnable刷新屏幕显示
    private void RefreshMesh()
    {
        applyToMesh.enabled = false;
        applyToMesh.enabled = true;
    }
}

 RefreshMesh()方法很重要,每次设置完影片模式StereoPacking后,必须要执行该方法!!!!!

基于PicoVR与AVPro Video实现3D影片观看_第1张图片

基于PicoVR与AVPro Video实现3D影片观看_第2张图片

3D影片 

基于PicoVR与AVPro Video实现3D影片观看_第3张图片

 

你可能感兴趣的:(Unity3D插件)