opengl: Handle stroked semi-circles
And filled but we don't use those yet. No pixel-alignment needed for stroked semi-circles (I think) as we set the pixel width to be 1 regardless of the zoom level. Fixes: lp:1816263 * https://bugs.launchpad.net/kicad/+bug/1816263
This commit is contained in:
parent
9d4a19797c
commit
f1a60832e0
|
@ -149,10 +149,9 @@ void computeLineCoords( bool posture, vec2 vs, vec2 vp, vec2 texcoord, vec2 dir,
|
|||
void computeCircleCoords( float vertexIndex, float radius, float lineWidth )
|
||||
{
|
||||
vec4 delta;
|
||||
vec4 center = roundv(gl_ModelViewProjectionMatrix * gl_Vertex + vec4(1, 1, 0, 0), screenPixelSize);
|
||||
float pixelWidth = roundr(lineWidth / worldPixelSize, 1.0);
|
||||
float pixelR = roundr(radius / worldPixelSize, 1.0);
|
||||
//float pixelWidth = lineWidth / worldPixelSize;
|
||||
vec4 center = roundv( gl_ModelViewProjectionMatrix * gl_Vertex + vec4(1, 1, 0, 0), screenPixelSize );
|
||||
float pixelWidth = roundr( lineWidth / worldPixelSize, 1.0);
|
||||
float pixelR = roundr( radius / worldPixelSize, 1.0);
|
||||
|
||||
vec4 adjust = vec4(-1, -1, 0, 0);
|
||||
|
||||
|
@ -162,19 +161,33 @@ void computeCircleCoords( float vertexIndex, float radius, float lineWidth )
|
|||
if( vertexIndex == 1.0 )
|
||||
{
|
||||
circleCoords = vec2( -sqrt( 3.0 ), -1.0 );
|
||||
delta = vec4(- pixelR * sqrt(3.0), -pixelR, 0, 0);
|
||||
delta = vec4( -pixelR * sqrt(3.0), -pixelR, 0, 0 );
|
||||
}
|
||||
else if( vertexIndex == 2.0 )
|
||||
{
|
||||
circleCoords = vec2( sqrt( 3.0 ), -1.0 );
|
||||
delta = vec4( pixelR * sqrt(3.0), -pixelR, 0, 0);
|
||||
delta = vec4( pixelR * sqrt( 3.0 ), -pixelR, 0, 0 );
|
||||
}
|
||||
else if( vertexIndex == 3.0 )
|
||||
{
|
||||
circleCoords = vec2( 0.0, 2.0 );
|
||||
delta = vec4(0, 2*pixelR, 0, 0);
|
||||
delta = vec4( 0, 2 * pixelR, 0, 0 );
|
||||
}
|
||||
else if( vertexIndex == 4.0 )
|
||||
{
|
||||
circleCoords = vec2( -sqrt( 3.0 ), 0.0 );
|
||||
delta = vec4( 0, 0, 0, 0 );
|
||||
}
|
||||
else if( vertexIndex == 5.0 )
|
||||
{
|
||||
circleCoords = vec2( sqrt( 3.0 ), 0.0 );
|
||||
delta = vec4( 0, 0, 0, 0 );
|
||||
}
|
||||
else if( vertexIndex == 6.0 )
|
||||
{
|
||||
circleCoords = vec2( 0.0, 2.0 );
|
||||
delta = vec4( 0, 0, 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
shaderParams[2] = pixelR;
|
||||
shaderParams[3] = pixelWidth;
|
||||
|
|
|
@ -617,6 +617,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
|
|||
// Outlined tracks
|
||||
double lineLength = startEndVector.EuclideanNorm();
|
||||
|
||||
SetLineWidth( 1.0 );
|
||||
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
|
||||
|
||||
Save();
|
||||
|
|
Loading…
Reference in New Issue