Exemple #1
0
    void LateUpdate()
    {
        bool updateNeeded = false;

        if (UNHVD.unhvd_get_frame_begin(unhvd, frame) == 0)
        {
            updateNeeded = PrepareTextures();
        }

        if (UNHVD.unhvd_get_frame_end(unhvd) != 0)
        {
            Debug.LogWarning("Failed to get UNHVD frame data");
        }

        if (!updateNeeded)
        {
            return;
        }

        depthTexture.Apply(false);
        colorTexture.Apply(false);

        vertexBuffer.SetCounterValue(0);
        unprojectionShader.Dispatch(0, frame[0].width / 8, frame[0].height / 8, 1);
        ComputeBuffer.CopyCount(vertexBuffer, argsBuffer, 0);
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (UNHVD.unhvd_get_frame_begin(unhvd, ref frame) == 0)
        {
            AdaptTexture();
            videoTexture.LoadRawTextureData(frame.data[0], frame.width * frame.height * 4);
            videoTexture.Apply(false);
        }

        if (UNHVD.unhvd_get_frame_end(unhvd) != 0)
        {
            Debug.LogWarning("Failed to get UNHVD frame data");
        }
    }