Fix lines not being centered in the middle of a pixel

This commit is contained in:
Paul Chote
2011-07-22 22:52:09 +12:00
parent 8516fa8748
commit 626b83ba12

View File

@@ -16,6 +16,7 @@ namespace OpenRA.Graphics
public class LineRenderer : Renderer.IBatchRenderer
{
public float LineWidth = 1f;
static float2 offset = new float2(0.5f,0.5f);
Renderer renderer;
IShader shader;
@@ -62,11 +63,11 @@ namespace OpenRA.Graphics
if( nv + 2 > Renderer.TempBufferSize )
Flush();
vertices[ nv++ ] = new Vertex( start,
vertices[ nv++ ] = new Vertex( start + offset,
new float2( startColor.R / 255.0f, startColor.G / 255.0f ),
new float2( startColor.B / 255.0f, startColor.A / 255.0f ) );
vertices[ nv++ ] = new Vertex( end,
vertices[ nv++ ] = new Vertex( end + offset,
new float2( endColor.R / 255.0f, endColor.G / 255.0f ),
new float2( endColor.B / 255.0f, endColor.A / 255.0f ) );
}