コード例 #1
0
        public static List <ARPlane> GetPlanes(ARTrackableQueryFilter filter)
        {
            List <ARPlane> planeList = new List <ARPlane>();

            GetTrackables <ARPlane>(planeList, filter);
            return(planeList);
        }
コード例 #2
0
        public static List <ARAnchor> GetAnchors(ARTrackableQueryFilter filter)
        {
            if (ARSessionManager.Instance.SessionStatus != ARSessionStatus.RUNNING &&
                ARSessionManager.Instance.SessionStatus != ARSessionStatus.PAUSED)
            {
                return(new List <ARAnchor>());
            }

            switch (filter)
            {
            case ARTrackableQueryFilter.ALL:
                List <ARAnchor> anchors = new List <ARAnchor>();
                ARSessionManager.Instance.m_ndkSession.AnchorManager.GetAllAnchor(anchors);
                return(anchors);

            case ARTrackableQueryFilter.UPDATED:
                List <ARAnchor> anchorList = new List <ARAnchor>();
                ARSessionManager.Instance.m_ndkSession.FrameAdapter.GetUpdatedAnchors(anchorList);
                return(anchorList);

            case ARTrackableQueryFilter.NEW:
            default:
                return(new List <ARAnchor>());
            }
        }
コード例 #3
0
 public static void GetTrackables <T>(List <T> trackableList, ARTrackableQueryFilter filter) where T : ARTrackable
 {
     if (trackableList == null)
     {
         throw new ArgumentException();
     }
     if (ARSessionManager.Instance.SessionStatus != ARSessionStatus.RUNNING &&
         ARSessionManager.Instance.SessionStatus != ARSessionStatus.PAUSED)
     {
         trackableList.Clear();
         return;
     }
     ARSessionManager.Instance.m_ndkSession.TrackableManager.GetTrackables <T>(trackableList, filter);
 }
コード例 #4
0
        public void GetTrackables <T>(List <T> trackables, ARTrackableQueryFilter filter) where T : ARTrackable
        {
            if (m_lastUpdateFrame < Time.frameCount)
            {
                // Get trackables updated this frame.
                m_ndkSession.FrameAdapter.GetUpdatedTrackables(m_updatedTrackables);

                // Get all the trackables in the session.
                m_ndkSession.SessionAdapter.GetAllTrackables(m_allTrackables);

                ARDebug.LogInfo("m_updatedTrackables {0} m_allTrackables {1}", m_updatedTrackables.Count, m_allTrackables.Count);
                // Find trackables that are not in the hashset (new).
                m_newTrackables.Clear();
                for (int i = 0; i < m_allTrackables.Count; i++)
                {
                    ARTrackable trackable = m_allTrackables[i];
                    if (!m_oldTrackables.Contains(trackable))
                    {
                        m_newTrackables.Add(trackable);
                        m_oldTrackables.Add(trackable);
                    }
                }

                m_lastUpdateFrame = Time.frameCount;
            }

            trackables.Clear();

            if (filter == ARTrackableQueryFilter.ALL)
            {
                for (int i = 0; i < m_allTrackables.Count; i++)
                {
                    _SafeAdd <T>(m_allTrackables[i], trackables);
                }
            }
            else if (filter == ARTrackableQueryFilter.NEW)
            {
                for (int i = 0; i < m_newTrackables.Count; i++)
                {
                    _SafeAdd <T>(m_newTrackables[i], trackables);
                }
            }
            else if (filter == ARTrackableQueryFilter.UPDATED)
            {
                for (int i = 0; i < m_updatedTrackables.Count; i++)
                {
                    _SafeAdd <T>(m_updatedTrackables[i], trackables);
                }
            }
        }