Esempio n. 1
0
        private void OnEnable()
        {
            Application.targetFrameRate    = 60;
            Screen.sleepTimeout            = SleepTimeout.NeverSleep;
            Input.simulateMouseWithTouches = true;

            if (m_ARInterface == null)
            {
                SetupARInterface();
            }

            // See if we are on a camera
            if (m_ARCamera == null)
            {
                m_ARCamera = GetComponent <Camera>();
            }

            // Fallback to main camera
            if (m_ARCamera == null)
            {
                m_ARCamera = Camera.main;
            }

            serviceRunning = m_ARInterface.StartService(GetSettings());

            if (serviceRunning)
            {
                m_ARInterface.SetupCamera(m_ARCamera);
                Application.onBeforeRender += OnBeforeRender;
            }
            else
            {
                enabled = false;
            }
        }
Esempio n. 2
0
        IEnumerator StartServiceRoutine()
        {
            yield return(m_ARInterface.StartService(GetSettings()));

            if (IsRunning)
            {
                m_ARInterface.SetupCamera(m_ARCamera);
                Application.onBeforeRender += OnBeforeRender;
            }
            else
            {
                enabled = false;
            }
        }
Esempio n. 3
0
        IEnumerator StartServiceRoutine()
        {
            var arInterface = ARInterface.GetInterface();

            yield return(arInterface.StartService(m_CachedSettings));

            if (!arInterface.IsRunning)
            {
                yield break;
            }

            m_ARInterface = arInterface;
            m_ARInterface.SetupCamera(m_ARCamera);

            ARInterface.planeAdded   += PlaneAddedHandler;
            ARInterface.planeUpdated += PlaneUpdatedHandler;
            ARInterface.planeRemoved += PlaneRemovedHandler;
        }
Esempio n. 4
0
        void StartService(SerializableARSettings serializedSettings)
        {
            m_CachedSettings = serializedSettings;
            var arInterface = ARInterface.GetInterface();

            m_ServiceRunning = arInterface.StartService(m_CachedSettings);

            if (!m_ServiceRunning)
            {
                return;
            }

            m_ARInterface = arInterface;
            m_ARInterface.SetupCamera(m_ARCamera);

            ARInterface.planeAdded   += PlaneAddedHandler;
            ARInterface.planeUpdated += PlaneUpdatedHandler;
            ARInterface.planeRemoved += PlaneRemovedHandler;
        }
 protected virtual void SetupARInterface()
 {
     m_ARInterface = ARInterface.GetInterface();
     if (m_ARInterface.IsSupported)
     {
         m_WorldTracking = true;
     }
     else
     {
         AR3DOFInterface ar3DOFInterface = new AR3DOFInterface();
         m_3DOFTracking.SetActive(true);
         ar3DOFInterface.SetupBackgroundImage(m_Background);
         ar3DOFInterface.SetupAspectRatioFitter(m_Fitter);
         ARInterface.SetInterface(ar3DOFInterface);
         m_ARInterface = ARInterface.GetInterface();
         // require camera position earily for 3 DOF tracking
         m_ARInterface.SetupCamera(m_ARCamera);
         m_WorldTracking = false;
     }
 }