static void PreallocateObjects() { if (m_objectPool == null) { m_objectPool = new MyObjectsPool <MyExplosionDebrisVoxel>(MyExplosionsConstants.MAX_EXPLOSION_DEBRIS_OBJECTS); } m_objectPool.DeallocateAll(); // This collision primitive is used by every instance of this class MyModel model = MyModels.GetModelOnlyData(VOXEL_DEBRIS_MODEL_ENUM); BoundingSphere boundingSphere = model.BoundingSphere; List <MyRBElementDesc> collisionPrimitives = new List <MyRBElementDesc>(); MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); MyRBSphereElementDesc sphereDesc = physobj.GetRBSphereElementDesc(); MyMaterialType materialType = MyMaterialType.ROCK; sphereDesc.SetToDefault(); sphereDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(materialType).PhysicsMaterial; sphereDesc.m_Radius = boundingSphere.Radius; sphereDesc.m_Matrix.Translation = model.BoundingSphere.Center; collisionPrimitives.Add(sphereDesc); int counter = 0; foreach (LinkedListNode <MyExplosionDebrisVoxel> item in m_objectPool.GetPreallocatedItemsArray()) { item.Value.Init(collisionPrimitives); counter++; } }
static void PreallocateObjects() { if (m_objectPool == null) { m_objectPool = new MyObjectsPool <MyExplosionDebrisModel>(MyExplosionsConstants.MAX_EXPLOSION_DEBRIS_OBJECTS); } m_objectPool.DeallocateAll(); List <MyRBElementDesc> collisionPrimitives = new List <MyRBElementDesc>(); MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); MyRBSphereElementDesc sphereDesc = physobj.GetRBSphereElementDesc(); sphereDesc.SetToDefault(); sphereDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(MODEL_DEBRIS_MATERIAL_TYPE).PhysicsMaterial; collisionPrimitives.Add(sphereDesc); int counter = 0; foreach (var item in m_objectPool.GetPreallocatedItemsArray()) { MyModelsEnum modelEnum = (MyModelsEnum)((int)MyModelsEnum.Debris1 + counter % 31); MyModel model = MyModels.GetModelOnlyData(modelEnum); BoundingSphere boundingSphere = model.BoundingSphere; sphereDesc.m_Radius = boundingSphere.Radius; sphereDesc.m_Matrix.Translation = boundingSphere.Center; item.Value.Init(collisionPrimitives, modelEnum); counter++; } }
protected override void UnloadData() { if (m_projectiles != null) { m_projectiles.DeallocateAll(); } }
internal static void RemoveAll() { foreach (var actor in m_pool.Active) { actor.Destruct(); } m_pool.DeallocateAll(); }
internal static void RemoveAll() { foreach (var item in m_pool.Active) { item.Destruct(); } m_pool.DeallocateAll(); }
public static void UnloadData() { foreach (LinkedListNode <MyExplosion> explosion in m_explosions) { explosion.Value.Close(); } m_explosions.DeallocateAll(); }
private void ClearTexts() { m_textSizes.Clear(); foreach (StringBuilder text in m_texts) { text.Clear(); } m_textsPool.DeallocateAll(); m_texts.Clear(); }
protected override void UnloadData() { if (m_preallocatedLights != null) { // all lights should be deallocated at this point MyDebug.AssertDebug(m_preallocatedLights.ActiveCount == 0, "MyLights.UnloadData: preallocated lights not emptied!"); m_preallocatedLights.DeallocateAll(); m_preallocatedLights = null; } }
public static void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyTransparentGeometry.LoadData"); MyLog.Default.WriteLine(string.Format("MyTransparentGeometry.LoadData - START")); m_animatedParticles.DeallocateAll(); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public static void UnloadData() { // all lights should be deallocated at this point MyCommonDebugUtils.AssertDebug(m_preallocatedLights.GetActiveCount() == 0, "MyLights.UnloadData: preallocated lights not emptied!"); m_preallocatedLights.DeallocateAll(); if (m_sortedLights != null) { m_sortedLights.Clear(); m_sortedLights = null; } m_tree.Clear(); }
protected override void UnloadData() { if (m_explosions != null) { foreach (MyExplosion explosion in m_explosions.Active) { explosion.Close(); } m_explosions.DeallocateAll(); } m_explosionsRead.Clear(); m_explosionsWrite.Clear(); }
public static void LoadData() { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMissiles.LoadData"); MyMwcLog.WriteLine("MyMissiles.LoadContent() - START"); MyMwcLog.IncreaseIndent(); if (m_missiles == null) { m_missiles = new MyObjectsPool <MyMissile>(MyMissileConstants.MAX_MISSILES_COUNT); } m_missiles.DeallocateAll(); foreach (LinkedListNode <MyMissile> item in m_missiles.GetPreallocatedItemsArray()) { item.Value.Init(); } MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMissiles.LoadContent() - END"); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
public static void LoadData() { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyHologramShips.LoadData"); MyMwcLog.WriteLine("MyHologramShips.LoadContent() - START"); MyMwcLog.IncreaseIndent(); if (m_hologramShips == null) { m_hologramShips = new MyObjectsPool <MySmallShip>(MyUniversalLauncherConstants.MAX_HOLOGRAMS_COUNT * MyMultiplayerGameplay.MaxPlayers); } m_hologramShips.DeallocateAll(); foreach (var item in m_hologramShips.GetPreallocatedItemsArray()) { // TODO simon - do we need something here? //item.Value.Init(); } MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyHologramShips.LoadContent() - END"); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
public static void UnloadData() { m_projectiles.DeallocateAll(); }
internal void Clear() { m_triangles.DeallocateAll(); }
void ClearRenderPasses(List <MyRenderPass> renderPasses) { m_depthPassesPool.DeallocateAll(); renderPasses.Clear(); }
public static void UnloadData() { m_preallocatedContents.DeallocateAll(); //m_preallocatedContents = null; }
/// <summary> /// Render method is called directly by renderer. Depending on stage, post process can do various things /// </summary> /// <param name="postProcessStage">Stage indicating in which part renderer currently is.</param>public override void RenderAfterBlendLights() public static void Draw() { switch (m_State) { case NuclearState.FADE_IN: m_flashIntensity = (MyMinerGame.TotalGamePlayTimeInMilliseconds - m_StartMilliseconds) / FADE_IN_TIME; if (m_flashIntensity >= 1.0f) { m_State = NuclearState.FLASH; m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; } break; case NuclearState.FLASH: m_flashIntensity = 1.0f; if (MyMinerGame.TotalGamePlayTimeInMilliseconds > (m_StartMilliseconds + FLASH_TIME)) { m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; m_State = NuclearState.FLASH_IN; } break; case NuclearState.FLASH_IN: //m_flashIntensity = 1.0f - ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_StartMilliseconds) / 2000.0f/*MyFlashBombConstants.FADE_OUT_TIME*/); m_flashIntensity = 1 + 10 * (MyMinerGame.TotalGamePlayTimeInMilliseconds - m_StartMilliseconds) / FLASH_IN_TIME; if (m_flashIntensity >= 11.0f) { if (m_burningCue != null && m_burningCue.Value.IsPlaying) { m_burningCue.Value.Stop(SharpDX.XACT3.StopFlags.Release); } if (OnExplosionMax != null) { OnExplosionMax(); } m_State = NuclearState.FADE_OUT; m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; } break; case NuclearState.FADE_OUT: m_flashIntensity = 1 + MAX_FLASH_INTENSITY * (1.0f - ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_StartMilliseconds) / FADE_OUT_TIME)); if (m_flashIntensity <= 0) { m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; m_State = NuclearState.INACTIVE; MyPostProcessGodRays godRays = (MyPostProcessGodRays)MyRender.GetPostProcess(MyPostProcessEnum.GodRays); godRays.Enabled = m_godRaysState; MySector.GodRaysProperties.Enabled = false; m_preallocatedExplosionLines.DeallocateAll(); m_flashIntensity = 0; if (OnExplosionDone != null) { OnExplosionDone(); } } break; } if (m_State != NuclearState.INACTIVE) { MyRender.Sun.Direction = Vector3.Normalize(MyCamera.Position - m_explosionCenter); MyRender.Sun.Intensity = 10 * m_flashIntensity; MyRender.Sun.Color = Vector4.One; MinerWars.AppCode.Game.Managers.Session.MySession.PlayerShip.DoDamage(m_flashIntensity * MyConstants.PHYSICS_STEP_SIZE_IN_SECONDS, 0, 0, MyDamageType.Radioactivity, MyAmmoType.None, null); MinerWars.AppCode.Game.Managers.Session.MySession.PlayerShip.IncreaseHeadShake(MathHelper.Clamp(2f * m_flashIntensity, 3, 10)); UpdateExplosionLines(); MyTransparentGeometry.AddPointBillboard(MyTransparentMaterialEnum.SunDisk, Vector4.One, m_explosionCenter, Math.Max(m_flashIntensity * 5000, 1), 0); foreach (LinkedListNode <ExplosionLine> explosionLine in m_preallocatedExplosionLines) { MyTransparentGeometry.AddLineBillboard(MyTransparentMaterialEnum.Smoke_square_unlit, Vector4.One, m_explosionCenter, explosionLine.Value.ActualDir, 10000, 100); } MySector.GodRaysProperties.Exposition = 0.5f * m_flashIntensity; //0.077f MySector.GodRaysProperties.Weight = 2.5f * m_flashIntensity; //1.27f } }