public static void MakeExplosion(Vector3 explosionCenter) { m_explosionCenter = explosionCenter; if (m_State == NuclearState.INACTIVE || m_State == NuclearState.FLASH_IN) { m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; m_State = NuclearState.FADE_IN; m_burningCue = MyAudio.AddCue3D(MySoundCuesEnum.SfxSolarWind, m_explosionCenter, -MyCamera.ForwardVector, Vector3.Up, Vector3.Zero); MyAudio.AddCue3D(MySoundCuesEnum.SfxNuclearExplosion, m_explosionCenter, -MyCamera.ForwardVector, Vector3.Up, Vector3.Zero); m_radius = 100; MinerWars.AppCode.Game.TransparentGeometry.Particles.MyParticleEffect explosion = MinerWars.AppCode.Game.TransparentGeometry.Particles.MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Explosion_Huge); explosion.WorldMatrix = Matrix.CreateWorld(m_explosionCenter, MyCamera.ForwardVector, MyCamera.UpVector); explosion.UserScale = 3; explosion.AutoDelete = true; MyPostProcessGodRays godRays = (MyPostProcessGodRays)MyRender.GetPostProcess(MyPostProcessEnum.GodRays); m_godRaysState = godRays.Enabled; godRays.Enabled = true; MySector.GodRaysProperties.Enabled = true; } else if (m_State == NuclearState.FLASH) { m_StartMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds; } }
public override void RecreateControls(bool contructor) { Controls.Clear(); AddCaption(new StringBuilder("Volumetric SSAO Debug"), Color.Yellow.ToVector4()); MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); Controls.Add(label); m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f); MyPostProcessVolumetricSSAO2 volumetricSsaoPP = MyRender.GetPostProcess(MyPostProcessEnum.VolumetricSSAO2) as MyPostProcessVolumetricSSAO2; if (volumetricSsaoPP == null) { label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.1f), null, new System.Text.StringBuilder("Sorry SSAO post process is not available"), Color.Red.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); Controls.Add(label); return; } MyEffectVolumetricSSAO2 volumetricSsaoEffect = MyRender.GetEffect(MyEffects.VolumetricSSAO) as MyEffectVolumetricSSAO2; AddCheckBox(new StringBuilder("Use SSAO"), volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Enabled)); AddCheckBox(new StringBuilder("Use blur"), volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.UseBlur)); AddCheckBox(new StringBuilder("Show only SSAO"), volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.ShowOnlySSAO)); m_currentPosition.Y += 0.01f; // AddSlider(new StringBuilder("Offset"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.Offset)); // AddSlider(new StringBuilder("SiluetteDist"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.SiluetteDist)); // AddSlider(new StringBuilder("R"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.R)); AddSlider(new StringBuilder("MinRadius"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.MinRadius)); AddSlider(new StringBuilder("MaxRadius"), 0, 1000, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.MaxRadius)); AddSlider(new StringBuilder("RadiusGrowZScale"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.RadiusGrowZScale)); AddSlider(new StringBuilder("CameraZFar"), 0, 100000, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.CameraZFar)); AddSlider(new StringBuilder("Bias"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Bias)); AddSlider(new StringBuilder("Falloff"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Falloff)); AddSlider(new StringBuilder("NormValue"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.NormValue)); //AddSlider(new StringBuilder("ColorScale"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.ColorScale)); AddSlider(new StringBuilder("Contrast"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Contrast)); m_currentPosition.Y += 0.01f; }
public override void RecreateControls(bool contructor) { Controls.Clear(); m_scale = 0.7f; AddCaption(new System.Text.StringBuilder("Render HDR"), Color.Yellow.ToVector4()); MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); Controls.Add(label); m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f); m_currentPosition.Y += 0.01f * m_scale; MyPostProcessHDR hdr = MyRender.GetPostProcess(MyPostProcessEnum.HDR) as MyPostProcessHDR; if (hdr != null) { AddLabel(new StringBuilder("HDR"), Color.Yellow.ToVector4(), 1.2f); AddCheckBox(new StringBuilder("Enable HDR and bloom"), null, MemberHelper.GetMember(() => MyPostProcessHDR.DebugHDRChecked)); m_currentPosition.Y += 0.01f * m_scale; AddSlider(new StringBuilder("Exposure"), 0, 6.0f, hdr, MemberHelper.GetMember(() => hdr.Exposure)); AddSlider(new StringBuilder("Bloom Threshold"), 0, 4.0f, hdr, MemberHelper.GetMember(() => hdr.Threshold)); AddSlider(new StringBuilder("Bloom Intensity"), 0, 4.0f, hdr, MemberHelper.GetMember(() => hdr.BloomIntensity)); AddSlider(new StringBuilder("Bloom Intensity for Background"), 0, 1.5f, hdr, MemberHelper.GetMember(() => hdr.BloomIntensityBackground)); AddSlider(new StringBuilder("Vertical Blur Amount"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.VerticalBlurAmount)); AddSlider(new StringBuilder("Horizontal Blur Amount"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.HorizontalBlurAmount)); AddSlider(new StringBuilder("Number of blur passes (integer)"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.NumberOfBlurPasses)); m_currentPosition.Y += 0.01f * m_scale; } }
public override void RecreateControls(bool contructor) { Controls.Clear(); m_scale = 0.62f; AddCaption(new System.Text.StringBuilder("Colors settings"), Color.Yellow.ToVector4()); MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); Controls.Add(label); m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f); m_currentPosition.Y += 0.01f; AddLabel(new StringBuilder("Sun"), Color.Yellow.ToVector4(), 1.2f); var sunObj = MySector.SunProperties; MyEffectShadowMap shadowMapEffect = MyRender.GetEffect(MyEffects.ShadowMap) as MyEffectShadowMap; if (shadowMapEffect != null) { m_currentPosition.Y += 0.01f; AddSlider(new StringBuilder("Intensity"), 0, 10.0f, sunObj, MemberHelper.GetMember(() => MySector.SunProperties.SunIntensity)); m_currentPosition.Y += 0.01f; AddColor(new StringBuilder("Sun color"), sunObj, MemberHelper.GetMember(() => MySector.SunProperties.SunDiffuse)); m_currentPosition.Y += 0.02f; AddColor(new StringBuilder("Sun specular"), sunObj, MemberHelper.GetMember(() => MySector.SunProperties.SunSpecular)); m_currentPosition.Y += 0.02f; AddSlider(new StringBuilder("Back sun intensity"), 0, 5.0f, sunObj, MemberHelper.GetMember(() => MySector.SunProperties.BackSunIntensity)); m_currentPosition.Y += 0.01f; AddColor(new StringBuilder("Back sun color"), sunObj, MemberHelper.GetMember(() => MySector.SunProperties.BackSunDiffuse)); m_currentPosition.Y += 0.02f; AddColor(new StringBuilder("Ambient color"), sunObj, MemberHelper.GetMember(() => MySector.SunProperties.AmbientColor)); m_currentPosition.Y += 0.02f; AddSlider(new StringBuilder("Ambient multiplier"), 0, 5.0f, sunObj, MemberHelper.GetMember(() => MySector.SunProperties.AmbientMultiplier)); AddSlider(new StringBuilder("Env. ambient intensity"), 0, 5.0f, sunObj, MemberHelper.GetMember(() => MySector.SunProperties.EnvironmentAmbientIntensity)); } /* * //m_currentPosition.Y += 0.01f; * AddLabel(new StringBuilder("Player ship"), Color.Yellow.ToVector4(), 1.2f); * * //m_currentPosition.Y += 0.01f; * AddSlider(new StringBuilder("Light range multiplier"), 0, 10, null, MemberHelper.GetMember(() => MySmallShip.LightRangeMultiplier)); * AddSlider(new StringBuilder("Light intensity multiplier"), 0, 10, null, MemberHelper.GetMember(() => MySmallShip.LightIntensityMultiplier)); * AddSlider(new StringBuilder("Reflector intensity multiplier"), 0, 10, null, MemberHelper.GetMember(() => MySmallShip.ReflectorIntensityMultiplier)); */ //m_currentPosition.Y += 0.01f; AddLabel(new StringBuilder("Post process"), Color.Yellow.ToVector4(), 1.2f); //m_currentPosition.Y += 0.01f; MyPostProcessContrast contrastPP = MyRender.GetPostProcess(MyPostProcessEnum.Contrast) as MyPostProcessContrast; if (contrastPP != null) { AddSlider(new StringBuilder("Contrast"), -10, 10, contrastPP, MemberHelper.GetMember(() => contrastPP.Contrast)); AddSlider(new StringBuilder("Hue"), -10, 10, contrastPP, MemberHelper.GetMember(() => contrastPP.Hue)); AddSlider(new StringBuilder("Saturation"), -10, 10, contrastPP, MemberHelper.GetMember(() => contrastPP.Saturation)); } m_currentPosition.Y += 0.01f; }
/// <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 } }
private void CreateControls() { Controls.Clear(); foreach (MyDevelopGroup developerGroup in s_developerGroups) { if (developerGroup.Item2.Count > 0) { EnableGroup(developerGroup.Item2, false); developerGroup.Item2.Clear(); } } foreach (MyDevelopGroup mainGroup in s_mainGroups) { if (mainGroup.Item2.Count > 0) { EnableGroup(mainGroup.Item2, false); mainGroup.Item2.Clear(); } } AddCaption(MyTextsWrapperEnum.DeveloperCaption, Color.Yellow.ToVector4()); m_scale = 0.9f; m_closeOnEsc = true; m_checkBoxOffset = 0.015f; m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.03f, /*0.15f*//*0.05f*/ 0.15f); float buttonOffset = 0; foreach (MyDevelopGroup mainGroup in s_mainGroups) { mainGroup.Item1 = new MyGuiControlButton(this, new Vector2(-0.03f + m_currentPosition.X + buttonOffset, m_currentPosition.Y), new Vector2(0.09f, 0.03f), new Vector4(1, 1, 0.5f, 1), new StringBuilder(mainGroup.Name), null, Color.Yellow.ToVector4(), MyGuiConstants.DEBUG_BUTTON_TEXT_SCALE * MyGuiConstants.DEBUG_LABEL_TEXT_SCALE * m_scale * 1.2f, OnClickMainGroup, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true); buttonOffset += 0.09f; Controls.Add(mainGroup.Item1); } m_currentPosition.Y += 0.04f * m_scale; float mainStartPosition = m_currentPosition.Y; CreateDebugDrawControls(); m_currentPosition.Y = mainStartPosition; CreatePerformanceControls(); foreach (MyDevelopGroup mainGroup in s_mainGroups) { EnableGroup(mainGroup.Item2, false); } EnableGroup(s_activeMainGroup.Item2, true); //Screens AddLabel(new StringBuilder("Debug screens"), Color.Yellow.ToVector4(), 1.2f); buttonOffset = 0; foreach (MyDevelopGroup developerGroup in s_developerGroups) { developerGroup.Item1 = new MyGuiControlButton(this, new Vector2(-0.03f + m_currentPosition.X + buttonOffset, m_currentPosition.Y), new Vector2(0.09f, 0.03f), new Vector4(1, 1, 0.5f, 1), new StringBuilder(developerGroup.Name), null, Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * MyGuiConstants.DEBUG_BUTTON_TEXT_SCALE * m_scale * 1.2f, OnClickGroup, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true); buttonOffset += 0.09f; Controls.Add(developerGroup.Item1); } m_currentPosition.Y += 0.04f * m_scale; float groupStartPosition = m_currentPosition.Y; AddGroupBox(new StringBuilder("Overall settings"), s_debugRenderScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Lights settings"), s_debugRenderLightsScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Color settings"), s_debugColorsScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Optimizations"), s_debugRenderOptsScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Pruning and culling"), s_debugRenderPruningScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Model FX"), s_debugRenderModelFXScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Global FX"), s_debugRenderGlobalFXScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Sector FX"), s_debugRenderSectorFXScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("HDR"), s_debugRenderHDRScreen, s_renderGroup.Item2); //AddGroupBox(new StringBuilder("Render modules"), s_renderModulesScreen, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Render module - Prepare for draw"), s_renderModulePrepareForDraw, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Render module - Background"), s_renderModuleBackground, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Render module - Pre-HDR Alpha blend"), s_renderModuleAlphaBlendPreHDR, s_renderGroup.Item2); AddGroupBox(new StringBuilder("Render module - Debug draw"), s_renderModuleDebugDraw, s_renderGroup.Item2); MyPostProcessBase volumetricSsao2PP = MyRender.GetPostProcess(MyPostProcessEnum.VolumetricSSAO2); if (volumetricSsao2PP != null) { AddGroupBox(new StringBuilder("SSAO"), s_debugVolumetricSSAOScreen, s_renderGroup.Item2); } m_currentPosition.Y = groupStartPosition; AddGroupBox(new StringBuilder("Game"), s_debugGameScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("System"), s_debugSystemScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Player Ship"), s_debugShipScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Player Shake"), s_debugPlayerShakeScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Player Camera Spring"), s_debugPlayerCameraSpringScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Small Ship Weapons"), s_debugSmallShipWeaponsOffsetScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Debris"), s_debugDebrisScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Filling sector"), s_debugFillSectorScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Bots"), s_debugBotScreen, s_gameGroup.Item2); AddGroupBox(new StringBuilder("Global Events"), s_debugGameGlobalEvents, s_gameGroup.Item2); AddValidateAllMissionsButton(); m_currentPosition.Y = groupStartPosition; //AddButton(new StringBuilder("Particle stress"), OnParticleStressTest, s_testsGroup.Item2); m_buttonXOffset = -0.2f; CreateTravelControls(s_travelGroup.Item2, 0, 15); m_currentPosition.Y = groupStartPosition; m_buttonXOffset = 0.0f; CreateTravelControls(s_travelGroup.Item2, 15, 30); m_currentPosition.Y = groupStartPosition; m_buttonXOffset = 0.2f; CreateTravelControls(s_travelGroup.Item2, 30, 45); /* * AddButton(new StringBuilder("Mercury"), OnTravelToMercury, s_travelGroup.Item2); * AddButton(new StringBuilder("Venus"), OnTravelToVenus, s_travelGroup.Item2); * AddButton(new StringBuilder("Earth"), OnTravelToEarth, s_travelGroup.Item2); * AddButton(new StringBuilder("Mars"), OnTravelToMars, s_travelGroup.Item2); * AddButton(new StringBuilder("Jupiter"), OnTravelToJupiter, s_travelGroup.Item2); * AddButton(new StringBuilder("Saturn"), OnTravelToSaturn, s_travelGroup.Item2); * AddButton(new StringBuilder("Uran"), OnTravelToUran, s_travelGroup.Item2); * AddButton(new StringBuilder("Neptun"), OnTravelToNeptun, s_travelGroup.Item2); */ m_currentPosition.Y = groupStartPosition; CreateControlsSimple(); foreach (MyDevelopGroup developerGroup in s_developerGroups) { EnableGroup(developerGroup.Item2, false); } EnableGroup(s_activeGroup.Item2, true); this.SetControlIndex(Controls.IndexOf(s_activeGroup.Item1)); }