private bool CreateVuMarkTemplates() { int num = VuforiaWrapper.Instance.DataSetGetNumTrackableType((int)TypeMapping.GetTypeID(typeof(VuMarkTemplate)), this.mDataSetPtr); if (num <= 0) { return(false); } IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SimpleTargetData)) * num); if (VuforiaWrapper.Instance.DataSetGetTrackablesOfType((int)TypeMapping.GetTypeID(typeof(VuMarkTemplate)), intPtr, num, this.mDataSetPtr) == 0) { Debug.LogError("Could not create VuMark Template"); 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); VuMarkTemplateImpl value = new VuMarkTemplateImpl(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); VuMarkTemplateImpl vuMarkTemplateImpl = (VuMarkTemplateImpl)trackable; if (vuMarkTemplateImpl == null) { return(false); } this.mTrackable = (this.mVuMarkTemplate = vuMarkTemplateImpl); this.mTrackableName = trackable.Name; this.mDataSetPath = vuMarkTemplateImpl.DataSet.Path; Vector3 size = vuMarkTemplateImpl.GetSize(); this.mAspectRatio = size.y / size.x; if (applyTargetScaleToBehaviour) { float num = Mathf.Max(size.x, size.y); base.transform.localScale = new Vector3(num, num, num); base.CorrectScale(); } Vector2 size2 = this.GetSize(); this.mVuMarkTemplate.SetSize(size2); this.mVuMarkTemplate.TrackingFromRuntimeAppearance = this.mTrackingFromRuntimeAppearance; if (this.mExtendedTracking) { this.mVuMarkTemplate.StartExtendedTracking(); } return(true); }
private VuMarkTarget CreateVuMarkTarget(VuforiaManagerImpl.VuMarkTargetData newVuMark) { VuMarkTemplateImpl template = (VuMarkTemplateImpl)this.GetVuMarkTemplate(newVuMark.templateId); uint dataLength = newVuMark.instanceId.dataLength; byte[] array = new byte[dataLength]; if (array.Length != 0) { Marshal.Copy(newVuMark.instanceId.buffer, array, 0, array.Length); } return(new VuMarkTargetImpl(newVuMark.id, array, newVuMark.instanceId.numericValue, (InstanceIdType)newVuMark.instanceId.dataType, dataLength, template)); }
public VuMarkTargetImpl(int id, byte[] buffer, ulong numericValue, InstanceIdType dataType, uint dataLength, VuMarkTemplateImpl template) { this.mTargetId = id; this.mVuMarkTemplate = template; this.mInstanceId = new InstanceIdImpl(buffer, numericValue, dataType, dataLength); }