Example #1
0
    public void StartFile(Texture tex)
    {
        Debug.Log("Kauel: StartFile()");

        singleton = this;

        Mode = KameraMode.File;

        // if (NatCam.IsPlaying) NatCam.Pause();
        // if (NatCam.IsRunning) NatCam.StopPreview();
        ConfigureForTexture(tex);

        DetectEdges();

        PanelSelector.HideAll();
    }
Example #2
0
    public void StartCamera()
    {
        //   if (NatCamCamera == null) {
        //      Debug.Log("entra aqui?");
        // NatCamCamera = DeviceCamera.FrontCamera;
        //NatCamCamera.StartPreview(OnStart, OnFrame);
        //   NatCamCamera.StartPreview(OnStart);
        //  }


        Debug.Log("Kauel: StartCamera()");

        singleton = this;

        Mode = KameraMode.Camera;

        /////////////////////////////////////////////////////   RawImageCamera.texture = previewTexture;
        //RawImageCamera.texture = preview;
        //previewTexture = preview;

#if UNITY_EDITOR
        NatCamCamera = DeviceCamera.Cameras[0];
        ////////////////////////////////////////////////////// CamCreated = true;
#elif UNITY_ANDROID
        Debug.Log("Kauel: Android");

        NatCamCamera = DeviceCamera.RearCamera;


        /*  if (NatCam.HasPermissions) {
         *
         *    Debug.Log("Kauel: NatCam permissions OK :)");
         *
         * } else {
         *
         *    Debug.Log("Kauel: NatCam has NO PERMISSIONS!!!");
         *
         * }
         *
         * NatCamCamera = CameraDevice.GetDevices()[0];
         */

        // NatCamCamera = DeviceCamera.Cameras[0];
        if (!CamCreated)
        {
            //   CamCreated = true;
            //   NatCamCamera = DeviceCamera.Cameras[0];
            //   NatCamCamera = DeviceCamera.RearCamera;
            //   NatCamCamera.PreviewResolution.Set(1920, 1080);
            //   NatCamCamera.PhotoResolution.Set(1920, 1080);
            //   Debug.Log("Kauel: CamCreated");

            // NatCam.Camera = DeviceCamera.RearCamera;
            // var NatCamCamera = CameraDevice.GetDevices()[0];
            //  NatCamCamera = CameraDevice.GetDevices()[0];

            // NatCamCamera = DeviceCamera.RearCamera;

            //  NatCamCamera.SetPreviewResolution(ResolutionPreset.FullHD);
            //  NatCamCamera.SetPhotoResolution(ResolutionPreset.FullHD);
            //  NatCamCamera.SetFramerate(FrameratePreset.Default);

            //  Debug.Log("Kauel: CamCreated");
        }
#elif UNITY_IOS
        Debug.Log("Kauel: iOS");



        if (!CamCreated)
        {
            CamCreated = true;

            //NatCam.Camera = DeviceCamera.RearCamera;
            var NatCam.Camera = CameraDevice.GetDevices()[0];

            NatCam.Camera.SetPreviewResolution(ResolutionPreset.FullHD);

            NatCam.Camera.SetPhotoResolution(ResolutionPreset.FullHD);

            Debug.Log("Kauel: CamCreated");
        }
#endif



        NatCamCamera.StartPreview(OnStart);

        PanelSelector.ShowOnlyThisPanel(0); //Solo el panel de fotos

        Debug.Log("Kauel: StartCamera() ha finalizado");
    }