private bool CreateMultiTargets() { int num = VuforiaWrapper.Instance.DataSetGetNumTrackableType((int)TypeMapping.GetTypeID(typeof(MultiTarget)), this.mDataSetPtr); if (num <= 0) { return(false); } IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SimpleTargetData)) * num); if (VuforiaWrapper.Instance.DataSetGetTrackablesOfType((int)TypeMapping.GetTypeID(typeof(MultiTarget)), intPtr, num, this.mDataSetPtr) == 0) { Debug.LogError("Could not create Multi Targets"); return(false); } for (int i = 0; i < num; i++) { SimpleTargetData simpleTargetData = (SimpleTargetData)Marshal.PtrToStructure(new IntPtr(intPtr.ToInt64() + (long)(i * Marshal.SizeOf(typeof(SimpleTargetData)))), typeof(SimpleTargetData)); if (!this.mTrackablesDict.ContainsKey(simpleTargetData.id)) { StringBuilder stringBuilder = new StringBuilder(128); VuforiaWrapper.Instance.DataSetGetTrackableName(this.mDataSetPtr, simpleTargetData.id, stringBuilder, 128); MultiTarget value = new MultiTargetImpl(stringBuilder.ToString(), simpleTargetData.id, this); this.mTrackablesDict[simpleTargetData.id] = value; } } Marshal.FreeHGlobal(intPtr); return(true); }
internal override bool InitializeTarget(Trackable trackable, bool applyTargetScaleToBehaviour) { base.InitializeTarget(trackable, applyTargetScaleToBehaviour); MultiTargetImpl multiTargetImpl = trackable as MultiTargetImpl; if (multiTargetImpl == null) { return(false); } this.mTrackable = (this.mMultiTarget = multiTargetImpl); this.mTrackableName = multiTargetImpl.Name; this.mDataSetPath = multiTargetImpl.DataSet.Path; if (this.mExtendedTracking) { this.mMultiTarget.StartExtendedTracking(); } return(true); }