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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/data/resources-mdpi/basic.skn b/data/resources-mdpi/basic.skn
deleted file mode 100644
index 85c4363c23..0000000000
--- a/data/resources-mdpi/basic.skn
+++ /dev/null
@@ -1,1070 +0,0 @@
-
-
-<<<<<<< e27eb0964d2290da1fdcfbf4dcead057bf185826
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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/route_arrow_fragment_shader.fsh
index fc3484985c..6e9a2d5a1a 100644
--- a/drape/shaders/route_arrow_fragment_shader.fsh
+++ b/drape/shaders/route_arrow_fragment_shader.fsh
@@ -7,27 +7,23 @@ uniform mat4 u_arrowBorders;
void main(void)
{
- float needDiscard = 1.0;
+ bool needDiscard = true;
vec2 uv = vec2(0, 0);
for (int i = 0; i < 4; i++)
{
- vec4 arrowBorder = u_arrowBorders[i];
+ vec4 arrowBorder = u_arrowBorders[i];
if (v_length.x >= arrowBorder.x && v_length.x <= arrowBorder.z)
- {
- needDiscard = 0.0;
+ {
+ needDiscard = false;
float coef = clamp((v_length.x - arrowBorder.x) / (arrowBorder.z - arrowBorder.x), 0.0, 1.0);
float u = mix(arrowBorder.y, arrowBorder.w, coef);
float v = 0.5 * v_length.y + 0.5;
uv = vec2(mix(u_textureRect.x, u_textureRect.z, u), mix(u_textureRect.y, u_textureRect.w, v));
- }
+ }
}
- if (needDiscard > 0.5)
+ if (needDiscard)
discard;
- vec4 color = texture2D(u_colorTex, uv);
- if (color.a < 0.1)
- discard;
-
- gl_FragColor = color;
+ gl_FragColor = texture2D(u_colorTex, uv);
}
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index cecd0d1fec..27716410b2 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -529,16 +529,17 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
RenderSingleGroup(modelView, make_ref(group));
}
- GLFunctions::glClearDepth();
+ GLFunctions::glDisable(gl_const::GLDepthTest);
+
m_routeRenderer->Render(modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
m_myPositionController->Render(MyPositionController::RenderMyPosition,
modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
- GLFunctions::glClearDepth();
-
if (m_guiRenderer != nullptr)
m_guiRenderer->Render(make_ref(m_gpuProgramManager), modelView);
+ GLFunctions::glEnable(gl_const::GLDepthTest);
+
#ifdef DRAW_INFO
AfterDrawFrame();
#endif
diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp
index 7098b5b4a5..557b31bc46 100644
--- a/drape_frontend/line_shape.cpp
+++ b/drape_frontend/line_shape.cpp
@@ -19,7 +19,7 @@ namespace df
namespace
{
using LV = gpu::LineVertex;
- using TGeometryBuffer = buffer_vector;
+ using TGeometryBuffer = buffer_vector;
class TextureCoordGenerator
{
@@ -235,9 +235,12 @@ void LineShape::Draw(ref_ptr batcher, ref_ptr t
provider.InitStream(0, gpu::LineVertex::GetBindingInfo(), make_ref(geometry.data()));
batcher->InsertListOfStrip(state, make_ref(&provider), 4);
- dp::AttributeProvider joinsProvider(1, joinsGeometry.size());
- joinsProvider.InitStream(0, gpu::LineVertex::GetBindingInfo(), make_ref(joinsGeometry.data()));
- batcher->InsertTriangleList(state, make_ref(&joinsProvider));
+ if (!joinsGeometry.empty())
+ {
+ dp::AttributeProvider joinsProvider(1, joinsGeometry.size());
+ joinsProvider.InitStream(0, gpu::LineVertex::GetBindingInfo(), make_ref(joinsGeometry.data()));
+ batcher->InsertTriangleList(state, make_ref(&joinsProvider));
+ }
}
} // namespace df
diff --git a/drape_frontend/my_position_controller.hpp b/drape_frontend/my_position_controller.hpp
index b1d1a38723..82ec056197 100644
--- a/drape_frontend/my_position_controller.hpp
+++ b/drape_frontend/my_position_controller.hpp
@@ -33,10 +33,11 @@ public:
};
// Render bits
- // {
- static uint32_t const RenderAccuracy = 0x1;
- static uint32_t const RenderMyPosition = 0x2;
- // }
+ enum RenderMode
+ {
+ RenderAccuracy = 0x1,
+ RenderMyPosition = 0x2
+ };
MyPositionController(location::EMyPositionMode initMode);
diff --git a/drape_frontend/route_builder.cpp b/drape_frontend/route_builder.cpp
index bc8281ae5c..34ba4c030f 100644
--- a/drape_frontend/route_builder.cpp
+++ b/drape_frontend/route_builder.cpp
@@ -39,9 +39,8 @@ void RouteBuilder::Build(m2::PolylineD const & routePolyline, vector co
m_flushRouteFn(state, move(bucket), routeData, eorState, move(eorBucket));
};
- m_batcher->StartSession(flushRoute);
+ dp::SessionGuard guard(*m_batcher, flushRoute);
shape.Draw(make_ref(m_batcher), textures);
- m_batcher->EndSession();
}
} // namespace df
diff --git a/drape_frontend/route_renderer.cpp b/drape_frontend/route_renderer.cpp
index 9e263166c9..438c14a661 100644
--- a/drape_frontend/route_renderer.cpp
+++ b/drape_frontend/route_renderer.cpp
@@ -30,19 +30,6 @@ double const arrowAspect = 400.0 / 192.0;
double const arrowTailSize = 20.0 / 400.0;
double const arrowHeadSize = 124.0 / 400.0;
-struct RouteSegment
-{
- double m_start = 0;
- double m_end = 0;
- bool m_isAvailable = false;
-
- RouteSegment(double start, double end, bool isAvailable)
- : m_start(start)
- , m_end(end)
- , m_isAvailable(isAvailable)
- {}
-};
-
int CheckForIntersection(double start, double end, vector const & segments)
{
for (size_t i = 0; i < segments.size(); i++)
@@ -80,7 +67,7 @@ int FindNearestAvailableSegment(double start, double end, vector c
return -1;
}
-void MergeAndClipBorders(vector & borders, double scale, double arrowTextureWidth)
+void MergeAndClipBorders(vector & borders)
{
if (borders.empty())
return;
@@ -111,10 +98,9 @@ void MergeAndClipBorders(vector & borders, double scale, double ar
borders[lastGroupIndex].m_endDistance = borders.back().m_endDistance;
// clip groups
- auto const iter = remove_if(borders.begin(), borders.end(),
- [&scale, &arrowTextureWidth](ArrowBorders const & borders)
+ auto const iter = remove_if(borders.begin(), borders.end(), [](ArrowBorders const & borders)
{
- return borders.m_groupIndex == -1;
+ return borders.m_groupIndex == -1;
});
borders.erase(iter, borders.end());
}
@@ -149,25 +135,43 @@ void RouteRenderer::Render(ScreenBase const & screen, ref_ptr prg = mng->GetProgram(graphics.m_state.GetProgramIndex());
+ // set up shaders and apply uniforms
+ ref_ptr prg = mng->GetProgram(state.GetProgramIndex());
prg->Bind();
- dp::ApplyBlending(graphics.m_state, prg);
+ dp::ApplyBlending(state, prg);
dp::ApplyUniforms(commonUniforms, prg);
dp::ApplyUniforms(uniformStorage, prg);
- graphics.m_buffer->Render();
+ // render routes
+ for (RouteGraphics & graphics : m_routeGraphics)
+ {
+ ASSERT(graphics.m_state == state, ());
+ graphics.m_buffer->Render();
+ }
- // arrows rendering
+ // render arrows
if (truncedZoom >= arrowAppearingZoomLevel)
- RenderArrow(graphics, halfWidth, screen, mng, commonUniforms);
+ {
+ // set up shaders and apply common uniforms
+ ref_ptr prgArrow = mng->GetProgram(gpu::ROUTE_ARROW_PROGRAM);
+ prgArrow->Bind();
+ dp::ApplyState(state, prgArrow);
+ dp::ApplyUniforms(commonUniforms, prgArrow);
+
+ for (RouteGraphics & graphics : m_routeGraphics)
+ RenderArrow(prgArrow, graphics, halfWidth, screen);
+ }
}
// render end of route
@@ -183,57 +187,46 @@ void RouteRenderer::Render(ScreenBase const & screen, ref_ptr mng, dp::UniformValuesStorage const & commonUniforms)
+void RouteRenderer::RenderArrow(ref_ptr prg, RouteGraphics const & graphics,
+ float halfWidth, ScreenBase const & screen)
{
double const arrowHalfWidth = halfWidth * arrowHeightFactor;
+ double const glbArrowHalfWidth = arrowHalfWidth * screen.GetScale();
double const arrowSize = 0.001;
double const textureWidth = 2.0 * arrowHalfWidth * arrowAspect;
dp::UniformValuesStorage uniformStorage;
- uniformStorage.SetFloatValue("u_halfWidth", arrowHalfWidth, arrowHalfWidth * screen.GetScale());
+ uniformStorage.SetFloatValue("u_halfWidth", arrowHalfWidth, glbArrowHalfWidth);
uniformStorage.SetFloatValue("u_textureRect", m_routeData.m_arrowTextureRect.minX(),
m_routeData.m_arrowTextureRect.minY(),
m_routeData.m_arrowTextureRect.maxX(),
m_routeData.m_arrowTextureRect.maxY());
// calculate arrows
- vector arrowBorders;
- CalculateArrowBorders(arrowSize, screen.GetScale(), textureWidth, arrowHalfWidth * screen.GetScale(), arrowBorders);
-
- // bind shaders
- ref_ptr prgArrow = mng->GetProgram(gpu::ROUTE_ARROW_PROGRAM);
- prgArrow->Bind();
- dp::ApplyState(graphics.m_state, prgArrow);
- dp::ApplyUniforms(commonUniforms, prgArrow);
+ m_arrowBorders.clear();
+ CalculateArrowBorders(arrowSize, screen.GetScale(), textureWidth, glbArrowHalfWidth);
// split arrow's data by 16-elements buckets
- size_t const elementsCount = 16;
- vector borders(elementsCount, 0.0);
+ array borders;
+ borders.fill(0.0f);
+ size_t const elementsCount = borders.size();
+
size_t index = 0;
- for (size_t i = 0; i < arrowBorders.size(); i++)
+ for (size_t i = 0; i < m_arrowBorders.size(); i++)
{
- borders[index++] = arrowBorders[i].m_startDistance;
- borders[index++] = arrowBorders[i].m_startTexCoord;
- borders[index++] = arrowBorders[i].m_endDistance;
- borders[index++] = arrowBorders[i].m_endTexCoord;
-
- // fill rests by zeros
- if (i == arrowBorders.size() - 1)
- {
- for (size_t j = index; j < elementsCount; j++)
- borders[j] = 0.0;
-
- index = elementsCount;
- }
+ borders[index++] = m_arrowBorders[i].m_startDistance;
+ borders[index++] = m_arrowBorders[i].m_startTexCoord;
+ borders[index++] = m_arrowBorders[i].m_endDistance;
+ borders[index++] = m_arrowBorders[i].m_endTexCoord;
// render arrow's parts
- if (index == elementsCount)
+ if (index == elementsCount || i == m_arrowBorders.size() - 1)
{
index = 0;
uniformStorage.SetMatrix4x4Value("u_arrowBorders", borders.data());
+ borders.fill(0.0f);
- dp::ApplyUniforms(uniformStorage, prgArrow);
+ dp::ApplyUniforms(uniformStorage, prg);
graphics.m_buffer->Render();
}
}
@@ -265,6 +258,8 @@ void RouteRenderer::Clear()
{
m_routeGraphics.clear();
m_endOfRouteBuffer.reset();
+ m_arrowBorders.clear();
+ m_routeSegments.clear();
}
void RouteRenderer::UpdateDistanceFromBegin(double distanceFromBegin)
@@ -272,14 +267,13 @@ void RouteRenderer::UpdateDistanceFromBegin(double distanceFromBegin)
m_distanceFromBegin = distanceFromBegin;
}
-void RouteRenderer::ApplyJoinsBounds(double arrowTextureWidth, double joinsBoundsScalar, double glbTailLength,
- double glbHeadLength, double scale, vector & borders)
+void RouteRenderer::ApplyJoinsBounds(double joinsBoundsScalar, double glbHeadLength)
{
- vector segments;
- segments.reserve(2 * m_routeData.m_joinsBounds.size() + 1);
+ m_routeSegments.clear();
+ m_routeSegments.reserve(2 * m_routeData.m_joinsBounds.size() + 1);
// construct route's segments
- segments.emplace_back(0.0, 0.0, true /* m_isAvailable */);
+ m_routeSegments.emplace_back(0.0, 0.0, true /* m_isAvailable */);
for (size_t i = 0; i < m_routeData.m_joinsBounds.size(); i++)
{
double const start = m_routeData.m_joinsBounds[i].m_offset +
@@ -287,33 +281,32 @@ void RouteRenderer::ApplyJoinsBounds(double arrowTextureWidth, double joinsBound
double const end = m_routeData.m_joinsBounds[i].m_offset +
m_routeData.m_joinsBounds[i].m_end * joinsBoundsScalar;
- segments.back().m_end = start;
- segments.emplace_back(start, end, false /* m_isAvailable */);
+ m_routeSegments.back().m_end = start;
+ m_routeSegments.emplace_back(start, end, false /* m_isAvailable */);
- segments.emplace_back(end, 0.0, true /* m_isAvailable */);
+ m_routeSegments.emplace_back(end, 0.0, true /* m_isAvailable */);
}
- segments.back().m_end = m_routeData.m_length;
+ m_routeSegments.back().m_end = m_routeData.m_length;
// shift head of arrow if necessary
bool needMerge = false;
- for (size_t i = 0; i < borders.size(); i++)
+ for (size_t i = 0; i < m_arrowBorders.size(); i++)
{
- int headIndex = FindNearestAvailableSegment(borders[i].m_endDistance - glbHeadLength,
- borders[i].m_endDistance, segments);
+ int headIndex = FindNearestAvailableSegment(m_arrowBorders[i].m_endDistance - glbHeadLength,
+ m_arrowBorders[i].m_endDistance, m_routeSegments);
if (headIndex != -1)
{
- borders[i].m_endDistance = min(m_routeData.m_length, segments[headIndex].m_start + glbHeadLength);
+ m_arrowBorders[i].m_endDistance = min(m_routeData.m_length, m_routeSegments[headIndex].m_start + glbHeadLength);
needMerge = true;
}
}
// merge intersected borders
if (needMerge)
- MergeAndClipBorders(borders, scale, arrowTextureWidth);
+ MergeAndClipBorders(m_arrowBorders);
}
-void RouteRenderer::CalculateArrowBorders(double arrowLength, double scale, double arrowTextureWidth,
- double joinsBoundsScalar, vector & borders)
+void RouteRenderer::CalculateArrowBorders(double arrowLength, double scale, double arrowTextureWidth, double joinsBoundsScalar)
{
if (m_routeData.m_turns.empty())
return;
@@ -323,7 +316,7 @@ void RouteRenderer::CalculateArrowBorders(double arrowLength, double scale, doub
double const glbTailLength = arrowTailSize * glbTextureWidth;
double const glbHeadLength = arrowHeadSize * glbTextureWidth;
- borders.reserve(m_routeData.m_turns.size() * arrowPartsCount);
+ m_arrowBorders.reserve(m_routeData.m_turns.size() * arrowPartsCount);
double const halfTextureWidth = 0.5 * glbTextureWidth;
if (halfLen < halfTextureWidth)
@@ -340,40 +333,39 @@ void RouteRenderer::CalculateArrowBorders(double arrowLength, double scale, doub
if (arrowBorders.m_startDistance < m_distanceFromBegin)
continue;
- borders.push_back(arrowBorders);
+ m_arrowBorders.push_back(arrowBorders);
}
// merge intersected borders and clip them
- MergeAndClipBorders(borders, scale, arrowTextureWidth);
+ MergeAndClipBorders(m_arrowBorders);
// apply joins bounds to prevent draw arrow's head on a join
- ApplyJoinsBounds(arrowTextureWidth, joinsBoundsScalar, glbTailLength,
- glbHeadLength, scale, borders);
+ ApplyJoinsBounds(joinsBoundsScalar, glbHeadLength);
// divide to parts of arrow
- size_t const bordersSize = borders.size();
+ size_t const bordersSize = m_arrowBorders.size();
for (size_t i = 0; i < bordersSize; i++)
{
- float const startDistance = borders[i].m_startDistance;
- float const endDistance = borders[i].m_endDistance;
+ float const startDistance = m_arrowBorders[i].m_startDistance;
+ float const endDistance = m_arrowBorders[i].m_endDistance;
- borders[i].m_endDistance = startDistance + glbTailLength;
- borders[i].m_startTexCoord = 0.0;
- borders[i].m_endTexCoord = arrowTailSize;
+ m_arrowBorders[i].m_endDistance = startDistance + glbTailLength;
+ m_arrowBorders[i].m_startTexCoord = 0.0;
+ m_arrowBorders[i].m_endTexCoord = arrowTailSize;
ArrowBorders arrowHead;
arrowHead.m_startDistance = endDistance - glbHeadLength;
arrowHead.m_endDistance = endDistance;
arrowHead.m_startTexCoord = 1.0 - arrowHeadSize;
arrowHead.m_endTexCoord = 1.0;
- borders.push_back(arrowHead);
+ m_arrowBorders.push_back(arrowHead);
ArrowBorders arrowBody;
- arrowBody.m_startDistance = borders[i].m_endDistance;
+ arrowBody.m_startDistance = m_arrowBorders[i].m_endDistance;
arrowBody.m_endDistance = arrowHead.m_startDistance;
- arrowBody.m_startTexCoord = borders[i].m_endTexCoord;
+ arrowBody.m_startTexCoord = m_arrowBorders[i].m_endTexCoord;
arrowBody.m_endTexCoord = arrowHead.m_startTexCoord;
- borders.push_back(arrowBody);
+ m_arrowBorders.push_back(arrowBody);
}
}
diff --git a/drape_frontend/route_renderer.hpp b/drape_frontend/route_renderer.hpp
index 1b71a78468..51e75d1214 100644
--- a/drape_frontend/route_renderer.hpp
+++ b/drape_frontend/route_renderer.hpp
@@ -34,6 +34,19 @@ struct ArrowBorders
int m_groupIndex = 0;
};
+struct RouteSegment
+{
+ double m_start = 0;
+ double m_end = 0;
+ bool m_isAvailable = false;
+
+ RouteSegment(double start, double end, bool isAvailable)
+ : m_start(start)
+ , m_end(end)
+ , m_isAvailable(isAvailable)
+ {}
+};
+
class RouteRenderer final
{
public:
@@ -53,14 +66,11 @@ public:
void UpdateDistanceFromBegin(double distanceFromBegin);
private:
- void CalculateArrowBorders(double arrowLength, double scale, double arrowTextureWidth,
- double joinsBoundsScalar, vector & borders);
+ void CalculateArrowBorders(double arrowLength, double scale, double arrowTextureWidth, double joinsBoundsScalar);
- void ApplyJoinsBounds(double arrowTextureWidth, double joinsBoundsScalar, double glbTailLength,
- double glbHeadLength, double scale, vector & borders);
+ void ApplyJoinsBounds(double joinsBoundsScalar, double glbHeadLength);
- void RenderArrow(RouteGraphics const & graphics, float halfWidth, ScreenBase const & screen,
- ref_ptr mng, dp::UniformValuesStorage const & commonUniforms);
+ void RenderArrow(ref_ptr prg, RouteGraphics const & graphics, float halfWidth, ScreenBase const & screen);
vector m_routeGraphics;
double m_distanceFromBegin;
@@ -68,6 +78,9 @@ private:
dp::GLState m_endOfRouteState;
drape_ptr m_endOfRouteBuffer;
+
+ vector m_arrowBorders;
+ vector m_routeSegments;
};
} // namespace df