MCPcopy Create free account
hub / github.com/comaps/comaps / RenderAccuracy

Method RenderAccuracy

libs/drape_frontend/my_position.cpp:121–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void MyPosition::RenderAccuracy(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng,
122 ScreenBase const & screen, int zoomLevel, FrameValues const & frameValues)
123{
124 double constexpr kAccuracyConvergeSpeed = 6.0;
125 // exponential smoothing of scale
126 double const interpolationFactor = 1.0 - std::exp(-kAccuracyConvergeSpeed * frameValues.m_frameTime);
127 m_interpolatedAccuracy += static_cast<float>((m_accuracy - m_interpolatedAccuracy) * interpolationFactor);
128
129 m2::PointD accuracyPoint(m_position.x + m_interpolatedAccuracy, m_position.y);
130 auto const pixelAccuracy =
131 static_cast<float>((screen.GtoP(accuracyPoint) - screen.GtoP(m2::PointD(m_position))).Length());
132
133 gpu::ShapesProgramParams params;
134 frameValues.SetTo(params);
135 TileKey const key = GetTileKeyByPoint(m2::PointD(m_position), ClipTileZoomByMaxDataZoom(zoomLevel));
136 math::Matrix<float, 4, 4> mv = key.GetTileBasedModelView(screen);
137 params.m_modelView = glsl::make_mat4(mv.m_data);
138
139 auto const pos = static_cast<m2::PointF>(
140 MapShape::ConvertToLocal(m2::PointD(m_position), key.GetGlobalRect().Center(), kShapeCoordScalar));
141 params.m_position = glsl::vec3(pos.x, pos.y, 0.0f);
142 params.m_accuracy = pixelAccuracy;
143 RenderPart(context, mng, params, MyPositionAccuracy);
144}
145
146void MyPosition::RenderMyPosition(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng,
147 ScreenBase const & screen, int zoomLevel, FrameValues const & frameValues)

Callers 1

RenderMethod · 0.80

Calls 8

GetTileKeyByPointFunction · 0.85
SetToMethod · 0.80
GetTileBasedModelViewMethod · 0.80
LengthMethod · 0.45
GtoPMethod · 0.45
CenterMethod · 0.45
GetGlobalRectMethod · 0.45

Tested by

no test coverage detected