Beispiel #1
0
        [NCDoc(110)][NCCode(18)] public static readonly ReadOnlyCollection <DeviceCamera> Cameras; //You shall not touch!
        #endregion

        #region ---Utility---
        ///<summary>
        ///Internal. Do not use.
        ///</summary>
        public static void Reset()
        {
            for (int i = 0, len = Cameras.Count; i < len; i++)
            {
                DeviceCamera cam = Cameras[i];
                cam.mFocusMode          = FocusMode.AutoFocus;
                cam.mFlashMode          = FlashMode.Auto;
                cam.mTorchMode          = Switch.Off;
                cam.mZoomRatio          = 0f;
                cam.requestedResolution = Vector2.zero;
                cam.requestedFramerate  = (int)FrameratePreset.Default;
            }
        }
Beispiel #2
0
        static DeviceCamera()
        {
            int cameraCount = WebCamTexture.devices.Length;

            DeviceCamera[] cameras = new DeviceCamera[cameraCount];
            for (int i = 0; i < cameraCount; i++)
            {
                cameras[i] = new DeviceCamera(i);
            }
            Cameras     = new ReadOnlyCollection <DeviceCamera>(cameras);
            RearCamera  = Cameras.FirstOrDefault(c => c.Facing == Facing.Rear);
            FrontCamera = Cameras.FirstOrDefault(c => c.Facing == Facing.Front);
        }
Beispiel #3
0
        public static void Release()
        {
            DeviceCamera.Reset();
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                Native.Release();
                break;

            case NatCamInterface.FallbackInterface:
                Fallback.Release();
                break;
            }
        }
Beispiel #4
0
        public static void Play(DeviceCamera camera = null)
        {
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                if (camera != null)
                {
                    Native.mActiveCamera = camera;
                }
                Native.Play();
                break;

            case NatCamInterface.FallbackInterface:
                if (camera != null)
                {
                    Fallback.mActiveCamera = camera;
                }
                Fallback.Play();
                break;
            }
        }