public void Draw() { if (World.WorldActor.Disposed) { return; } RefreshPalette(); if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap) { return; } var renderables = GenerateRenderables(); var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor); Game.Renderer.EnableScissor(bounds); terrainRenderer.Draw(this, Viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } // added for contrails foreach (var a in World.ActorsWithTrait <IPostRender>()) { if (a.Actor.IsInWorld && !a.Actor.Disposed) { a.Trait.RenderAfterWorld(this, a.Actor); } } var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; foreach (var a in World.ActorsWithTrait <IRenderShroud>()) { a.Trait.RenderShroud(this, renderShroud); } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } } Game.Renderer.DisableScissor(); var overlayRenderables = World.Selection.Actors.Where(a => !a.Disposed) .SelectMany(a => a.TraitsImplementing <IPostRenderSelection>()) .SelectMany(t => t.RenderAfterWorld(this)); Game.Renderer.WorldVoxelRenderer.BeginFrame(); var finalOverlayRenderables = overlayRenderables.Select(r => r.PrepareRender(this)); Game.Renderer.WorldVoxelRenderer.EndFrame(); // HACK: Keep old grouping behaviour foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.Render(this); } } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.RenderDebugGeometry(this); } } } if (World.Type == WorldType.Regular && Game.Settings.Game.AlwaysShowStatusBars) { foreach (var g in World.Actors.Where(a => !a.Disposed && a.HasTrait <Selectable>() && !World.FogObscures(a) && !World.Selection.Actors.Contains(a))) { DrawRollover(g); } } Game.Renderer.Flush(); }
public void Draw() { if (World.WorldActor.Disposed) { return; } if (devTrait.Value != null) { Game.Renderer.WorldSpriteRenderer.SetDepthPreviewEnabled(devTrait.Value.ShowDepthPreview); Game.Renderer.WorldRgbaSpriteRenderer.SetDepthPreviewEnabled(devTrait.Value.ShowDepthPreview); Game.Renderer.WorldRgbaColorRenderer.SetDepthPreviewEnabled(devTrait.Value.ShowDepthPreview); } RefreshPalette(); if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap) { return; } var renderables = GenerateRenderables(); var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor); Game.Renderer.EnableScissor(bounds); if (enableDepthBuffer) { Game.Renderer.Device.EnableDepthBuffer(); } terrainRenderer.Draw(this, Viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IRenderAboveWorld>()) { if (a.Actor.IsInWorld && !a.Actor.Disposed) { a.Trait.RenderAboveWorld(a.Actor, this); } } var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IRenderShroud>()) { a.Trait.RenderShroud(renderShroud, this); } if (enableDepthBuffer) { Game.Renderer.Device.DisableDepthBuffer(); } Game.Renderer.DisableScissor(); var aboveShroud = World.ActorsWithTrait <IRenderAboveShroud>().Where(a => a.Actor.IsInWorld && !a.Actor.Disposed) .SelectMany(a => a.Trait.RenderAboveShroud(a.Actor, this)); var aboveShroudSelected = World.Selection.Actors.Where(a => !a.Disposed) .SelectMany(a => a.TraitsImplementing <IRenderAboveShroudWhenSelected>() .SelectMany(t => t.RenderAboveShroud(a, this))); var aboveShroudEffects = World.Effects.Select(e => e as IEffectAboveShroud) .Where(e => e != null) .SelectMany(e => e.RenderAboveShroud(this)); var aboveShroudOrderGenerator = SpriteRenderable.None; if (World.OrderGenerator != null) { aboveShroudOrderGenerator = World.OrderGenerator.RenderAboveShroud(this, World); } Game.Renderer.WorldVoxelRenderer.BeginFrame(); var finalOverlayRenderables = aboveShroud .Concat(aboveShroudSelected) .Concat(aboveShroudEffects) .Concat(aboveShroudOrderGenerator) .Select(r => r.PrepareRender(this)); Game.Renderer.WorldVoxelRenderer.EndFrame(); // HACK: Keep old grouping behaviour foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.Render(this); } } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.RenderDebugGeometry(this); } } } Game.Renderer.Flush(); }
public void Draw() { RefreshPalette(); if (world.IsShellmap && !Game.Settings.Game.ShowShellmap) { return; } var bounds = Game.viewport.ViewBounds(world); Game.Renderer.EnableScissor(bounds.Left, bounds.Top, bounds.Width, bounds.Height); terrainRenderer.Draw(this, Game.viewport); foreach (var a in world.traitDict.ActorsWithTraitMultiple <IRenderAsTerrain>(world)) { foreach (var r in a.Trait.RenderAsTerrain(a.Actor)) { r.Sprite.DrawAt(r.Pos, this.GetPaletteIndex(r.Palette), r.Scale); } } foreach (var a in world.Selection.Actors) { if (!a.Destroyed) { foreach (var t in a.TraitsImplementing <IPreRenderSelection>()) { t.RenderBeforeWorld(this, a); } } } Game.Renderer.Flush(); if (world.OrderGenerator != null) { world.OrderGenerator.RenderBeforeWorld(this, world); } foreach (var image in SpritesToRender()) { image.Sprite.DrawAt(image.Pos, this.GetPaletteIndex(image.Palette), image.Scale); } // added for contrails foreach (var a in world.ActorsWithTrait <IPostRender>()) { if (!a.Actor.Destroyed) { a.Trait.RenderAfterWorld(this, a.Actor); } } if (world.OrderGenerator != null) { world.OrderGenerator.RenderAfterWorld(this, world); } shroudRenderer.Draw(this); Game.Renderer.DisableScissor(); foreach (var g in world.Selection.Actors.Where(a => !a.Destroyed) .SelectMany(a => a.TraitsImplementing <IPostRenderSelection>()) .GroupBy(prs => prs.GetType())) { foreach (var t in g) { t.RenderAfterWorld(this); } } Game.Renderer.Flush(); }
public void Draw() { if (World.WorldActor.Disposed) { return; } if (debugVis.Value != null) { Game.Renderer.WorldSpriteRenderer.SetDepthPreviewEnabled(debugVis.Value.DepthBuffer); Game.Renderer.WorldRgbaSpriteRenderer.SetDepthPreviewEnabled(debugVis.Value.DepthBuffer); Game.Renderer.WorldRgbaColorRenderer.SetDepthPreviewEnabled(debugVis.Value.DepthBuffer); } RefreshPalette(); var onScreenActors = World.ScreenMap.RenderableActorsInBox(Viewport.TopLeft, Viewport.BottomRight).ToHashSet(); var renderables = GenerateRenderables(onScreenActors); var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor); Game.Renderer.EnableScissor(bounds); if (enableDepthBuffer) { Game.Renderer.Device.EnableDepthBuffer(); } terrainRenderer.Draw(this, Viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IRenderAboveWorld>()) { if (a.Actor.IsInWorld && !a.Actor.Disposed) { a.Trait.RenderAboveWorld(a.Actor, this); } } var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IRenderShroud>()) { a.Trait.RenderShroud(renderShroud, this); } if (enableDepthBuffer) { Game.Renderer.Device.DisableDepthBuffer(); } Game.Renderer.DisableScissor(); var finalOverlayRenderables = GenerateOverlayRenderables(onScreenActors); // HACK: Keep old grouping behaviour var groupedOverlayRenderables = finalOverlayRenderables.GroupBy(prs => prs.GetType()); foreach (var g in groupedOverlayRenderables) { foreach (var r in g) { r.Render(this); } } if (debugVis.Value != null && debugVis.Value.RenderGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } foreach (var g in groupedOverlayRenderables) { foreach (var r in g) { r.RenderDebugGeometry(this); } } } if (debugVis.Value != null && debugVis.Value.ScreenMap) { foreach (var r in World.ScreenMap.RenderBounds(World.RenderPlayer)) { Game.Renderer.WorldRgbaColorRenderer.DrawRect( new float3(r.Left, r.Top, r.Bottom), new float3(r.Right, r.Bottom, r.Bottom), 1 / Viewport.Zoom, Color.MediumSpringGreen); } foreach (var r in World.ScreenMap.MouseBounds(World.RenderPlayer)) { Game.Renderer.WorldRgbaColorRenderer.DrawRect( new float3(r.Left, r.Top, r.Bottom), new float3(r.Right, r.Bottom, r.Bottom), 1 / Viewport.Zoom, Color.OrangeRed); } } Game.Renderer.Flush(); }
public void Draw() { if (World.WorldActor.Disposed) { return; } if (devTrait.Value != null) { Game.Renderer.WorldSpriteRenderer.SetDepthPreviewEnabled(devTrait.Value.ShowDepthPreview); } RefreshPalette(); if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap) { return; } var renderables = GenerateRenderables(); var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor); Game.Renderer.EnableScissor(bounds); if (enableDepthBuffer) { Game.Renderer.Device.EnableDepthBuffer(); } terrainRenderer.Draw(this, Viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IPostRender>()) { if (a.Actor.IsInWorld && !a.Actor.Disposed) { a.Trait.RenderAfterWorld(this, a.Actor); } } var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; if (enableDepthBuffer) { Game.Renderer.ClearDepthBuffer(); } foreach (var a in World.ActorsWithTrait <IRenderShroud>()) { a.Trait.RenderShroud(this, renderShroud); } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } } if (enableDepthBuffer) { Game.Renderer.Device.DisableDepthBuffer(); } Game.Renderer.DisableScissor(); var overlayRenderables = World.Selection.Actors.Where(a => !a.Disposed) .SelectMany(a => a.TraitsImplementing <IPostRenderSelection>()) .SelectMany(t => t.RenderAfterWorld(this)); Game.Renderer.WorldVoxelRenderer.BeginFrame(); var finalOverlayRenderables = overlayRenderables.Select(r => r.PrepareRender(this)); Game.Renderer.WorldVoxelRenderer.EndFrame(); // HACK: Keep old grouping behaviour foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.Render(this); } } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType())) { foreach (var r in g) { r.RenderDebugGeometry(this); } } } if (World.Type == WorldType.Regular) { foreach (var g in World.ScreenMap.ActorsInBox(Viewport.TopLeft, Viewport.BottomRight) .Where(a => !a.Disposed && !World.Selection.Contains(a) && a.Info.HasTraitInfo <SelectableInfo>() && !World.FogObscures(a))) { if (Game.Settings.Game.StatusBars == StatusBarsType.Standard) { new SelectionBarsRenderable(g, false, false).Render(this); } if (Game.Settings.Game.StatusBars == StatusBarsType.AlwaysShow) { new SelectionBarsRenderable(g, true, true).Render(this); } if (Game.Settings.Game.StatusBars == StatusBarsType.DamageShow) { if (g.GetDamageState() != DamageState.Undamaged) { new SelectionBarsRenderable(g, true, true).Render(this); } else { new SelectionBarsRenderable(g, false, true).Render(this); } } } } Game.Renderer.Flush(); }
public void Draw() { RefreshPalette(); if (world.IsShellmap && !Game.Settings.Game.ShowShellmap) { return; } var renderables = GenerateRenderables(); var bounds = Viewport.ScissorBounds; Game.Renderer.EnableScissor(bounds); terrainRenderer.Draw(this, Viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } // added for contrails foreach (var a in world.ActorsWithTrait <IPostRender>()) { if (a.Actor.IsInWorld && !a.Actor.Destroyed) { a.Trait.RenderAfterWorld(this, a.Actor); } } if (world.OrderGenerator != null) { world.OrderGenerator.RenderAfterWorld(this, world); } var renderShroud = world.RenderPlayer != null ? world.RenderPlayer.Shroud : null; foreach (var a in world.ActorsWithTrait <IRenderShroud>()) { a.Trait.RenderShroud(this, renderShroud); } if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } } Game.Renderer.DisableScissor(); foreach (var g in world.Selection.Actors.Where(a => !a.Destroyed) .SelectMany(a => a.TraitsImplementing <IPostRenderSelection>()) .GroupBy(prs => prs.GetType())) { foreach (var t in g) { t.RenderAfterWorld(this); } } if (!world.IsShellmap && Game.Settings.Game.AlwaysShowStatusBars) { foreach (var g in world.Actors.Where(a => !a.Destroyed && a.HasTrait <Selectable>() && !world.FogObscures(a) && !world.Selection.Actors.Contains(a))) { DrawRollover(g); } } Game.Renderer.Flush(); }
public void Draw() { RefreshPalette(); if (world.IsShellmap && !Game.Settings.Game.ShowShellmap) { return; } var renderables = GenerateRenderables(); var bounds = Game.viewport.ViewBounds(world); Game.Renderer.EnableScissor(bounds.Left, bounds.Top, bounds.Width, bounds.Height); terrainRenderer.Draw(this, Game.viewport); Game.Renderer.Flush(); for (var i = 0; i < renderables.Count; i++) { renderables[i].Render(this); } // added for contrails foreach (var a in world.ActorsWithTrait <IPostRender>()) { if (!a.Actor.Destroyed) { a.Trait.RenderAfterWorld(this, a.Actor); } } if (world.OrderGenerator != null) { world.OrderGenerator.RenderAfterWorld(this, world); } var renderShroud = world.RenderPlayer != null ? world.RenderPlayer.Shroud : null; shroudRenderer.Draw(this, renderShroud); if (devTrait.Value != null && devTrait.Value.ShowDebugGeometry) { for (var i = 0; i < renderables.Count; i++) { renderables[i].RenderDebugGeometry(this); } } Game.Renderer.DisableScissor(); foreach (var g in world.Selection.Actors.Where(a => !a.Destroyed) .SelectMany(a => a.TraitsImplementing <IPostRenderSelection>()) .GroupBy(prs => prs.GetType())) { foreach (var t in g) { t.RenderAfterWorld(this); } } Game.Renderer.Flush(); }