Esempio n. 1
0
        private void CreateSenseAR()
        {
            if (SenseARInstance == null)
            {
                SenseARInstance = (GameObject)Instantiate(SenseARBasePrefab, transform.position, transform.rotation);
                slamController  = SenseARInstance.GetComponentInChildren <SenseARSLAMController>();
                updateTexture   = SenseARInstance.GetComponentInChildren <SenseARUpdateTexture>();
                slamCameraPose  = SenseARInstance.GetComponentInChildren <SenseARCameraPose>();

                // display size return screen size when portrait mode
                //int ScreenWidth = 0, ScreenHeight = 0;
                //Session.GetNativeSession().SessionApi.GetDisplaySize(ref ScreenWidth, ref ScreenHeight);

                if (Screen.orientation == ScreenOrientation.LandscapeLeft ||
                    Screen.orientation == ScreenOrientation.LandscapeRight)
                {
                    //Screen.SetResolution(ScreenHeight, ScreenWidth, true);
                    Screen.SetResolution(Screen.width, Screen.height, true);
                }
                else
                {
                    //Screen.SetResolution(ScreenWidth, ScreenHeight, true);
                    Screen.SetResolution(Screen.height, Screen.width, true);
                }
            }
        }
Esempio n. 2
0
        private void DestroySenseAR()
        {
            if (SenseARInstance)
            {
                slamController = null;

                Destroy(SenseARInstance);
                SenseARInstance = null;

                Debug.LogError("after SenseAR.Destroy");
            }

            if (axisInstance)
            {
                Destroy(axisInstance);
                axisInstance = null;

                Debug.LogError("after axis.Destroy");
            }


            _RemoveAnchorGameObject();

            Debug.LogError("end DestroySenseAR");
        }
    void Start()
    {
        SenseARInstance = null;
        axisInstance    = null;
        slamController  = null;
        permissionUtil  = GameObject.Find("Instantiate").GetComponent <AndroidPermissionUtil>();

        ApiArAvailability arAvailability = ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED;

        NativeSession.CheckApkAvailability(ref arAvailability);
        if (arAvailability == ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED)
        {
            ApiArInstallStatus status = ApiArInstallStatus.AR_INSTALL_STATUS_INSTALL_REQUESTED;
            NativeSession.RequestInstall(1, ref status);
        }

        if (shotButton)
        {
            shotButton.gameObject.SetActive(false);
        }


        NativeSession.CheckAuthorized(getAppId());

        if (type == ReferenceImageType.Patt)
        {
            StartCoroutine(ReadConfig());
            StartCoroutine(ReadPatts());
        }

        if (type == ReferenceImageType.Database)
        {
            StartCoroutine(ReadImageDatabase());
        }
    }
Esempio n. 4
0
        void Start()
        {
            SenseARInstance = null;
            axisInstance    = null;
            CloundRoom      = GetComponent <HelloARCloud_CloundRoomManager>();
            slamController  = null;
            permissionUtil  = GameObject.Find("Instantiate").GetComponent <AndroidPermissionUtil>();


            prevTouches  = new Touch[2];
            selectedObj_ = null;
            bPlaceModel  = true;

            ApiArAvailability arAvailability = ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED;

            NativeSession.CheckApkAvailability(ref arAvailability);
            if (arAvailability == ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED)
            {
                ApiArInstallStatus status = ApiArInstallStatus.AR_INSTALL_STATUS_INSTALL_REQUESTED;
                NativeSession.RequestInstall(1, ref status);
            }


            NativeSession.CheckAuthorized(getAppId());
        }
    public void DestroySenseAR()
    {
        if (shotButton)
        {
            shotButton.gameObject.SetActive(false);
        }

        if (SenseARInstance)
        {
            slamController = null;
            database.Destroy();
            database = null;
            Destroy(SenseARInstance);
            SenseARInstance = null;

            Debug.LogError("after SenseAR.Destroy");
        }

        if (axisInstance)
        {
            Destroy(axisInstance);
            axisInstance = null;

            Debug.LogError("after axis.Destroy");
        }

        Debug.LogError("end DestroySenseAR");
    }
Esempio n. 6
0
    void Start()
    {
        SenseARInstance = null;
        axisInstance    = null;
        slamController  = null;
        permissionUtil  = GameObject.Find("Instantiate").GetComponent <AndroidPermissionUtil>();

        prevTouches  = new Touch[2];
        selectedObj_ = null;
        bPlaceModel  = true;

        ApiArAvailability arAvailability = ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED;

        NativeSession.CheckApkAvailability(ref arAvailability);
        if (arAvailability != ApiArAvailability.AR_AVAILABILITY_SUPPORTED_INSTALLED)
        {
            ApiArInstallStatus status = ApiArInstallStatus.AR_INSTALL_STATUS_INSTALL_REQUESTED;
            NativeSession.RequestInstall(1, ref status);
        }

        if (shotButton)
        {
            shotButton.gameObject.SetActive(false);
        }


        ApiArStatus ret = NativeSession.CheckAuthorized(getAppId());
    }
    public void CreateSenseAR()
    {
        if (type == ReferenceImageType.Database && bCompleteReadingImageDatabase == false)
        {
            Debug.Log("CreateSenseAR Failed");
            return;
        }

        if (type == ReferenceImageType.Patt && bCompleteReadingConfig == false)
        {
            Debug.Log("CreateSenseAR Failed");
            return;
        }

        if (shotButton)
        {
            shotButton.gameObject.SetActive(true);
        }

        if (SenseARInstance == null)
        {
            SenseARInstance = (GameObject)Instantiate(SenseARBasePrefab, transform.position, transform.rotation);
            slamController  = GameObject.Find("SlamController").GetComponent <SenseARSLAMController>();
            updateTexture   = GameObject.Find("ARCamera").GetComponent <SenseARUpdateTexture>();
            session         = SenseARInstance.GetComponent <ARCoreSession>();
            database        = new ReferenceImageDatabase(Session.GetNativeSession());
            if (type == ReferenceImageType.SingleImage)
            {
                for (int i = 0; i < textures.Length; ++i)
                {
                    database.AddImage(textures[i].name, textures[i]);
                }
            }
            else if (type == ReferenceImageType.Patt)
            {
                database.LoadConfig(ConfigBuffer, ConfigBufferLength);
                for (int i = 0; i < patts.Length; ++i)
                {
                    database.AddPatt(PattsBuffer[i], PattsBufferLength[i]);
                }
            }
            else
            {
                database.Deserialize(ImageDatabaseBuffer, ImageDatabaseBufferLength);
            }
            session.SetReferenceImageDatabase(database);

            session.Connect();

            // display size return screen size when portrait mode
            //int ScreenWidth = 0, ScreenHeight = 0;
            //Session.GetNativeSession().SessionApi.GetDisplaySize(ref ScreenWidth, ref ScreenHeight);
        }

        if (AxisPrefab)
        {
            axisInstance = (GameObject)Instantiate(AxisPrefab, new Vector3(0, 0, 0), transform.rotation);
        }
    }
Esempio n. 8
0
    public void StopSenseAR()
    {
        slamController = null;
        Destroy(SenseARInstance);
        SenseARInstance = null;

        debugTXT1.text = "Sense AR Destroyed";
        debugTXT0.text = "Sense AR Destroyed";
    }
Esempio n. 9
0
    public void StartSenseAR()
    {
        if (SenseARInstance == null)
        {
            SenseARInstance = (GameObject)Instantiate(SenseArPrefab, transform.position, transform.rotation);
            slamController  = GameObject.Find("SlamController").GetComponent <SenseARSLAMController>();
            updateTexture   = GameObject.Find("ARCamera").GetComponent <SenseARUpdateTexture>();

            //Attempt Disabling The PointCloud as it is visually distracting
            slamController.m_PointCloudPrefab.SetActive(false);

            ArAlignedMapInterface.GetComponent <SimpleAutomaticSynchronizationContextBehaviour>()._arPositionReference = GameObject.Find("ARCamera").transform;
        }
    }
Esempio n. 10
0
    void start()
    {
        //Init
        SenseARInstance = null;
        axisInstance    = null;
        slamController  = null;

        ApiArAvailability arAvailability = ApiArAvailability.AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED;

        NativeSession.CheckApkAvailability(ref arAvailability);
        if (arAvailability != ApiArAvailability.AR_AVAILABILITY_SUPPORTED_INSTALLED)
        {
            ApiArInstallStatus status = ApiArInstallStatus.AR_INSTALL_STATUS_INSTALL_REQUESTED;
            NativeSession.RequestInstall(1, ref status);
        }
        ApiArStatus ret = NativeSession.CheckAuthorized(getAppId());

        //Starting Location For Compass and GPS
        Input.location.Start();
    }
Esempio n. 11
0
    public void CreateSenseAR()
    {
        if (shotButton)
        {
            shotButton.gameObject.SetActive(true);
        }

        if (SenseARInstance == null)
        {
            SenseARInstance = (GameObject)Instantiate(SenseARBasePrefab, transform.position, transform.rotation);
            slamController  = GameObject.Find("SlamController").GetComponent <SenseARSLAMController>();
            updateTexture   = GameObject.Find("ARCamera").GetComponent <SenseARUpdateTexture>();

            // display size return screen size when portrait mode
            //int ScreenWidth = 0, ScreenHeight = 0;
            //Session.GetNativeSession().SessionApi.GetDisplaySize(ref ScreenWidth, ref ScreenHeight);
        }

        if (AxisPrefab)
        {
            axisInstance = (GameObject)Instantiate(AxisPrefab, new Vector3(0, 0, 0), transform.rotation);
        }
    }