| 119 | } |
| 120 | |
| 121 | void 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 | |
| 146 | void MyPosition::RenderMyPosition(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng, |
| 147 | ScreenBase const & screen, int zoomLevel, FrameValues const & frameValues) |
no test coverage detected