Make LineRenderer understand Zoom internally

This commit is contained in:
alzeih
2011-12-13 22:59:32 +13:00
committed by Chris Forbes
parent c8ae6127f3
commit 1b0724719d
3 changed files with 2 additions and 4 deletions

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Graphics
{ {
var vb = renderer.GetTempVertexBuffer(); var vb = renderer.GetTempVertexBuffer();
vb.SetData( vertices, nv ); vb.SetData( vertices, nv );
renderer.SetLineWidth(LineWidth); renderer.SetLineWidth(LineWidth * Game.viewport.Zoom);
renderer.DrawBatch( vb, 0, nv, PrimitiveType.LineList ); renderer.DrawBatch( vb, 0, nv, PrimitiveType.LineList );
} ); } );

View File

@@ -76,8 +76,6 @@ namespace OpenRA.Graphics
public void BeginFrame(float2 scroll, float zoom) public void BeginFrame(float2 scroll, float zoom)
{ {
device.Clear(); device.Clear();
WorldLineRenderer.LineWidth = zoom;
float2 r1 = new float2(2f/Resolution.Width, -2f/Resolution.Height); float2 r1 = new float2(2f/Resolution.Width, -2f/Resolution.Height);
float2 r2 = new float2(-1, 1); float2 r2 = new float2(-1, 1);
var zr1 = zoom*r1; var zr1 = zoom*r1;

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA.Effects
var rc = Color.FromArgb((info.BeamDuration - ticks)*255/info.BeamDuration, color); var rc = Color.FromArgb((info.BeamDuration - ticks)*255/info.BeamDuration, color);
var wlr = Game.Renderer.WorldLineRenderer; var wlr = Game.Renderer.WorldLineRenderer;
wlr.LineWidth = info.BeamRadius * 2 * Game.viewport.Zoom; wlr.LineWidth = info.BeamRadius * 2;
wlr.DrawLine(args.src, args.dest, rc, rc); wlr.DrawLine(args.src, args.dest, rc, rc);
} }
} }