Ejemplo n.º 1
0
        private IEnumerator UpdatePlugin()
        {
            while (true)
            {
                yield return(new WaitForEndOfFrame());

                GL.IssuePluginEvent(WebcamInterop.GetRenderCallback(), 0);
            }
        }
Ejemplo n.º 2
0
        private void OnUpdate()
        {
            //Prevents generating analytics when the scene is started
            if (_webcamEnabled == null)
            {
                _webcamEnabled = WebcamInterop.IsWebcamOn();
                return;
            }

            WebcamToggleAnalytics();
        }
Ejemplo n.º 3
0
        private void WebcamToggleAnalytics()
        {
            bool webcamEnabled = WebcamInterop.IsWebcamOn();

            if (webcamEnabled != _webcamEnabled)
            {
                _webcamEnabled = webcamEnabled;
                JObject o = new JObject();
                o["webcam_enabled"] = webcamEnabled;

                SendAsyncAnalytics("unity_webcamToggle", o);
            }
        }
Ejemplo n.º 4
0
        private void OnDisable()
        {
            if (_enableWebcamPlugin)
            {
                StopCoroutine(UpdatePlugin());
                WebcamInterop.Stop();
            }

            MetaCoreInterop.meta_enable_rgb_stream(false);

            _drawRgb.Clear();
            _drawComposite.Clear();
            _textureRequest = false;
        }
Ejemplo n.º 5
0
        private void OnEnable()
        {
            if (_enableWebcamPlugin)
            {
                // Start webcam rendering
                WebcamInterop.Initalize(_texturePtr, PluginFps);
                WebcamInterop.Run();
            }

            MetaCoreInterop.meta_enable_rgb_stream(true);

            InitializeMaterial();

            if (_enableWebcamPlugin)
            {
                StartCoroutine(UpdatePlugin());
            }
        }
Ejemplo n.º 6
0
 private bool IsWebcamBeingWatched()
 {
     return(WebcamInterop.IsWebcamOn() || _targetDisplay != WebcamMirrorModes.None || _textureRequest);
 }