public InstanceHolder(int sectionIndex, ModelProperties props, IList <IBspGeometryInstanceBlock> instanceData) { this.sectionIndex = sectionIndex; TreeItems = new List <TreeItemModel>(); Placements = new List <InstancePlacement>(); var perms = props.Regions.SelectMany(r => r.Permutations) .Where(p => p.MeshIndex == sectionIndex); foreach (var p in perms) { var source = instanceData[p.SourceIndex]; Placements.Add(new InstancePlacement(p.SourceIndex) { Name = p.Name, MeshIndex = p.MeshIndex, TransformScale = p.TransformScale, Transform = p.Transform, SphereX = source.BoundingSpherePosition.X, SphereY = source.BoundingSpherePosition.Y, SphereZ = source.BoundingSpherePosition.Z, SphereRadius = source.BoundingSphereRadius }); } SetCapacity(Placements.Count); }
public IEnumerable <Task> ReadStructureBsp(StructureBspModel bspModel) { this.bspModel = bspModel; ClusterHolder = new ObjectHolder("Clusters"); InstanceHolders = new Dictionary <int, InstanceHolder>(); yield return(Task.Run(() => { factory.LoadTag(bspModel.StructureBspTag, false); modelProps = factory.GetProperties(tagId); var instanceData = ReadInstanceData(); foreach (var i in modelProps.InstanceMeshes) { InstanceHolders.Add(i, new InstanceHolder(i, modelProps, instanceData)); } })); }