forked from organicmaps/organicmaps
Do not run user marks animation if there isn't any animated mark.
This commit is contained in:
parent
98d3d64085
commit
6e39853c8d
3 changed files with 21 additions and 10 deletions
|
@ -211,11 +211,15 @@ bool RenderGroupComparator::operator()(drape_ptr<RenderGroup> const & l, drape_p
|
|||
|
||||
UserMarkRenderGroup::UserMarkRenderGroup(dp::GLState const & state, TileKey const & tileKey)
|
||||
: TBase(state, tileKey)
|
||||
, m_animation(new OpacityAnimation(0.25 /*duration*/, 0.0 /* minValue */, 1.0 /* maxValue*/))
|
||||
{
|
||||
m_mapping.AddRangePoint(0.6, 1.3);
|
||||
m_mapping.AddRangePoint(0.85, 0.8);
|
||||
m_mapping.AddRangePoint(1.0, 1.0);
|
||||
if (state.GetProgramIndex() == gpu::BOOKMARK_ANIM_PROGRAM ||
|
||||
state.GetProgram3dIndex() == gpu::BOOKMARK_ANIM_BILLBOARD_PROGRAM)
|
||||
{
|
||||
m_animation = make_unique<OpacityAnimation>(0.25 /*duration*/, 0.0 /* minValue */, 1.0 /* maxValue*/);
|
||||
m_mapping.AddRangePoint(0.6f, 1.3f);
|
||||
m_mapping.AddRangePoint(0.85f, 0.8f);
|
||||
m_mapping.AddRangePoint(1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
UserMarkRenderGroup::~UserMarkRenderGroup()
|
||||
|
@ -225,11 +229,13 @@ UserMarkRenderGroup::~UserMarkRenderGroup()
|
|||
void UserMarkRenderGroup::UpdateAnimation()
|
||||
{
|
||||
BaseRenderGroup::UpdateAnimation();
|
||||
float t = 1.0f;
|
||||
float interplationT = 1.0f;
|
||||
if (m_animation)
|
||||
t = static_cast<float>(m_animation->GetOpacity());
|
||||
|
||||
m_uniforms.SetFloatValue("u_interpolationT", m_mapping.GetValue(t));
|
||||
{
|
||||
float const t = static_cast<float>(m_animation->GetOpacity());
|
||||
interplationT = m_mapping.GetValue(t);
|
||||
}
|
||||
m_uniforms.SetFloatValue("u_interpolationT", interplationT);
|
||||
}
|
||||
|
||||
bool UserMarkRenderGroup::IsUserPoint() const
|
||||
|
|
|
@ -19,6 +19,7 @@ RULER_PROGRAM ruler.vsh.glsl texturing.fsh.glsl
|
|||
ACCURACY_PROGRAM position_accuracy3d.vsh.glsl texturing.fsh.glsl
|
||||
MY_POSITION_PROGRAM my_position.vsh.glsl texturing.fsh.glsl
|
||||
BOOKMARK_PROGRAM user_mark.vsh.glsl discarded_texturing.fsh.glsl
|
||||
BOOKMARK_ANIM_PROGRAM user_mark.vsh.glsl discarded_texturing.fsh.glsl
|
||||
ROUTE_PROGRAM route.vsh.glsl route.fsh.glsl
|
||||
ROUTE_DASH_PROGRAM route.vsh.glsl route_dash.fsh.glsl
|
||||
ROUTE_ARROW_PROGRAM route_arrow.vsh.glsl discarded_texturing.fsh.glsl
|
||||
|
@ -35,6 +36,7 @@ TEXT_OUTLINED_BILLBOARD_PROGRAM text_outlined_billboard.vsh.glsl text.fsh.glsl
|
|||
TEXT_BILLBOARD_PROGRAM text_billboard.vsh.glsl text.fsh.glsl
|
||||
TEXT_FIXED_BILLBOARD_PROGRAM text_billboard.vsh.glsl text_fixed.fsh.glsl
|
||||
BOOKMARK_BILLBOARD_PROGRAM user_mark_billboard.vsh.glsl discarded_texturing.fsh.glsl
|
||||
BOOKMARK_ANIM_BILLBOARD_PROGRAM user_mark_billboard.vsh.glsl discarded_texturing.fsh.glsl
|
||||
TRAFFIC_PROGRAM traffic.vsh.glsl traffic.fsh.glsl
|
||||
TRAFFIC_LINE_PROGRAM traffic_line.vsh.glsl traffic_line.fsh.glsl
|
||||
SMAA_EDGES_PROGRAM smaa_edges.vsh.glsl smaa_edges.fsh.glsl
|
||||
|
|
|
@ -92,6 +92,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
|
|||
using UPV = UserPointVertex;
|
||||
size_t const vertexCount = marksId.size() * dp::Batcher::VertexPerQuad;
|
||||
buffer_vector<UPV, 128> buffer;
|
||||
bool isAnimated = false;
|
||||
|
||||
dp::TextureManager::SymbolRegion region;
|
||||
dp::GLState::DepthLayer depthLayer = dp::GLState::UserMarkLayer;
|
||||
|
@ -132,6 +133,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
|
|||
kShapeCoordScalar);
|
||||
glsl::vec3 const pos = glsl::vec3(glsl::ToVec2(pt), renderInfo.m_depth);
|
||||
bool const runAnim = renderInfo.m_runCreationAnim && renderInfo.m_justCreated;
|
||||
isAnimated |= runAnim;
|
||||
|
||||
glsl::vec2 left, right, up, down;
|
||||
AlignHorizontal(pxSize.x * 0.5f, anchor, left, right);
|
||||
|
@ -182,8 +184,9 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
|
|||
|
||||
if (!buffer.empty())
|
||||
{
|
||||
dp::GLState state(gpu::BOOKMARK_PROGRAM, depthLayer);
|
||||
state.SetProgram3dIndex(gpu::BOOKMARK_BILLBOARD_PROGRAM);
|
||||
dp::GLState state(isAnimated ? gpu::BOOKMARK_ANIM_PROGRAM : gpu::BOOKMARK_PROGRAM, depthLayer);
|
||||
state.SetProgram3dIndex(isAnimated ? gpu::BOOKMARK_ANIM_BILLBOARD_PROGRAM
|
||||
: gpu::BOOKMARK_BILLBOARD_PROGRAM);
|
||||
state.SetColorTexture(region.GetTexture());
|
||||
state.SetTextureFilter(gl_const::GLNearest);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue