public static void InitAndroid()
        {
            #if NATIVE_PLUGIN_EXIST
            AndroidJavaClass  unityClass     = new AndroidJavaClass(UNITY_ANDROID_PLAYER);
            AndroidJavaObject activityObject = unityClass.GetStatic <AndroidJavaObject>(UNITY_ANDROID_ACTIVITY_CURRENT);
            AndroidJavaObject contextObject  = activityObject.Call <AndroidJavaObject>(UNITY_ANDROID_CONTEXT);

            CardboardUnity_initializeAndroid(activityObject.GetRawObject());

            CardboardQrCode.SetAndroidQRCodeLocation();
            #endif
        }
コード例 #2
0
        public static void InitCardboard()
        {
            if (!initiated)
            {
                CardboardHeadTracker.CreateTracker();
                CardboardHeadTracker.ResumeTracker();

                CardboardQrCode.RegisterObserver();
                Application.quitting += ApplicationQuit;
                initiated             = true;
            }
            RefreshParameters();
        }
コード例 #3
0
        private static void InitDeviceProfile()
        {
            (IntPtr, int)par = CardboardQrCode.GetDeviceParamsPointer();

            if (par.Item2 == 0 && !Application.isEditor)
            {
                profileAvailable = false;
                LoadDefaultProfile();
                par = CardboardQrCode.GetDeviceParamsPointer();
            }

            deviceParameter = CardboardQrCode.GetDecodedDeviceParams();
            //todo do we need to destroy it before create it?
            CardboardLensDistortion.CreateLensDistortion(par.Item1, par.Item2);
            profileAvailable = true;
        }
コード例 #4
0
        private static void InitDeviceProfile()
        {
            (IntPtr, int)par = CardboardQrCode.GetDeviceParamsPointer();

            if (par.Item2 == 0 && !Application.isEditor)
            {
                profileAvailable = false;
                CardboardQrCode.StartScanQrCode();
                return;
            }

            //CardboardLensDistortion.DestroyLensDistortion();
            deviceParameter = CardboardQrCode.GetDecodedDeviceParams();
            CardboardLensDistortion.CreateLensDistortion(par.Item1, par.Item2);
            profileAvailable = true;
        }
コード例 #5
0
        public static void RefreshParameters()
        {
            CardboardQrCode.RetrieveDeviceParam();

            if (retriving)
            {
                return;
            }

            retriving = true;

            InitDeviceProfile();
            InitCameraProperties();

            retriving = false;

            deviceParamsChangeEvent?.Invoke();
        }
コード例 #6
0
        public static void InitCardboard()
        {
            if (!initiated)
            {
                #if UNITY_ANDROID
                CardboardAndroidInitialization.InitAndroid();
                #endif

                CardboardHeadTracker.CreateTracker();
                CardboardHeadTracker.ResumeTracker();

                CardboardQrCode.RegisterObserver();
                Application.quitting += ApplicationQuit;
                initiated             = true;
            }

            RefreshParameters();
        }
コード例 #7
0
 public static void ScanQrCode()
 {
     CardboardQrCode.StartScanQrCode();
 }
コード例 #8
0
 //This function can be used to change current device paramters
 public static void SetCardboardProfile(string url)
 {
     CardboardQrCode.SetCardboardProfile(url);
 }
コード例 #9
0
 private static void ApplicationQuit()
 {
     CardboardQrCode.DeRegisterObserver();
 }
コード例 #10
0
 private void ScanQRCode()
 {
     CardboardQrCode.StartScanQrCode();
     SetEnableQROverlay(true);
 }