Add depth buffer support to beams and contrails.

This commit is contained in:
Paul Chote
2016-08-22 21:17:05 +01:00
parent c092c93401
commit f3bac143e9
2 changed files with 7 additions and 7 deletions

View File

@@ -55,16 +55,16 @@ namespace OpenRA.Mods.Common.Graphics
{
var delta = length * width.Length / (2 * vecLength);
var corner = new WVec(-delta.Y, delta.X, delta.Z);
var a = wr.ScreenPosition(pos - corner);
var b = wr.ScreenPosition(pos + corner);
var c = wr.ScreenPosition(pos + corner + length);
var d = wr.ScreenPosition(pos - corner + length);
var a = wr.Screen3DPosition(pos - corner);
var b = wr.Screen3DPosition(pos + corner);
var c = wr.Screen3DPosition(pos + corner + length);
var d = wr.Screen3DPosition(pos - corner + length);
Game.Renderer.WorldRgbaColorRenderer.FillRect(a, b, c, d, color);
}
else
{
var start = wr.ScreenPosition(pos);
var end = wr.ScreenPosition(pos + length);
var start = wr.Screen3DPosition(pos);
var end = wr.Screen3DPosition(pos + length);
var screenWidth = wr.ScreenVector(new WVec(width, WDist.Zero, WDist.Zero))[0];
Game.Renderer.WorldRgbaColorRenderer.DrawLine(start, end, screenWidth, color);
}

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Graphics
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
if (!world.FogObscures(curPos) && !world.FogObscures(nextPos))
wcr.DrawLine(wr.ScreenPosition(curPos), wr.ScreenPosition(nextPos), screenWidth, curColor, nextColor);
wcr.DrawLine(wr.Screen3DPosition(curPos), wr.Screen3DPosition(nextPos), screenWidth, curColor, nextColor);
curPos = nextPos;
curColor = nextColor;