コード例 #1
0
    public IEnumerator Prepare(Material azureKinectScreenMaterial, VideoSenderMessage videoMessage)
    {
        if (State != PrepareState.Unprepared)
        {
            throw new Exception("State has to be Unprepared to prepare TextureGroupUpdater.");
        }

        State = PrepareState.Preparing;

        textureSet.SetWidth(videoMessage.width);
        textureSet.SetHeight(videoMessage.height);
        TelepresenceToolkitPlugin.InitTextureGroup(textureSet.GetId());

        colorDecoder = new Vp8Decoder();
        depthDecoder = new TrvlDecoder(videoMessage.width * videoMessage.height);

        State = PrepareState.Prepared;

        while (!textureSet.IsInitialized())
        {
            yield return(null);
        }

        // TextureGroup includes Y, U, V, and a depth texture.
        azureKinectScreenMaterial.SetTexture("_YTex", textureSet.GetYTexture());
        azureKinectScreenMaterial.SetTexture("_UvTex", textureSet.GetUvTexture());
        azureKinectScreenMaterial.SetTexture("_DepthTex", textureSet.GetDepthTexture());

        State = PrepareState.Prepared;
    }