Example #1
0
        /// <summary>
        /// Initializes camera, builds and runs graph for control.
        /// </summary>
        /// <param name="moniker">Moniker (device identification) of camera.</param>
        /// <param name="resolution">Resolution of camera's output.</param>
        public void SetCamera(IMoniker moniker, Resolution resolution)
        {
            // Close current if it was opened
            CloseCamera();

            if (moniker == null)
            {
                return;
            }

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

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

            // Initialize
            _Camera.Initialize(moniker);

            // Build and Run graph
            _Camera.BuildGraph();
            _Camera.RunGraph();
        }
Example #2
0
 /// <summary>
 /// Close and dispose all camera and DirectX stuff.
 /// </summary>
 public void CloseCamera()
 {
     if (_Camera != null)
     {
         _Camera.StopGraph();
         _Camera.CloseAll();
         _Camera.Dispose();
         _Camera = null;
     }
 }
Example #3
0
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();

        NetCamera netCamera = (NetCamera)target;

        GUI.enabled = false;
        EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]);
        GUI.enabled = true;

        EditorGUILayout.PropertyField(ipAddress, new GUIContent("IP Address"));
        EditorGUILayout.PropertyField(port, new GUIContent("port"));
        EditorGUILayout.PropertyField(parameter, new GUIContent("Parameter"));
        EditorGUILayout.PropertyField(targetTexture, new GUIContent("TargetTexture"));

        if (Application.isPlaying)
        {
            if (netCamera.isPlaying)
            {
                if (GUILayout.Button("Stop"))
                {
                    netCamera.Stop();
                }

                EditorUtility.SetDirty(target);
            }
            else
            {
                if (GUILayout.Button("Play"))
                {
                    netCamera.Play();
                }
            }
        }

        this.serializedObject.ApplyModifiedProperties();
    }
Example #4
0
 void Start()
 {
     netcam = GameObject.FindGameObjectWithTag("Player").GetComponent <NetCamera>();
     stats  = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>();
 }