public void HandleTargetFinderResult(Vuforia.TargetFinder.TargetSearchResult targetSearchResult)
    {
        Debug.Log("<color=blue>HandleTargetFinderResult(): " + targetSearchResult.TargetName + "</color>");

        targetMetaData = targetSearchResult.MetaData;


        // cloudTargetInfo.text =
        //     "Name: " + targetSearchResult.TargetName +
        //     "\nSize: " + targetSearchResult.TargetSize +
        //     "\nRating: " + starRatings[targetSearchResult.TrackingRating] +
        //     "\nMetaData: " + ((targetSearchResult.MetaData.Length > 0) ? targetSearchResult.MetaData : "No") +
        //     "\nTarget Id: " + targetSearchResult.UniqueTargetId;

        //GameObject augmentation = GetValuefromDictionary(Augmentations, targetSearchResult.TargetName);

        // if (augmentation != null)
        // {
        //     if (augmentation.transform.parent != CloudTarget.transform)
        //     {
        //         Renderer[] augmentationRenderers;

        //         if (currentAugmentation != null && currentAugmentation.parent == CloudTarget)
        //         {
        //             currentAugmentation.SetParent(contentManagerParent);
        //             currentAugmentation.transform.localPosition = Vector3.zero;
        //             currentAugmentation.transform.localScale = Vector3.one;

        //             augmentationRenderers = currentAugmentation.GetComponentsInChildren<Renderer>();
        //             foreach (var objrenderer in augmentationRenderers)
        //             {
        //                 objrenderer.gameObject.layer = LayerMask.NameToLayer("UI");
        //                 objrenderer.enabled = true;
        //             }
        //         }

        //         // store reference to content manager's parent object of the augmentation
        //         contentManagerParent = augmentation.transform.parent;
        //         // store reference to the current augmentation
        //         currentAugmentation = augmentation.transform;

        //         // set new target augmentation parent to cloud target
        //         augmentation.transform.SetParent(CloudTarget);
        //         augmentation.transform.localPosition = Vector3.zero;
        //         augmentation.transform.localScale = Vector3.one;

        //         augmentationRenderers = augmentation.GetComponentsInChildren<Renderer>();
        //         foreach (var objrenderer in augmentationRenderers)
        //         {
        //             objrenderer.gameObject.layer = LayerMask.NameToLayer("Default");
        //             objrenderer.enabled = true;
        //         }

        //     }
        // }
    }
Пример #2
0
 public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
 {
     mTargetMetadata = targetSearchResult.MetaData;
     mCloudRecoBehaviour.CloudRecoEnabled = false;
     Debug.Log("Detected" + mTargetMetadata);
     mshowGUI    = true;
     showMessage = false;
     show3339Btn = false;
     show3333Btn = false;
     show3317Btn = false;
     pano3317Img = false;
     pano3333Img = false;
 }
 private void Update()
 {
     if (this.mOnInitializedCalled)
     {
         if (this.mCurrentlyInitializing)
         {
             this.CheckInitialization();
             return;
         }
         if (this.mInitSuccess)
         {
             TargetFinder.UpdateState updateState = this.mObjectTracker.TargetFinder.Update();
             if (updateState == TargetFinder.UpdateState.UPDATE_RESULTS_AVAILABLE)
             {
                 using (IEnumerator <TargetFinder.TargetSearchResult> enumerator = this.mObjectTracker.TargetFinder.GetResults().GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         TargetFinder.TargetSearchResult current = enumerator.Current;
                         using (List <ICloudRecoEventHandler> .Enumerator enumerator2 = this.mHandlers.GetEnumerator())
                         {
                             while (enumerator2.MoveNext())
                             {
                                 enumerator2.Current.OnNewSearchResult(current);
                             }
                         }
                     }
                     return;
                 }
             }
             if (updateState < TargetFinder.UpdateState.UPDATE_NO_MATCH)
             {
                 using (List <ICloudRecoEventHandler> .Enumerator enumerator2 = this.mHandlers.GetEnumerator())
                 {
                     while (enumerator2.MoveNext())
                     {
                         enumerator2.Current.OnUpdateError(updateState);
                     }
                 }
             }
         }
     }
 }
Пример #4
0
        public override ImageTargetAbstractBehaviour EnableTracking(TargetFinder.TargetSearchResult result, GameObject gameObject)
        {
            IntPtr          intPtr          = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ImageTargetData)));
            int             num             = VuforiaWrapper.Instance.TargetFinderEnableTracking(result.TargetSearchResultPtr, intPtr);
            ImageTargetData imageTargetData = (ImageTargetData)Marshal.PtrToStructure(intPtr, typeof(ImageTargetData));

            Marshal.FreeHGlobal(intPtr);
            StateManagerImpl             stateManagerImpl = (StateManagerImpl)TrackerManager.Instance.GetStateManager();
            ImageTargetAbstractBehaviour result2          = null;

            if (imageTargetData.id == -1)
            {
                Debug.LogError("TargetSearchResult " + result.TargetName + " could not be enabled for tracking.");
            }
            else
            {
                ImageTarget imageTarget = new CloudRecoImageTargetImpl(result.TargetName, imageTargetData.id, imageTargetData.size);
                this.mImageTargets[imageTargetData.id] = imageTarget;
                result2 = stateManagerImpl.FindOrCreateImageTargetBehaviourForTrackable(imageTarget, gameObject);
            }
            IntPtr intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * num);

            VuforiaWrapper.Instance.TargetFinderGetImageTargets(intPtr2, num);
            List <int> list = new List <int>();

            for (int i = 0; i < num; i++)
            {
                int item = Marshal.ReadInt32(new IntPtr(intPtr2.ToInt64() + (long)(i * Marshal.SizeOf(typeof(int)))));
                list.Add(item);
            }
            Marshal.FreeHGlobal(intPtr2);
            ImageTarget[] array = this.mImageTargets.Values.ToArray <ImageTarget>();
            for (int j = 0; j < array.Length; j++)
            {
                ImageTarget imageTarget2 = array[j];
                if (!list.Contains(imageTarget2.ID))
                {
                    stateManagerImpl.DestroyTrackableBehavioursForTrackable(imageTarget2, true);
                    this.mImageTargets.Remove(imageTarget2.ID);
                }
            }
            return(result2);
        }
Пример #5
0
 public abstract ImageTargetAbstractBehaviour EnableTracking(TargetFinder.TargetSearchResult result, GameObject gameObject);
Пример #6
0
 public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
 {
     url = targetSearchResult.MetaData;
 }
Пример #7
0
        public override ImageTargetAbstractBehaviour EnableTracking(TargetFinder.TargetSearchResult result, string gameObjectName)
        {
            GameObject gameObject = new GameObject(gameObjectName);

            return(this.EnableTracking(result, gameObject));
        }