internal void InitInternal(MyModels models, bool isVisible, MyVisibilityExtFlags visibilityExt, MyCompatibilityDataForTheOldPipeline compatibilityData) { Models = models; KeyColor = new HalfVector3(); m_instanceMaterials = MyObjectPoolManager.Allocate <MyInstanceMaterialList>(); int instanceMaterialsCount = models.StandardModel.GetUniqueMaterialsCount(); // the other models do not use this mechanism m_instanceMaterials.SetSize(instanceMaterialsCount); for (int i = 0; i < instanceMaterialsCount; i++) { m_instanceMaterials.Set(i, MyInstanceMaterial.Default); } m_cpuCulledEntity = MyObjectPoolManager.Allocate <MyCpuCulledEntity>(); // Bounding entity will be just registered, bounding box will be updated in the loopback OnAabbChange() BoundingBoxD boxTemporary = new BoundingBoxD(models.StandardModel.BoundingBox.Min, models.StandardModel.BoundingBox.Max); m_cpuCulledEntity.Register(boxTemporary, this); m_visibilityStrategy.Init(isVisible, visibilityExt); SetSingleInstanceTransformStrategy(); m_lodStrategy.Init(); Owner.SetMatrix(ref MatrixD.Identity); Owner.SetLocalAabb(models.StandardModel.BoundingBox); CompatibilityDataForTheOldPipeline = compatibilityData; }
internal void InitAndRegister(MyInstanceComponent instance, MyModels models, bool isVisible, MyVisibilityExtFlags visibilityExt, MyCompatibilityDataForTheOldPipeline compatibilityData) { MyRenderProxy.Assert(!m_instances.Contains(instance)); instance.InitInternal(models, isVisible, visibilityExt, compatibilityData); m_instances.Add(instance); }