Exemple #1
0
 public override TargetFinder.UpdateState Update(TargetFinder.FilterMode filterMode)
 {
     VuforiaWrapper.Instance.TargetFinderUpdate(this.mTargetFinderStatePtr, (int)filterMode);
     this.mTargetFinderState = (TargetFinderImpl.TargetFinderState)Marshal.PtrToStructure(this.mTargetFinderStatePtr, typeof(TargetFinderImpl.TargetFinderState));
     if (this.mTargetFinderState.ResultCount > 0)
     {
         IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TargetFinderImpl.InternalTargetSearchResult)) * this.mTargetFinderState.ResultCount);
         if (VuforiaWrapper.Instance.TargetFinderGetResults(intPtr, this.mTargetFinderState.ResultCount) != 1)
         {
             Debug.LogError("TargetFinder: Could not retrieve new results!");
             return(TargetFinder.UpdateState.UPDATE_NO_MATCH);
         }
         this.mNewResults = new List <TargetFinder.TargetSearchResult>();
         for (int i = 0; i < this.mTargetFinderState.ResultCount; i++)
         {
             TargetFinderImpl.InternalTargetSearchResult internalTargetSearchResult = (TargetFinderImpl.InternalTargetSearchResult)Marshal.PtrToStructure(new IntPtr(intPtr.ToInt64() + (long)(i * Marshal.SizeOf(typeof(VuforiaManagerImpl.TrackableResultData)))), typeof(TargetFinderImpl.InternalTargetSearchResult));
             this.mNewResults.Add(new TargetFinder.TargetSearchResult
             {
                 TargetName            = Marshal.PtrToStringAnsi(internalTargetSearchResult.TargetNamePtr),
                 UniqueTargetId        = Marshal.PtrToStringAnsi(internalTargetSearchResult.UniqueTargetIdPtr),
                 TargetSize            = internalTargetSearchResult.TargetSize,
                 MetaData              = Marshal.PtrToStringAnsi(internalTargetSearchResult.MetaDataPtr),
                 TrackingRating        = (byte)internalTargetSearchResult.TrackingRating,
                 TargetSearchResultPtr = internalTargetSearchResult.TargetSearchResultPtr
             });
         }
         Marshal.FreeHGlobal(intPtr);
     }
     return((TargetFinder.UpdateState) this.mTargetFinderState.UpdateState);
 }
Exemple #2
0
 public abstract TargetFinder.UpdateState Update(TargetFinder.FilterMode filterMode);