Exemple #1
0
 public void Connect()
 {
     if (!NCamPlugin.NCamIsOpen() && !reconnecting)
     {
         StartCoroutine(StartNCam());
     }
 }
Exemple #2
0
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.F3) && Input.GetKey(KeyCode.LeftControl))
        //    showGUI = !showGUI;


        if (!NCamPlugin.NCamIsOpen() && !reconnecting && Config.AutoConnection)
        {
            StartCoroutine(StartNCam());
        }
    }
Exemple #3
0
 public Status GetStatus()
 {
     if (reconnecting)
     {
         return(Status.Connecting);
     }
     else if (NCamPlugin.NCamIsOpen())
     {
         return(Status.Connected);
     }
     else
     {
         return(Status.Disconnected);
     }
 }
Exemple #4
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);
            }
        }
    }