Exemplo n.º 1
0
    private IEnumerator StartNCam()
    {
        reconnecting = true;
        yield return(new WaitForEndOfFrame());

        StopNCam();

        NCamPlugin.NCamResetError();
        NCamPlugin.NCamSetPacketType(true, true, true);

        yield return(new WaitForEndOfFrame());

        NCamPlugin.NCamSetIpAddress(Config.Ip, Config.Port);
        GL.IssuePluginEvent(NCamPlugin.GetNCamRenderEventFunc(), (int)NCamRenderEvent.Initialize);

        yield return(new WaitForEndOfFrame());

        reconnecting = false;

        while (true)
        {
            // Wait until all frame rendering is done
            yield return(new WaitForEndOfFrame());

            if (!NCamPlugin.NCamIsOpen())
            {
                yield return(null);
            }

            if (distortionMap == null)
            {
                yield return(CreateDistortMap());
            }

            GL.IssuePluginEvent(NCamPlugin.GetNCamRenderEventFunc(), (int)NCamRenderEvent.Update);

            // Check if we got a valid packet
            if (NCamPlugin.NCamOpticalTimeCode(Optical.Handle.AddrOfPinnedObject()) > 0)
            {
                UpdateCameras();
                GL.IssuePluginEvent(NCamPlugin.GetNCamRenderEventFunc(), (int)NCamRenderEvent.UpdateDistortion);
            }
        }
    }
Exemplo n.º 2
0
 private void StopNCam()
 {
     reconnecting = false;
     StopCoroutine(StartNCam());
     GL.IssuePluginEvent(NCamPlugin.GetNCamRenderEventFunc(), (int)NCamRenderEvent.Uninitialize);
 }