Ejemplo n.º 1
0
 /// <summary>
 /// 开启相机
 /// </summary>
 /// <returns>成功失败</returns>
 public override bool Start(SCameraStartCallBack callback = null)
 {
     //m_cameraDeviceBehaviour.Device.Stop();
     m_cameraDeviceBehaviour.OpenAndStart();
     //if (callback != null)
     //    SCameraManager.instance.StartCoroutine(StartCallBack(callback));
     return(true);
 }
Ejemplo n.º 2
0
    private IEnumerator ShowStubPlane()
    {
        snapshooter.PhotoTexMade += OnPhotoMade;

        bool isBack = arCam.CameraDeviceType == ArCamDevType.Back;

        arCam.CameraDeviceType = isBack ? ArCamDevType.Front : ArCamDevType.Back;
        arCam.Close();
        arCam.OpenAndStart();

        checkingCamTex = null;
        Vector2Int size                = new Vector2Int(Screen.width / 16, Screen.height / 16);
        ulong      prevHash            = 0;
        uint       curDiffrFramesCount = 0;
        float      startTime           = Time.time;

        while ((Time.time - startTime < maxSwitchTime) && (curDiffrFramesCount < diffrentFramesCount))
        {
            snapshooter.Snapshoot(size);
            while (checkingCamTex == null)
            {
                yield return(null);
            }
            ulong hash = CalcTexHash(checkingCamTex);
            if (hash != prevHash)
            {
                curDiffrFramesCount++;
            }
            else
            {
                curDiffrFramesCount = 0;
            }
            prevHash       = hash;
            checkingCamTex = null;
            yield return(new WaitForSeconds(tryingTime));
        }

        snapshooter.PhotoTexMade    -= OnPhotoMade;
        transitionBackground.enabled = false;
        SetUiActive(true);
    }