private void CreateDoctFromCoct(IList <CollisionMesh> vifPacketRenderingGroupIndexMatched) { // directly mapping: // coctMesh → doct.Entry2 // coctMeshGroup → doct.Entry1 var coctMeshList = new List <CollisionMesh>(); foreach (var coctMeshGroup in coct.CollisionMeshGroupList) { var vifPacketIndices = coctMeshGroup.Meshes .Select(it => vifPacketRenderingGroupIndexMatched.IndexOf(it)) .ToArray(); var minIdx = 0; var maxIdx = 0; if (vifPacketIndices.Length != 0) { minIdx = vifPacketIndices.Min(); maxIdx = vifPacketIndices.Max() + 1; } doct.Entry1List.Add( new Doct.Entry1 { Child1 = coctMeshGroup.Child1, Child2 = coctMeshGroup.Child2, Child3 = coctMeshGroup.Child3, Child4 = coctMeshGroup.Child4, Child5 = coctMeshGroup.Child5, Child6 = coctMeshGroup.Child6, Child7 = coctMeshGroup.Child7, Child8 = coctMeshGroup.Child8, BoundingBox = coctMeshGroup.BoundingBox.ToBoundingBox(), Entry2Index = (ushort)minIdx, Entry2LastIndex = (ushort)maxIdx, } ); } foreach (var coctMesh in vifPacketRenderingGroupIndexMatched) { doct.Add( new Doct.Entry2 { BoundingBox = coctMesh.BoundingBox .ToBoundingBox(), } ); } }
private void CreateDoctFromCoct() { // directly mapping: // coctMesh → doct.Entry2 // coctMeshGroup → doct.Entry1 foreach (var coctMesh in coct.CollisionMeshList) { doct.Add( new Doct.Entry2 { BoundingBox = coctMesh.BoundingBox .ToBoundingBox(), } ); } foreach (var coctMeshGroup in coct.CollisionMeshGroupList) { doct.Entry1List.Add( new Doct.Entry1 { Child1 = coctMeshGroup.Child1, Child2 = coctMeshGroup.Child2, Child3 = coctMeshGroup.Child3, Child4 = coctMeshGroup.Child4, Child5 = coctMeshGroup.Child5, Child6 = coctMeshGroup.Child6, Child7 = coctMeshGroup.Child7, Child8 = coctMeshGroup.Child8, BoundingBox = coctMeshGroup.BoundingBox.ToBoundingBox(), Entry2Index = coctMeshGroup.CollisionMeshStart, Entry2LastIndex = coctMeshGroup.CollisionMeshEnd, } ); } }