forked from organicmaps/organicmaps
[drape] buttcap is flatcap
This commit is contained in:
parent
d6c8009644
commit
151a598918
2 changed files with 25 additions and 18 deletions
|
@ -23,7 +23,7 @@ void main(void)
|
|||
|
||||
if (vertexType < 0.0)
|
||||
{
|
||||
highp float quadWidth = a_vertType.y <= 0.0 ? 2.0 * abs(shift_mult) : abs(shift_mult);
|
||||
highp float quadWidth = 2.0 * abs(shift_mult);
|
||||
highp vec4 pd = normalize(d * modelView) * quadWidth;
|
||||
pos = (pn - pd + pivot);
|
||||
}
|
||||
|
|
|
@ -52,17 +52,21 @@ namespace df
|
|||
const float hw = GetWidth() / 2.0f;
|
||||
const float realWidth = GetWidth();
|
||||
|
||||
// Add start cap quad
|
||||
// We understand 'butt' cap as 'flat'
|
||||
const bool doAddCap = m_params.m_cap != ButtCap;
|
||||
vec2 direction = m_points[1] - m_points[0];
|
||||
m2::PointF firstPoint = m_points[0];
|
||||
// Add start cap quad
|
||||
if (doAddCap)
|
||||
{
|
||||
renderPoints.push_back(Point3D::From2D(firstPoint, m_depth)); // A
|
||||
renderDirections.push_back(Point3D::From2D(direction, hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
|
||||
renderPoints.push_back(Point3D::From2D(firstPoint, m_depth)); // A
|
||||
renderDirections.push_back(Point3D::From2D(direction, hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
|
||||
renderPoints.push_back(Point3D::From2D(firstPoint, m_depth)); // B
|
||||
renderDirections.push_back(Point3D::From2D(direction, -hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
renderPoints.push_back(Point3D::From2D(firstPoint, m_depth)); // B
|
||||
renderDirections.push_back(Point3D::From2D(direction, -hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
}
|
||||
//
|
||||
|
||||
m2::PointF start = m_points[0];
|
||||
|
@ -174,17 +178,20 @@ namespace df
|
|||
}
|
||||
|
||||
//Add final cap
|
||||
vec2 lastSegment = m_points[count-1] - m_points[count-2];
|
||||
m2::PointF lastPoint = m_points[count-1];
|
||||
direction = -lastSegment;
|
||||
if (doAddCap)
|
||||
{
|
||||
vec2 lastSegment = m_points[count-1] - m_points[count-2];
|
||||
m2::PointF lastPoint = m_points[count-1];
|
||||
direction = -lastSegment;
|
||||
|
||||
renderPoints.push_back(Point3D::From2D(lastPoint, m_depth)); // A
|
||||
renderDirections.push_back(Point3D::From2D(direction, -hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
renderPoints.push_back(Point3D::From2D(lastPoint, m_depth)); // A
|
||||
renderDirections.push_back(Point3D::From2D(direction, -hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
|
||||
renderPoints.push_back(Point3D::From2D(lastPoint, m_depth)); // B
|
||||
renderDirections.push_back(Point3D::From2D(direction, hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
renderPoints.push_back(Point3D::From2D(lastPoint, m_depth)); // B
|
||||
renderDirections.push_back(Point3D::From2D(direction, hw));
|
||||
renderVertexTypes.push_back(Point3D(T_CAP, m_params.m_cap, realWidth));
|
||||
}
|
||||
//
|
||||
|
||||
GLState state(gpu::SOLID_LINE_PROGRAM, 0, TextureBinding("", false, 0, MakeStackRefPointer<Texture>(NULL)));
|
||||
|
|
Loading…
Add table
Reference in a new issue