/// <summary> /// Render the SM3 version of glow. /// </summary> /// <param name="camera"></param> /// <param name="effectsImage"></param> public static void RenderBloomSM3(Camera camera, Texture2D effectsImage) { if (!EnabledSM3) { return; } if (InGame.inGame.renderEffects != InGame.RenderEffect.Normal) { return; } InGame.inGame.renderEffects = InGame.RenderEffect.BloomPass; // Need to jumpt through some hoops here to get the right thing to happen // when we're in tutorial mode. Basically we're setting up a custom viewport // that has the same aspect ratio and offset that the main one has but is // proportionally smaller to fit the current rendertarget. if (BokuGame.ScreenPosition.Y > 0) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; Viewport vp = device.Viewport; vp.Y = (int)(vp.Height * BokuGame.ScreenPosition.Y / (BokuGame.ScreenPosition.Y + BokuGame.ScreenSize.Y)); vp.Height = vp.Height - vp.Y; device.Viewport = vp; } for (int i = 0; i < lies.Count; ++i) { Distortion lie = lies[i]; if (lie.Bloom) { lie.RenderSM3(camera, effectsImage); } } // We've set the BlendFunc to Max in the effect, set it back // to default. BokuGame.bokuGame.GraphicsDevice.BlendState = BlendState.AlphaBlend; FirstPersonEffectMgr.Render(camera); InGame.inGame.renderEffects = InGame.RenderEffect.Normal; }
/// <summary> /// Set renderEffects state and render SM3 versions of distortions. /// </summary> /// <param name="camera"></param> /// <param name="effectsImage"></param> public static void RenderSM3(Camera camera, Texture2D effectsImage) { if (!EnabledSM3) { return; } if (InGame.inGame.renderEffects != InGame.RenderEffect.Normal) { return; } InGame.inGame.renderEffects = InGame.RenderEffect.DistortionPass; Parameter(EffectParams.DepthTexture).SetValue(effectsImage); Parameter(EffectParams.Bump).SetValue(Bump); Parameter(EffectParams.BlurStrength).SetValue(blurStrength); Parameter(EffectParams.BumpScroll).SetValue(bumpScroll); Parameter(EffectParams.BumpScale).SetValue(bumpScale); Parameter(EffectParams.BumpStrength).SetValue(bumpStrength); InGame.inGame.ParticleSystemManager.Render(camera, BaseEmitter.Use.Distort); // We've set the BlendFunc to Max in the effect, manually set it back // to add here, because that's what everyone else assumes it to be. BokuGame.bokuGame.GraphicsDevice.BlendState = BlendState.NonPremultiplied; for (int i = 0; i < lies.Count; ++i) { Distortion lie = lies[i]; if (!lie.Bloom) { lie.RenderSM3(camera, effectsImage); } } distFilter.Render(camera); FirstPersonEffectMgr.Render(camera); InGame.inGame.renderEffects = InGame.RenderEffect.Normal; }