private void UpdateProps(VuforiaManagerImpl.SmartTerrainRevisionData[] smartTerrainRevisions, VuforiaManagerImpl.PropData[] updatedPropData) { List <Prop> list = new List <Prop>(); List <Prop> list2 = new List <Prop>(); List <Prop> list3 = new List <Prop>(); for (int i = 0; i < updatedPropData.Length; i++) { VuforiaManagerImpl.PropData propData = updatedPropData[i]; bool flag = false; PropImpl propImpl; bool flag2; if (!this.mProps.ContainsKey(propData.id)) { propImpl = new PropImpl(propData.id, this.FindSmartTerrainTrackable(propData.parentID)); this.mProps.Add(propData.id, propImpl); list.Add(propImpl); flag2 = true; flag = true; } else { propImpl = (PropImpl)this.mProps[propData.id]; flag2 = (propData.revision != propImpl.MeshRevision); } if (flag2) { Mesh mesh = MeshUtils.UpdateMesh(propData.meshData, propImpl.GetMesh(), false, true); if (flag) { propImpl.SetLocalPose(propData.localPose); } propImpl.SetMesh(propData.revision, mesh); VuforiaManagerImpl.Obb3D boundingBox = propData.boundingBox; OrientedBoundingBox3D obb = new OrientedBoundingBox3D(boundingBox.center, boundingBox.halfExtents, boundingBox.rotationZ * 57.29578f); propImpl.SetObb(obb); list2.Add(propImpl); } else { Debug.LogError("Inconsistency: received updated Prop, but mesh revision is unchanged!"); } } int[] array = new int[this.mProps.Count]; this.mProps.Keys.CopyTo(array, 0); int[] array2 = array; for (int i = 0; i < array2.Length; i++) { int num = array2[i]; bool flag3 = false; for (int j = 0; j < smartTerrainRevisions.Length; j++) { if (smartTerrainRevisions[j].id == num) { flag3 = true; } } if (!flag3) { list3.Add(this.mProps[num]); ((PropImpl)this.mProps[num]).DestroyMesh(); this.mProps.Remove(num); } } this.UnregisterDeletedProps(list3); foreach (Prop current in list3) { if (current.Parent != null) { ((SmartTerrainTrackableImpl)current.Parent).RemoveChild(current); } } foreach (Prop current2 in list) { if (current2.Parent != null) { ((SmartTerrainTrackableImpl)current2.Parent).AddChild(current2); } } this.NotifyPropEventHandlers(list, list2, list3); }
internal void SetObb(OrientedBoundingBox3D obb3D) { this.mOrientedBoundingBox3D = obb3D; }