Exemplo n.º 1
0
        private void UpdateWordResultPoses(Transform arCameraTransform, IEnumerable <VuforiaManagerImpl.WordResultData> wordResults)
        {
            if (this.mVuforiaBehaviour == null)
            {
                this.mVuforiaBehaviour = VuforiaARController.Instance;
            }
            Rect videoBackgroundRectInViewPort = this.mVuforiaBehaviour.GetVideoBackgroundRectInViewPort();
            bool isTextureMirrored             = this.mVuforiaBehaviour.VideoBackGroundMirrored == VuforiaRenderer.VideoBackgroundReflection.ON;

            CameraDevice.VideoModeData videoMode = CameraDevice.Instance.GetVideoMode();
            foreach (VuforiaManagerImpl.WordResultData current in wordResults)
            {
                WordResultImpl arg_A9_0     = (WordResultImpl)this.mTrackedWords[current.id];
                Vector3        position     = arCameraTransform.TransformPoint(current.pose.position);
                Quaternion     orientation  = current.pose.orientation;
                Quaternion     orientation2 = arCameraTransform.rotation * orientation * Quaternion.AngleAxis(270f, Vector3.left);
                arg_A9_0.SetPose(position, orientation2);
                arg_A9_0.SetStatus(current.status);
                OrientedBoundingBox cameraFrameObb = new OrientedBoundingBox(current.orientedBoundingBox.center, current.orientedBoundingBox.halfExtents, current.orientedBoundingBox.rotation);
                arg_A9_0.SetObb(VuforiaRuntimeUtilities.CameraFrameToScreenSpaceCoordinates(cameraFrameObb, videoBackgroundRectInViewPort, isTextureMirrored, videoMode));
            }
            if (this.mWordPrefabCreationMode == WordPrefabCreationMode.DUPLICATE)
            {
                this.UpdateWordBehaviourPoses();
            }
        }
Exemplo n.º 2
0
        private void UpdateWords(IEnumerable <VuforiaManagerImpl.WordData> newWordData, IEnumerable <VuforiaManagerImpl.WordResultData> wordResults)
        {
            this.mNewWords.Clear();
            this.mLostWords.Clear();
            foreach (VuforiaManagerImpl.WordData current in newWordData)
            {
                if (!this.mTrackedWords.ContainsKey(current.id))
                {
                    WordResultImpl wordResultImpl = new WordResultImpl(new WordImpl(current.id, Marshal.PtrToStringUni(current.stringValue), current.size));
                    this.mTrackedWords.Add(current.id, wordResultImpl);
                    this.mNewWords.Add(wordResultImpl);
                }
            }
            List <int> list = new List <int>();

            foreach (VuforiaManagerImpl.WordResultData current2 in wordResults)
            {
                list.Add(current2.id);
            }
            foreach (int current3 in this.mTrackedWords.Keys.ToList <int>())
            {
                if (!list.Contains(current3))
                {
                    this.mLostWords.Add(this.mTrackedWords[current3].Word);
                    this.mTrackedWords.Remove(current3);
                }
            }
            if (this.mWordPrefabCreationMode == WordPrefabCreationMode.DUPLICATE)
            {
                this.UnregisterLostWords();
                this.AssociateWordResultsWithBehaviours();
            }
        }