Beispiel #1
0
 public void CloseCamera()
 {
     if (_Camera != null)
     {
         _Camera.StopGraph();
         _Camera.CloseAll();
         _Camera.Dispose();
         _Camera = null;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Cycles from one player to the next
 /// </summary>
 void PlayerCycle()
 {
     ActivePlayer = Players [m_CurrentPlayerIndex];
     CameraSnap.CameraSnapOverTarget(ActivePlayer.transform);
     if (m_CurrentPlayerIndex >= 3)
     {
         m_CurrentPlayerIndex = 0;
     }
     else
     {
         m_CurrentPlayerIndex++;
     }
 }
Beispiel #3
0
        // Set current camera to camera_device
        private void SetCamera(IMoniker moniker, Resolution resolution = null)
        {
            try
            {
                // Makes all magic with camera and DirectShow graph
                // Close current if it was opened
                CloseCamera();

                if (moniker == null)
                {
                    return;
                }

                // Create camera object
                _Camera = new CameraSnap();

                string _DirectShowLogFilepath = string.Empty;

                if (!string.IsNullOrEmpty(_DirectShowLogFilepath))
                {
                    _Camera.DirectShowLogFilepath = _DirectShowLogFilepath;
                }

                // select resolution
                //ResolutionList resolutions = Camera.GetResolutionList(moniker);

                if (resolution != null)
                {
                    _Camera.Resolution = resolution;
                }

                // Initialize
                _Camera.Initialize(moniker);

                // Build and Run graph
                _Camera.BuildGraph();
                _Camera.RunGraph();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, @"Error while running camera");
            }
        }
Beispiel #4
0
 void Start()
 {
     CameraSnap.CameraSnapOverTarget(ActivePlayer.transform);
     UpdateUI();
 }