Beispiel #1
0
 public void StartWork()
 {
     if (mCamera != null)
     {
         mCamera.Play();
         e_CameraPlaneObj.GetComponent <Renderer>().material.mainTexture = mCamera.webcamera;
     }
 }
Beispiel #2
0
 public void StartWork()
 {
     if (mCamera != null)
     {
         mCamera.Play();
         rawimg.texture = mCamera.preview;
         InvokeRepeating("checkRunningCamera", 0.1f, 0.05f);
     }
 }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        GUI.enabled = false;
        EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]);
        GUI.enabled = true;

#if UNITY_WEBPLAYER || UNITY_WEBGL
        EditorGUILayout.HelpBox("This component does not work on web player/webGL platform", MessageType.Error);
#else
        this.serializedObject.Update();

        DeviceCamera deviceCamera = (DeviceCamera)target;

        EditorGUILayout.PropertyField(defaultDevice, new GUIContent("default Device"));
        EditorGUILayout.PropertyField(capWidth, new GUIContent("capture Width"));
        EditorGUILayout.PropertyField(capHeight, new GUIContent("capture Height"));
        EditorGUILayout.PropertyField(capFPS, new GUIContent("capture FPS"));
        EditorGUILayout.PropertyField(autoPlay, new GUIContent("auto Play"));
        EditorGUILayout.PropertyField(material, new GUIContent("Render Material"));
        EditorGUILayout.PropertyField(rawImage, new GUIContent("Render RawImage"));

        if (Application.isPlaying == true)
        {
            EditorGUILayout.LabelField(string.Format("Device Name: {0}", deviceCamera.deviceName));
            EditorGUILayout.LabelField(string.Format("Image Width: {0:d}", deviceCamera.Width));
            EditorGUILayout.LabelField(string.Format("Image Height: {0:d}", deviceCamera.Height));
            if (GUILayout.Button("Refresh Settings") == true)
            {
                deviceCamera.RefreshSettings();
            }
            if (GUILayout.Button("Change Device") == true)
            {
                deviceCamera.ChangeDevice();
            }
            if (deviceCamera.isPlaying == false)
            {
                if (GUILayout.Button("Play") == true)
                {
                    deviceCamera.Play();
                }
            }
            else
            {
                if (GUILayout.Button("Pause") == true)
                {
                    deviceCamera.Pause();
                }
            }
            if (GUILayout.Button("Stop") == true)
            {
                deviceCamera.Stop();
            }
        }

        this.serializedObject.ApplyModifiedProperties();
#endif
    }
Beispiel #4
0
 private void PlayDeviceCamera(bool isPlaying)
 {
     _deviceCamera.Play(isPlaying);
     _output.gameObject.SetActive(!isPlaying);
 }