shroud-based scissor. eliminates a lot of shroud render
This commit is contained in:
@@ -66,6 +66,16 @@ namespace OpenRa.Graphics
|
||||
if (firstRow < 0) firstRow = 0;
|
||||
if (lastRow > map.Height) lastRow = map.Height;
|
||||
|
||||
if (!Game.world.LocalPlayer.Shroud.HasGPS && Game.world.LocalPlayer.Shroud.bounds.HasValue)
|
||||
{
|
||||
var r = Game.world.LocalPlayer.Shroud.bounds.Value;
|
||||
if (firstRow < r.Top - map.YOffset)
|
||||
firstRow = r.Top - map.YOffset;
|
||||
|
||||
if (firstRow > r.Bottom - map.YOffset)
|
||||
firstRow = r.Bottom - map.YOffset;
|
||||
}
|
||||
|
||||
renderer.SpriteShader.Quality = ShaderQuality.Low;
|
||||
renderer.SpriteShader.Render(() =>
|
||||
renderer.DrawBatch(vertexBuffer, indexBuffer,
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRa.Traits;
|
||||
using System;
|
||||
|
||||
namespace OpenRa.Graphics
|
||||
{
|
||||
@@ -59,6 +60,23 @@ namespace OpenRa.Graphics
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (!world.LocalPlayer.Shroud.HasGPS && world.LocalPlayer.Shroud.bounds.HasValue)
|
||||
{
|
||||
var r = world.LocalPlayer.Shroud.bounds.Value;
|
||||
|
||||
var left = (int)(Game.CellSize * r.Left - Game.viewport.Location.X);
|
||||
var top = (int)(Game.CellSize * r.Top - Game.viewport.Location.Y);
|
||||
var right = left + (int)(Game.CellSize * r.Width);
|
||||
var bottom = top + (int)(Game.CellSize * r.Height);
|
||||
|
||||
if (left < 0) left = 0;
|
||||
if (top < 0) top = 0;
|
||||
if (right > Game.viewport.Width) right = Game.viewport.Width;
|
||||
if (bottom > Game.viewport.Height) bottom = Game.viewport.Height;
|
||||
|
||||
renderer.Device.EnableScissor(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
terrainRenderer.Draw(Game.viewport);
|
||||
|
||||
var comparer = new SpriteComparer();
|
||||
|
||||
Reference in New Issue
Block a user