public override unsafe void ProcessItems(Dictionary<short, MyLodEnvironmentItemSet> items, List<MySurfaceParams> surfaceParamsPerLod, int[] surfaceParamLodOffsets, int changedLodMin, int changedLodMax) { m_minScannedLod = changedLodMin; using (var batch = new MyEnvironmentModelUpdateBatch(Sector)) foreach (var group in items) { MyRuntimeEnvironmentItemInfo it; Sector.GetItemDefinition((ushort)group.Key, out it); MyDefinitionId modelCollection = new MyDefinitionId(typeof(MyObjectBuilder_PhysicalModelCollectionDefinition), it.Subtype); MyPhysicalModelCollectionDefinition modelCollectionDef = MyDefinitionManager.Static.GetDefinition<MyPhysicalModelCollectionDefinition>(modelCollection); if (modelCollectionDef != null) { var info = group.Value; int offt = info.LodOffsets[changedLodMin]; for (int i = offt; i < info.Items.Count; ++i) { var position = info.Items[i]; if (m_disabledItems.Contains(position) || IsObstructed(position)) continue; var modelDef = modelCollectionDef.Items.Sample(MyHashRandomUtils.UniformFloatFromSeed(position)); batch.Add(modelDef, position); } } } }
public virtual void ProcessItems(Dictionary<short, MyLodEnvironmentItemSet> items, List<MySurfaceParams> surfaceParamsPerLod, int[] surfaceParamLodOffsets, int changedLodMin, int changedLodMax) { using (var batch = new MyEnvironmentModelUpdateBatch(Sector)) foreach (var group in items) { MyRuntimeEnvironmentItemInfo it; Sector.GetItemDefinition((ushort)group.Key, out it); MyDefinitionId modelCollection = new MyDefinitionId(typeof(MyObjectBuilder_PhysicalModelCollectionDefinition), it.Subtype); MyPhysicalModelCollectionDefinition modelCollectionDef = MyDefinitionManager.Static.GetDefinition<MyPhysicalModelCollectionDefinition>(modelCollection); if (modelCollectionDef != null) { foreach (var position in group.Value.Items) { var sample = MyHashRandomUtils.UniformFloatFromSeed(position); var modelDef = modelCollectionDef.Items.Sample(sample); batch.Add(modelDef, position); } } } }