예제 #1
0
        void IFunctionalityProvider.UnloadProvider()
        {
            m_ARPointCloudManager.pointCloudsChanged -= ARPointCloudManagerOnPointCloudsChanged;
            if (m_NewARPointCloudManager)
            {
                UnityObjectUtils.Destroy(m_NewARPointCloudManager);
            }

            ARFoundationSessionProvider.TearDownARSession();

            if (m_Identifiers.IsCreated)
            {
                m_Identifiers.Dispose();
            }

            if (m_Positions.IsCreated)
            {
                m_Positions.Dispose();
            }

            if (m_ConfidenceValues.IsCreated)
            {
                m_ConfidenceValues.Dispose();
            }
        }
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();

            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARTrackedImageManager = UnityEngine.Object.FindObjectOfType <ARTrackedImageManager>();
                if (!m_ARTrackedImageManager)
                {
                    m_ARTrackedImageManager = currentSession.gameObject.AddComponent <ARTrackedImageManager>();
#if ARFOUNDATION_4_OR_NEWER
                    m_ARTrackedImageManager.requestedMaxNumberOfMovingImages = 4;
#else
                    m_ARTrackedImageManager.maxNumberOfMovingImages = 4;
#endif
                    m_NewARTrackedImageManager = m_ARTrackedImageManager;
                }

                m_ARTrackedImageManager.trackedImagesChanged += OnTrackedImagesChanged;
            }

            AddExistingMarkers();
        }
예제 #3
0
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();

            var camera = MarsRuntimeUtils.GetActiveCamera(true);

            if (camera)
            {
                m_ARCameraManager = camera.gameObject.GetComponent <ARCameraManager>();
                if (!m_ARCameraManager)
                {
                    m_ARCameraManager           = camera.gameObject.AddComponent <ARCameraManager>();
                    m_NewARCameraManager        = m_ARCameraManager;
                    m_ARCameraManager.hideFlags = HideFlags.DontSave;
                }

#if ARFOUNDATION_4_OR_NEWER
                m_ARCameraManager.requestedLightEstimation = LightEstimation.AmbientColor
                                                             | LightEstimation.AmbientIntensity
                                                             | LightEstimation.AmbientSphericalHarmonics
                                                             | LightEstimation.MainLightIntensity
                                                             | LightEstimation.MainLightDirection;
#else
                m_ARCameraManager.lightEstimationMode = LightEstimationMode.AmbientIntensity;
#endif
            }
            else
            {
                throw new InvalidOperationException("No camera found");
            }

            m_ARCameraManager.frameReceived += ARCameraFrameEvent;
        }
예제 #4
0
 void IFunctionalityProvider.UnloadProvider()
 {
     m_ARCameraManager.frameReceived -= ARCameraFrameEvent;
     if (m_NewARCameraManager)
     {
         UnityObjectUtils.Destroy(m_NewARCameraManager);
     }
     ARFoundationSessionProvider.TearDownARSession();
 }
예제 #5
0
        void IFunctionalityProvider.UnloadProvider()
        {
            if (m_NewARRaycastManager)
            {
                UnityObjectUtils.Destroy(m_NewARRaycastManager);
            }

            ARFoundationSessionProvider.TearDownARSession();
        }
        void IFunctionalityProvider.UnloadProvider()
        {
            m_ARPlaneManager.planesChanged -= ARPlaneManagerOnPlanesChanged;

            if (m_NewARPlaneManager)
            {
                UnityObjectUtils.Destroy(m_NewARPlaneManager);
            }

            ARFoundationSessionProvider.TearDownARSession();
        }
예제 #7
0
        void IFunctionalityProvider.UnloadProvider()
        {
            m_ARFaceManager.facesChanged -= ARFaceManagerOnFacesChanged;

            ClearTrackables();

            if (m_NewARFaceManager)
            {
                UnityObjectUtils.Destroy(m_NewARFaceManager);
            }

            ARFoundationSessionProvider.TearDownARSession();
        }
        void IFunctionalityProvider.UnloadProvider()
        {
#if ARFOUNDATION_3_0_1_OR_NEWER
            m_ARReferencePointManager.anchorsChanged -= ARReferencePointManagerOnReferencePointsChanged;
#else
            m_ARReferencePointManager.referencePointsChanged -= ARReferencePointManagerOnReferencePointsChanged;
#endif
            if (m_NewARReferencePointManager)
            {
                UnityObjectUtils.Destroy(m_NewARReferencePointManager);
            }

            ARFoundationSessionProvider.TearDownARSession();
        }
예제 #9
0
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();
            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARRaycastManager = UnityEngine.Object.FindObjectOfType <ARRaycastManager>();
                if (!m_ARRaycastManager)
                {
                    m_ARRaycastManager           = currentSession.gameObject.AddComponent <ARRaycastManager>();
                    m_ARRaycastManager.hideFlags = HideFlags.DontSave;
                    m_NewARRaycastManager        = m_ARRaycastManager;
                }
            }
        }
예제 #10
0
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();
            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARPointCloudManager = UnityEngine.Object.FindObjectOfType <ARPointCloudManager>();
                if (!m_ARPointCloudManager)
                {
                    m_ARPointCloudManager           = currentSession.gameObject.AddComponent <ARPointCloudManager>();
                    m_ARPointCloudManager.hideFlags = HideFlags.DontSave;
                    m_NewARPointCloudManager        = m_ARPointCloudManager;
                }

                m_ARPointCloudManager.pointCloudsChanged += ARPointCloudManagerOnPointCloudsChanged;
            }

#if UNITY_EDITOR
            var data = new PointCloudData();
            m_Identifiers      = new NativeArray <ulong>(k_NumPoints, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
            m_Positions        = new NativeArray <Vector3>(k_NumPoints, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
            m_ConfidenceValues = new NativeArray <float>(k_NumPoints, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
            for (var i = 0; i < k_NumPoints; i++)
            {
                m_Identifiers[i]      = (ulong)i;
                m_Positions[i]        = Random.insideUnitSphere * k_PointCloudSize;
                m_ConfidenceValues[i] = Random.Range(0, 1);
            }

            data.Identifiers                 = new NativeSlice <ulong>(m_Identifiers);
            data.Positions                   = new NativeSlice <Vector3>(m_Positions);
            data.ConfidenceValues            = new NativeSlice <float>(m_ConfidenceValues);
            m_Data[MarsTrackableId.Create()] = data;

            EditorApplication.delayCall += () =>
            {
                if (PointCloudUpdated != null)
                {
                    PointCloudUpdated(GetPoints());
                }
            };
#endif
        }
예제 #11
0
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();

            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARFaceManager = UnityObject.FindObjectOfType <ARFaceManager>();
                if (!m_ARFaceManager)
                {
                    m_ARFaceManager    = currentSession.gameObject.AddComponent <ARFaceManager>();
                    m_NewARFaceManager = m_ARFaceManager;
                }

                m_ARFaceManager.facesChanged += ARFaceManagerOnFacesChanged;
            }

            AddExistingTrackables();
        }
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();

            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARPlaneManager = UnityEngine.Object.FindObjectOfType <ARPlaneManager>();
                if (!m_ARPlaneManager)
                {
                    m_ARPlaneManager           = currentSession.gameObject.AddComponent <ARPlaneManager>();
                    m_ARPlaneManager.hideFlags = HideFlags.DontSave;
                    m_NewARPlaneManager        = m_ARPlaneManager;
                }

                m_ARPlaneManager.planesChanged += ARPlaneManagerOnPlanesChanged;
            }

            AddExistingTrackables();
        }
        void IFunctionalityProvider.LoadProvider()
        {
            ARFoundationSessionProvider.RequireARSession();

            var currentSession = ARFoundationSessionProvider.currentSession;

            if (currentSession)
            {
                m_ARReferencePointManager = UnityEngine.Object.FindObjectOfType <ARReferencePointManager>();
                if (!m_ARReferencePointManager)
                {
                    m_ARReferencePointManager           = currentSession.gameObject.AddComponent <ARReferencePointManager>();
                    m_ARReferencePointManager.hideFlags = HideFlags.DontSave;
                    m_NewARReferencePointManager        = m_ARReferencePointManager;
                }

#if ARFOUNDATION_3_0_1_OR_NEWER
                m_ARReferencePointManager.anchorsChanged += ARReferencePointManagerOnReferencePointsChanged;
#else
                m_ARReferencePointManager.referencePointsChanged += ARReferencePointManagerOnReferencePointsChanged;
#endif
            }
        }
예제 #14
0
 void IFunctionalityProvider.LoadProvider()
 {
     ARFoundationSessionProvider.RequireARSession();
     InitializeCameraProvider();
 }
예제 #15
0
 void IFunctionalityProvider.UnloadProvider()
 {
     ShutdownCameraProvider();
     ARFoundationSessionProvider.TearDownARSession();
 }