private void DrawLightFilter() { GraphicsDevice graphicsDevice = this.GraphicsDevice; if (!FezMath.AlmostEqual(this.lightingPostEffect.DawnContribution, 0.0f)) { this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dawn; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Screen); this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect); } if (!FezMath.AlmostEqual(this.lightingPostEffect.DuskContribution, 0.0f)) { this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dusk_Multiply; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Multiply); this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect); this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dusk_Screen; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Screen); this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect); } if (FezMath.AlmostEqual(this.lightingPostEffect.NightContribution, 0.0f)) { return; } this.lightingPostEffect.Pass = LightingPostEffect.Passes.Night; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Multiply); this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect); }
public override void Draw(GameTime gameTime) { if (this.RtHandle != null && this.TargetRenderer.IsHooked(this.RtHandle.Target)) { this.TargetRenderer.Resolve(this.RtHandle.Target, false); this.capturedScreen = (Texture)this.RtHandle.Target; if (this.ScreenCaptured != null) { this.ScreenCaptured(); } } GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); if (this.capturedScreen != null) { SettingsManager.SetupViewport(this.GraphicsDevice, false); this.TargetRenderer.DrawFullscreen(this.capturedScreen); } this.Elapsed += gameTime.ElapsedGameTime; float num = (float)this.Elapsed.TotalSeconds / this.Duration; float amount = FezMath.Saturate(this.EaseOut ? Easing.EaseOut((double)num, this.EasingType) : Easing.EaseIn((double)num, this.EasingType)); if ((double)amount == 1.0 && (this.WaitUntil == null || this.WaitUntil())) { if (this.Faded != null) { this.Faded(); this.Faded = (Action)null; } this.WaitUntil = (Func <bool>)null; ServiceHelper.RemoveComponent <ScreenFade>(this); } this.TargetRenderer.DrawFullscreen(Color.Lerp(this.FromColor, this.ToColor, amount)); }
private void UpdateBTexture() { SpriteFont small = this.FontManager.Small; Vector2 vector2 = small.MeasureString(this.GTR.FillInGlyphs(" {B} ")) * FezMath.Saturate(this.FontManager.SmallFactor); if (this.bTexture != null) { this.bTexture.Dispose(); } this.bTexture = new RenderTarget2D(this.GraphicsDevice, (int)vector2.X, (int)vector2.Y, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, this.GraphicsDevice.PresentationParameters.DepthStencilFormat, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents); this.GraphicsDevice.SetRenderTarget(this.bTexture); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); this.GraphicsDevice.Clear(ClearOptions.Target, ColorEx.TransparentWhite, 1f, 0); GraphicsDeviceExtensions.BeginPoint(this.spriteBatch); this.GTR.DrawString(this.spriteBatch, small, " {B} ", new Vector2(0.0f, 0.0f), Color.White, FezMath.Saturate(this.FontManager.SmallFactor)); this.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D)null); this.bGroup.Texture = (Texture)this.bTexture; float num = Culture.IsCJK ? 25f : 24f; this.bGroup.Scale = new Vector3(vector2.X / num, vector2.Y / num, 1f); if (this.bGroup.Material != null) { return; } this.bGroup.Material = new Material(); }
private void PreDraw(GameTime gameTime) { this.LevelMaterializer.RegisterSatellites(); if (this.EngineState.StereoMode || this.LevelManager.Quantum) { return; } this.LevelManager.ActualDiffuse = new Color(this.LevelManager.BaseDiffuse, this.LevelManager.BaseDiffuse, this.LevelManager.BaseDiffuse); this.LevelManager.ActualAmbient = new Color(this.LevelManager.BaseAmbient, this.LevelManager.BaseAmbient, this.LevelManager.BaseAmbient); this.hadRt = this.TargetRenderingManager.HasRtInQueue || this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava; this.GraphicsDevice.SetRenderTarget(this.lightMapsRth.Target); GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareDraw(graphicsDevice); SettingsManager.SetupViewport(this.GraphicsDevice, false); if (!this.LevelManager.SkipPostProcess && (double)this.TimeManager.NightContribution != 0.0) { this.LevelManager.ActualDiffuse = Color.Lerp(this.LevelManager.ActualDiffuse, this.FogManager.Color, this.TimeManager.NightContribution * 0.4f); this.LevelManager.ActualAmbient = this.LevelManager.Sky == null || !this.LevelManager.Sky.FoliageShadows ? Color.Lerp(this.LevelManager.ActualAmbient, Color.White, this.TimeManager.NightContribution * 0.5f) : Color.Lerp(this.LevelManager.ActualAmbient, Color.Lerp(this.FogManager.Color, Color.White, 0.5f), this.TimeManager.NightContribution * 0.5f); } if (!this.LevelManager.SkipPostProcess) { this.LevelManager.ActualAmbient = Color.Lerp(this.LevelManager.ActualAmbient, this.FogManager.Color, 0.14375f); } if (this.LevelManager.WaterType == LiquidType.Sewer) { this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Black, 1f, 0); } else { this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Gray, 1f, 0); } GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.Level)); this.LevelMaterializer.RenderPass = RenderPass.Occluders; GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.None); this.DrawLightOccluders(); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.Red | ColorWriteChannels.Green | ColorWriteChannels.Blue); this.LevelMaterializer.RenderPass = RenderPass.LightInAlphaEmitters; this.LevelMaterializer.TrilesMesh.Draw(); this.LevelMaterializer.ArtObjectsMesh.Draw(); GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).SlopeScaleDepthBias = -0.1f; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).DepthBias = FezMath.IsOrthographic(this.CameraManager.Viewpoint) ? -1E-07f : (float)(-9.99999974737875E-05 / ((double)this.CameraManager.FarPlane - (double)this.CameraManager.NearPlane)); this.LevelMaterializer.AnimatedPlanesMesh.Draw(); this.LevelMaterializer.StaticPlanesMesh.Draw(); this.LevelMaterializer.NpcMesh.Draw(); this.DrawGeometryLights(); GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); this.DrawOnTopLights(); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); this.LevelMaterializer.RenderPass = RenderPass.WorldspaceLightmaps; this.LevelMaterializer.StaticPlanesMesh.Draw(); this.LevelMaterializer.AnimatedPlanesMesh.Draw(); this.LevelMaterializer.RenderPass = RenderPass.ScreenspaceLightmaps; this.LevelMaterializer.StaticPlanesMesh.Draw(); this.LevelMaterializer.AnimatedPlanesMesh.Draw(); GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).DepthBias = 0.0f; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).SlopeScaleDepthBias = 0.0f; this.GraphicsDevice.SetRenderTarget((RenderTarget2D)null); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.All); }
public override void Draw(GameTime gameTime) { float alpha = FezMath.Saturate(Easing.EaseOut(this.SinceAlive.TotalSeconds / 1.0, EasingType.Quintic)); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.Glitch)); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None); this.SpawnMesh.Draw(); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.Glitch); float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); float m11 = this.CameraManager.Radius / ((float)this.StarsTexture.Width / 16f) / viewScale; float m22 = (float)((double)this.CameraManager.Radius / (double)this.CameraManager.AspectRatio / ((double)this.StarsTexture.Height / 16.0)) / viewScale; Matrix textureMatrix = new Matrix(m11, 0.0f, 0.0f, 0.0f, 0.0f, m22, 0.0f, 0.0f, (float)(-(double)m11 / 2.0), (float)(-(double)m22 / 2.0), 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f); if (this.SinceAlive.TotalSeconds > 2.0) { this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, 1f - this.SpawnMesh.Material.Opacity)); } else if (this.SinceAlive.TotalSeconds < 1.0) { this.TargetRenderer.DrawFullscreen(Color.White); this.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; this.TargetRenderer.DrawFullscreen((Texture)this.StarsTexture, textureMatrix, new Color(1f, 1f, 1f, alpha)); } else if (this.SinceAlive.TotalSeconds > 1.0) { this.TargetRenderer.DrawFullscreen(new Color(this.redVisible ? 1f : 0.0f, this.greenVisible ? 1f : 0.0f, this.blueVisible ? 1f : 0.0f, 1f)); } GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); }
public override void Draw(GameTime gameTime) { if (this.DrawOrder == 0 || this.EngineState.Loading || (this.EngineState.StereoMode || this.EngineState.InMap)) { return; } this.InScreen = this.CameraManager.Frustum.Contains(this.Settings.SpawnVolume) != ContainmentType.Disjoint; if (!this.InScreen) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; if (this.Settings.StencilMask.HasValue) { GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, this.Settings.StencilMask); } else { GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.Always; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilPass = StencilOperation.Keep; } GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferWriteEnable = false; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).CullMode = CullMode.CullCounterClockwiseFace; graphicsDevice.SamplerStates[0] = SamplerState.PointClamp; this.Draw(); if (!this.Settings.StencilMask.HasValue) { return; } GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.Always; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilPass = StencilOperation.Keep; }
public override void Draw(GameTime gameTime) { TimeSpan elapsedGameTime = gameTime.ElapsedGameTime; if (this.CameraManager.ActionRunning) { this.sinceStarted += elapsedGameTime; } if (this.sinceStarted >= WakingUp.FadeTime && !this.respawned) { this.PlayerManager.RespawnAtCheckpoint(); if (!this.GameState.SkipFadeOut) { this.CameraManager.Constrained = false; } this.respawned = true; } if (this.GameState.SkipFadeOut) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Always, StencilMask.None); this.fadePlane.Material.Opacity = 1f - Math.Abs((float)(1.0 - (double)this.sinceStarted.Ticks / (double)WakingUp.FadeTime.Ticks)); this.fadePlane.Draw(); GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); }
public override void Draw(GameTime gameTime) { GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.NotEqual, StencilMask.Water); lock (FarawayPlaceHost.FarawayPlaceMutex) { if (this.PlacesMesh != null) { this.PlacesMesh.Draw(); } } GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Always, StencilMask.None); lock (FarawayPlaceHost.FarawayWaterMutex) { if (this.FarawayWaterMesh != null) { this.FarawayWaterMesh.Draw(); } } if (!this.GameState.StereoMode || this.rth == null) { return; } this.TargetRenderer.Resolve(this.rth.Target, true); this.GraphicsDevice.Clear(Color.Black); SettingsManager.SetupViewport(this.GraphicsDevice, false); this.CombineEffect.RightTexture = this.CombineEffect.LeftTexture = (Texture2D)this.rth.Target; GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Opaque); this.TargetRenderer.DrawFullscreen((BaseEffect)this.CombineEffect); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); }
public override void Draw(GameTime gameTime) { if (this.EngineState.Loading || this.EngineState.InMap) { return; } GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.FarawayPlaces)); this.ThisLevelMesh.Draw(); lock (FarawayPlaceHost.FarawayWaterMutex) { if (this.FarawayWaterMesh != null) { this.FarawayWaterMesh.Draw(); Vector3 local_0 = this.FarawayWaterMesh.Position; Vector3 local_1 = this.FarawayWaterMesh.Scale; this.FarawayWaterMesh.Blending = new BlendingMode?(BlendingMode.Alphablending); this.FarawayWaterMesh.SamplerState = SamplerState.LinearClamp; this.FarawayWaterMesh.Texture = (Dirtyable <Texture>)((Texture)this.HorizontalGradientTex); this.FarawayWaterMesh.Position -= Math.Abs(this.FarawayWaterMesh.Groups[0].Scale.X) * this.waterRightVector; this.FarawayWaterMesh.Draw(); this.FarawayWaterMesh.Scale = FezMath.Abs(this.waterRightVector) * -1f + Vector3.One - FezMath.Abs(this.waterRightVector); this.FarawayWaterMesh.Culling = CullMode.CullClockwiseFace; this.FarawayWaterMesh.Position += Math.Abs(this.FarawayWaterMesh.Groups[0].Scale.X) * this.waterRightVector * 2f; this.FarawayWaterMesh.Draw(); this.FarawayWaterMesh.Culling = CullMode.CullCounterClockwiseFace; this.FarawayWaterMesh.Position = local_0; this.FarawayWaterMesh.Scale = local_1; this.FarawayWaterMesh.Texture = (Dirtyable <Texture>)null; } } GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); }
protected override void Draw(GameTime gameTime) { if (this.GameState.ScheduleLoadEnd && (!this.GameState.DotLoading || (double)this.sinceLoading > 5.0)) { this.GameState.ScheduleLoadEnd = this.GameState.Loading = this.GameState.DotLoading = false; ServiceHelper.FirstLoadDone = true; this.sinceLoading = 0.0f; } if (this.GameState.DotLoading) { this.sinceLoading += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (this.InputManager.StrictRotation && !this.GameState.InMap) { this.InputManager.StrictRotation = false; } lock (this) { if (!this.GameState.Loading && !this.GameState.SkipRendering) { this.TargetRenderingManager.OnPreDraw(gameTime); } this.TargetRenderingManager.OnRtPrepare(); } this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Black, 1f, 0); SettingsManager.SetupViewport(this.GraphicsDevice, false); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); lock (this) base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (!this.IsActionAllowed(this.PlayerManager.Action)) { return; } if (this.rgbPlanes != null && this.Phase <= GateWarp.Phases.Decelerate) { GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); int num = 1; float amount = 0.01f; for (int index = 0; index < 3; ++index) { this.rgbPlanes.Groups[index].Material.Diffuse = Vector3.Lerp(this.rgbPlanes.Groups[index].Material.Diffuse, new Vector3(index == 0 ? (float)num : 0.0f, index == 1 ? (float)num : 0.0f, index == 2 ? (float)num : 0.0f), amount); this.rgbPlanes.Groups[index].Material.Opacity = MathHelper.Lerp(this.rgbPlanes.Groups[index].Material.Opacity, (float)num, amount); } this.rgbPlanes.Draw(); } if (this.Phase != GateWarp.Phases.FadeOut && this.Phase != GateWarp.Phases.FadeIn && this.Phase != GateWarp.Phases.LevelChange) { return; } double linearStep = this.SinceStarted.TotalSeconds / 2.25; if (this.Phase == GateWarp.Phases.FadeIn) { linearStep = 1.0 - linearStep; } float alpha = FezMath.Saturate(Easing.EaseIn(linearStep, EasingType.Cubic)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha)); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading || this.GameState.StereoMode) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.None); this.LevelMaterializer.StaticPlanesMesh.AlwaysOnTop = true; this.LevelMaterializer.StaticPlanesMesh.DepthWrites = false; foreach (BackgroundPlane backgroundPlane in this.LevelMaterializer.LevelPlanes) { backgroundPlane.Group.Enabled = backgroundPlane.Id < 0; } this.LevelMaterializer.StaticPlanesMesh.Draw(); this.LevelMaterializer.StaticPlanesMesh.AlwaysOnTop = false; this.LevelMaterializer.StaticPlanesMesh.DepthWrites = true; foreach (BackgroundPlane backgroundPlane in this.LevelMaterializer.LevelPlanes) { backgroundPlane.Group.Enabled = true; } GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.All); GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.LessEqual, StencilMask.Sky); this.TargetRenderer.DrawFullscreen((BaseEffect)this.Effect, (Texture)this.LightingPostProcess.LightmapTexture); GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); }
private void DrawMaskedLogo() { GraphicsDeviceExtensions.PrepareStencilReadWrite(this.GraphicsDevice, CompareFunction.NotEqual, StencilMask.BlackHoles); this.LogoMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.BlackHoles); this.Starfield.Draw(); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading) { return; } this.GraphicsDevice.Clear(EndCutscene32Host.PurpleBlack); switch (this.ActiveState) { case AxisDna.State.AxisZoom: GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.CutsceneWipe)); this.HelixMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.CutsceneWipe); this.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; this.TargetRenderer.DrawFullscreen((Texture)this.PurpleGradientTexture); this.NoiseMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); this.FatAxisMesh.Draw(); break; case AxisDna.State.StrandZoom: GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.CutsceneWipe)); this.HelixMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.CutsceneWipe); this.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; this.TargetRenderer.DrawFullscreen((Texture)this.PurpleGradientTexture, new Color(1f, 1f, 1f, 1f - FezMath.Saturate(this.Time / 7.42f))); this.NoiseMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); break; } }
public override void Draw(GameTime gameTime) { if (!this.IsActionAllowed(this.PlayerManager.Action) || this.LevelManager.DestinationIsFarAway || this.skipFade) { return; } float num = (float)Math.Pow((double)FezMath.Saturate(this.step), this.PlayerManager.SpinThroughDoor ? 2.0 : 3.0); if (this.PlayerManager.CarriedInstance != null && !this.PlayerManager.SpinThroughDoor) { this.trileFadeQuad.Rotation = this.CameraManager.Rotation; this.trileFadeQuad.Position = this.PlayerManager.CarriedInstance.Center; switch (this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) { case ActorType.Bomb: case ActorType.BigBomb: this.trileFadeQuad.Scale = new Vector3(0.75f, 1f, 0.75f); break; case ActorType.Vase: this.trileFadeQuad.Scale = new Vector3(0.875f, 1f, 0.875f); break; default: this.trileFadeQuad.Scale = Vector3.One; break; } this.trileFadeQuad.Material.Opacity = this.hasFlipped ? 1f - this.step : num; GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.NoSilhouette); this.trileFadeQuad.Draw(); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); } this.fadeOutQuad.Material.Opacity = this.hasFlipped ? 1f - num : num; this.fadeOutQuad.Draw(); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading) { return; } this.GraphicsDevice.Clear(EndCutscene32Host.PurpleBlack); switch (this.ActiveState) { case FezGrid.State.Wait: case FezGrid.State.RotateZoom: this.GoMesh.Draw(); break; case FezGrid.State.GridFadeAlign: this.TetraMesh.Draw(); break; case FezGrid.State.CubeRise: this.TetraMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.CutsceneWipe)); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None); this.StencilMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.NotEqual, StencilMask.CutsceneWipe); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All); this.CubeMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); break; } }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading || this.GameState.StereoMode || this.GameState.InMap) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilPass = StencilOperation.Keep; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.Always; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferEnable = true; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferFunction = CompareFunction.LessEqual; GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferWriteEnable = false; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).CullMode = CullMode.CullCounterClockwiseFace; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; bool flag = this.LevelManager.Name == "ELDERS"; GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); for (int index = 0; index < this.ActiveParticleSystems.Count; ++index) { PlaneParticleSystem planeParticleSystem = this.ActiveParticleSystems[index]; planeParticleSystem.InScreen = flag || this.CameraManager.Frustum.Contains(planeParticleSystem.Settings.SpawnVolume) != ContainmentType.Disjoint; if (planeParticleSystem.InScreen && planeParticleSystem.DrawOrder == 0) { planeParticleSystem.Draw(); } } }
private void DrawLayered(Mesh m, BaseEffect e) { lock (m) { foreach (Group item_0 in m.Groups) { switch (((GodRays.RayCustomData)item_0.CustomData).Layer) { case 0: GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Greater, StencilMask.SkyLayer3); break; case 1: GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Greater, StencilMask.SkyLayer2); break; case 2: GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Greater, StencilMask.SkyLayer1); break; case 3: GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); break; } item_0.Draw(e); } } GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); }
protected void DoDraw() { if (this.LevelManager.Sky != null && this.LevelManager.Sky.Name == "GRAVE") { this.LevelMaterializer.RenderPass = RenderPass.Ghosts; this.LevelMaterializer.NpcMesh.DepthWrites = false; GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.Ghosts)); this.LevelMaterializer.NpcMesh.Draw(); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All); this.LevelMaterializer.NpcMesh.DepthWrites = true; } this.LevelMaterializer.RenderPass = RenderPass.Normal; GraphicsDeviceExtensions.GetDssCombiner(this.GraphicsDevice).DepthBufferEnable = true; GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.Level)); this.LevelMaterializer.TrilesMesh.Draw(); this.LevelMaterializer.ArtObjectsMesh.Draw(); GraphicsDeviceExtensions.GetRasterCombiner(this.GraphicsDevice).SlopeScaleDepthBias = -0.1f; GraphicsDeviceExtensions.GetRasterCombiner(this.GraphicsDevice).DepthBias = FezMath.IsOrthographic(this.CameraManager.Viewpoint) ? -1E-07f : (float)(-0.100000001490116 / ((double)this.CameraManager.FarPlane - (double)this.CameraManager.NearPlane)); this.LevelMaterializer.StaticPlanesMesh.Draw(); this.LevelMaterializer.AnimatedPlanesMesh.Draw(); GraphicsDeviceExtensions.GetRasterCombiner(this.GraphicsDevice).DepthBias = 0.0f; GraphicsDeviceExtensions.GetRasterCombiner(this.GraphicsDevice).SlopeScaleDepthBias = 0.0f; GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.NoSilhouette)); this.LevelMaterializer.NpcMesh.Draw(); this.LevelMaterializer.RenderPass = RenderPass.Normal; GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); }
public override void Prepare(Group group) { base.Prepare(group); if (group.CustomData != null && (bool)group.CustomData) { GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDeviceService.GraphicsDevice, new StencilMask?(StencilMask.Trails)); this.lastWasComplete = true; } else if (this.lastWasComplete) { GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDeviceService.GraphicsDevice, CompareFunction.Always, StencilMask.None); } if (group.Material != null) { if (this.lastDiffuse != group.Material.Diffuse) { this.material.Diffuse = group.Material.Diffuse; this.lastDiffuse = group.Material.Diffuse; } } else { this.material.Diffuse = group.Mesh.Material.Diffuse; } if (group.Material == null) { return; } this.material.Opacity = group.Mesh.Material.Opacity * group.Material.Opacity; }
public override void Draw(GameTime gameTime) { this.sinceStarted += (float)gameTime.ElapsedGameTime.TotalSeconds; this.logoAlpha = (float)(((double)this.sinceStarted - 1.0) / 1.0); this.whiteAlpha = 1f; if ((double)this.sinceStarted > 3.0) { this.logoAlpha = FezMath.Saturate((float)(1.0 - ((double)this.sinceStarted - 3.0) / 0.5)); } if ((double)this.sinceStarted > 3.5) { this.whiteAlpha = FezMath.Saturate((float)(1.0 - ((double)this.sinceStarted - 4.0) / 0.5)); } this.TRM.DrawFullscreen(new Color(1f, 1f, 1f, this.whiteAlpha)); Vector2 vector2 = FezMath.Round(new Vector2((float)this.GraphicsDevice.Viewport.Width, (float)this.GraphicsDevice.Viewport.Height) / 2f); GraphicsDeviceExtensions.BeginPoint(this.SpriteBatch); this.SpriteBatch.Draw(this.PolyLogo, vector2 - FezMath.Round(new Vector2((float)this.PolyLogo.Width, (float)this.PolyLogo.Height) / 2f), new Color(1f, 1f, 1f, this.logoAlpha)); this.SpriteBatch.End(); if ((double)this.whiteAlpha != 0.0) { return; } ServiceHelper.RemoveComponent <FakeIntro>(this); }
private void DoStereoTransition(Vector3 center, Vector3 size, Action drawMethod) { float num = (size * this.CameraManager.InverseView.Forward).Length() * 1.5f; BaseEffect.LevelCenter = center; RenderTarget2D renderTarget = this.GraphicsDevice.GetRenderTargets()[0].RenderTarget as RenderTarget2D; this.GraphicsDevice.SetRenderTarget(this.leftRT.Target); this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, ColorEx.TransparentBlack, 1f, 0); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); drawMethod(); this.GraphicsDevice.SetRenderTarget(this.rightRT.Target); this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, ColorEx.TransparentBlack, 1f, 0); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); BaseEffect.EyeSign = this.CameraManager.InverseView.Right / num; GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); drawMethod(); this.GraphicsDevice.SetRenderTarget(renderTarget); this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, ColorEx.TransparentBlack, 1f, 0); this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; this.GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp; GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); this.combineEffect.LeftTexture = (Texture2D)this.leftRT.Target; this.combineEffect.RightTexture = (Texture2D)this.rightRT.Target; this.TargetRenderer.DrawFullscreen((BaseEffect)this.combineEffect); }
public void Draw(BaseEffect effect) { if (this.Geometry == null) { return; } GraphicsDevice graphicsDevice = this.Mesh.GraphicsDevice; if (this.AlwaysOnTop.HasValue) { GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferFunction = this.AlwaysOnTop.Value ? CompareFunction.Always : CompareFunction.LessEqual; } if (this.Blending.HasValue) { GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, this.Blending.Value); } if (this.SamplerState != null) { for (int index = 0; index < this.Mesh.UsedSamplers; ++index) { graphicsDevice.SamplerStates[index] = this.SamplerState; } } if (this.CullMode.HasValue) { GraphicsDeviceExtensions.SetCullMode(graphicsDevice, this.CullMode.Value); } if (this.NoAlphaWrite.HasValue) { GraphicsDeviceExtensions.GetBlendCombiner(graphicsDevice).ColorWriteChannels = ColorWriteChannels.Red | ColorWriteChannels.Green | ColorWriteChannels.Blue; } effect.Prepare(this); GraphicsDeviceExtensions.ApplyCombiners(graphicsDevice); this.Geometry.Draw(effect); }
public override void Draw(GameTime gameTime) { if (this.GameState.Paused || this.GameState.InFpsMode || (this.GameState.Loading || this.GameState.InMap)) { return; } float alpha = Easing.EaseOut(FezMath.Saturate(this.Fader.TotalSeconds / 0.75), EasingType.Sine); Texture2D texture2D; if (this.NowViewing == Viewpoint.Left) { this.BitTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds; if ((double)this.BitTimer <= 0.0) { ++this.MessageIndex; if (this.MessageIndex > this.Message.Length + 2) { this.MessageIndex = -1; } this.BitTimer = this.MessageIndex < 0 || this.MessageIndex >= this.Message.Length || this.Message[this.MessageIndex] == 1 ? 0.75f : 0.5f; } texture2D = this.MessageIndex < 0 || this.MessageIndex >= this.Message.Length || (double)this.BitTimer < 0.25 ? this.LeftTextures[2] : this.LeftTextures[this.Message[this.MessageIndex]]; } else { texture2D = this.Textures[this.NowViewing]; } float num1 = (float)this.GraphicsDevice.Viewport.Width; float num2 = (float)this.GraphicsDevice.Viewport.Height; float num3 = (float)texture2D.Width; float num4 = (float)texture2D.Height; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); Matrix textureMatrix = new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, -0.5f, -0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f) * new Matrix((float)((double)num1 / (double)num3 / 2.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, (float)((double)num2 / (double)num4 / 2.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f) * new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.5f, 0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.CutsceneWipe)); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.None); this.TargetRenderer.DrawFullscreen((Texture)this.Mask, textureMatrix, new Color(1f, 1f, 1f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Always, StencilMask.CutsceneWipe); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.All); this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha)); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.NotEqual; float skyOpacity = this.GameState.SkyOpacity; this.GameState.SkyOpacity = alpha; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Additive); SkyHost.Instance.DrawBackground(); this.GameState.SkyOpacity = skyOpacity; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Alphablending); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.Always; this.TargetRenderer.DrawFullscreen((Texture)this.Vignette, textureMatrix, new Color(1f, 1f, 1f, alpha * (1f - this.TimeManager.NightContribution))); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.NotEqual; this.TargetRenderer.DrawFullscreen((Texture)texture2D, textureMatrix, new Color(1f, 1f, 1f, alpha * this.TimeManager.NightContribution)); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading || this.GameState.SkipRendering) { if (this.backgroundRth == null || !this.TargetRenderer.IsHooked(this.backgroundRth.Target)) { return; } this.TargetRenderer.Resolve(this.backgroundRth.Target, true); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Opaque); this.combineEffect.LeftTexture = this.combineEffect.RightTexture = (Texture2D)this.backgroundRth.Target; this.TargetRenderer.DrawFullscreen((BaseEffect)this.combineEffect); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); } else if (!this.GameState.StereoMode) { if (this.rightRT != null || this.leftRT != null) { this.TargetRenderer.ReturnTarget(this.leftRT); this.TargetRenderer.ReturnTarget(this.rightRT); this.leftRT = this.rightRT = (RenderTargetHandle)null; } if (this.backgroundRth != null) { this.TargetRenderer.Resolve(this.backgroundRth.Target, false); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Opaque); this.TargetRenderer.DrawFullscreen((Texture)this.backgroundRth.Target, Matrix.Identity); this.TargetRenderer.ReturnTarget(this.backgroundRth); GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); } this.backgroundRth = (RenderTargetHandle)null; if (this.needsReset) { BaseEffect.EyeSign = Vector3.Zero; } this.DoDraw(); } else { if (this.rightRT == null || this.leftRT == null) { this.rightRT = this.TargetRenderer.TakeTarget(); this.leftRT = this.TargetRenderer.TakeTarget(); } if (this.backgroundRth == null) { this.backgroundRth = this.TargetRenderer.TakeTarget(); this.TargetRenderer.ScheduleHook(this.DrawOrder, this.backgroundRth.Target); } else { this.needsReset = true; this.DoStereo(this.LevelManager.Size / 2f, this.LevelManager.Size, new Action(this.DoFullDraw), (Texture)null); } } }
private void DrawLights() { if (!this.shadowMesh.Enabled || this.EngineState.Loading) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.LessEqual, StencilMask.Level); this.EngineState.SkyRender = true; Vector3 viewOffset = this.CameraManager.ViewOffset; this.CameraManager.ViewOffset -= viewOffset; if (this.LevelManager.Sky != null && this.LevelManager.Sky.FoliageShadows) { this.shadowEffect.Pass = CloudShadowPasses.Canopy; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Minimum); float num1 = (float)Math.Sin((double)this.SineAccumulator); foreach (Group group in this.axisPerGroup.Keys) { float m11 = group.TextureMatrix.Value.Value.M11; float m22 = group.TextureMatrix.Value.Value.M11; group.TextureMatrix.Set(new Matrix?(new Matrix(m11, 0.0f, 0.0f, 0.0f, 0.0f, m22, 0.0f, 0.0f, num1 / 100f, num1 / 100f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f))); } this.shadowMesh.Draw(); float num2 = (float)Math.Cos((double)this.SineAccumulator); foreach (Group group in this.axisPerGroup.Keys) { float m11 = group.TextureMatrix.Value.Value.M11; float m22 = group.TextureMatrix.Value.Value.M11; group.TextureMatrix.Set(new Matrix?(new Matrix(m11, 0.0f, 0.0f, 0.0f, 0.0f, m22, 0.0f, 0.0f, (float)(-(double)num2 / 100.0 + 0.100000001490116), (float)((double)num2 / 100.0 + 0.100000001490116), 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f))); } this.shadowMesh.Draw(); } else { this.shadowEffect.Pass = CloudShadowPasses.Standard; float depthBias = GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).DepthBias; float slopeScaleDepthBias = GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).SlopeScaleDepthBias; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).DepthBias = 0.0f; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).SlopeScaleDepthBias = 0.0f; Color color = new Color(this.LevelManager.ActualAmbient.ToVector3() / 2f); GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Subtract); this.TargetRenderer.DrawFullscreen(color); GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Multiply); this.shadowMesh.Draw(); GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Additive); this.TargetRenderer.DrawFullscreen(color); GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).DepthBias = depthBias; GraphicsDeviceExtensions.GetRasterCombiner(graphicsDevice).SlopeScaleDepthBias = slopeScaleDepthBias; } GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Alphablending); this.CameraManager.ViewOffset += viewOffset; this.EngineState.SkyRender = false; GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); Vector2 vector2 = FezMath.Round(new Vector2((float)this.GraphicsDevice.Viewport.Width, (float)this.GraphicsDevice.Viewport.Height) / 2f); this.GraphicsDevice.Clear(Color.White); GraphicsDeviceExtensions.BeginPoint(this.SpriteBatch); this.SpriteBatch.Draw(this.TrapdoorLogo, vector2 - FezMath.Round(new Vector2((float)this.TrapdoorLogo.Width, (float)this.TrapdoorLogo.Height) / 2f), new Color(1f, 1f, 1f, 1f)); this.SpriteBatch.End(); }
private void PreDraw() { if (this.GameState.Loading || !this.Visible) { return; } GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.Level)); TrixelParticleSystem.effect.Pass = LightingEffectPass.Pre; this.mesh.Draw(); TrixelParticleSystem.effect.Pass = LightingEffectPass.Main; }
public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha) { float scale = 4f * SettingsManager.GetViewScale(batch.GraphicsDevice); Vector2 vector2_1 = new Vector2((float)batch.GraphicsDevice.Viewport.Width, (float)batch.GraphicsDevice.Viewport.Height) / 2f; Vector2 vector2_2 = new Vector2((float)this.HowToPlayImage.Width, (float)this.HowToPlayImage.Height) * scale; batch.End(); GraphicsDeviceExtensions.BeginPoint(batch); Vector2 position = vector2_1 - vector2_2 / 2f; batch.Draw(this.HowToPlayImage, position, new Rectangle?(), new Color(1f, 1f, 1f, alpha), 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.0f); }
public override void Draw(GameTime gameTime) { if (this.CameraManager.Viewpoint == Viewpoint.Perspective || this.bombStates.Count == 0) { return; } GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Equal, StencilMask.Bomb); this.flashesMesh.Draw(); GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None)); }