Exemple #1
0
void MyPosition::RenderAccuracy(ScreenBase const & screen,
                        ref_ptr<dp::GpuProgramManager> mng,
                        dp::UniformValuesStorage const & commonUniforms)
{
  dp::UniformValuesStorage uniforms = commonUniforms;
  m2::PointD accuracyPoint(m_position.x + m_accuracy, m_position.y);
  float pixelAccuracy = (screen.GtoP(accuracyPoint) - screen.GtoP(m_position)).Length();

  uniforms.SetFloatValue("u_position", m_position.x, m_position.y, dp::depth::POSITION_ACCURACY);
  uniforms.SetFloatValue("u_accuracy", pixelAccuracy);
  uniforms.SetFloatValue("u_opacity", 1.0);
  RenderPart(mng, uniforms, MY_POSITION_ACCURACY);
}
Exemple #2
0
void MyPosition::RenderAccuracy(ScreenBase const & screen, int zoomLevel,
                                ref_ptr<dp::GpuProgramManager> mng,
                                dp::UniformValuesStorage const & commonUniforms)
{
  dp::UniformValuesStorage uniforms = commonUniforms;
  m2::PointD accuracyPoint(m_position.x + m_accuracy, m_position.y);
  float pixelAccuracy = (screen.GtoP(accuracyPoint) - screen.GtoP(m_position)).Length();

  TileKey const key = GetTileKeyByPoint(m_position, ClipTileZoomByMaxDataZoom(zoomLevel));
  math::Matrix<float, 4, 4> mv = key.GetTileBasedModelView(screen);
  uniforms.SetMatrix4x4Value("modelView", mv.m_data);

  m2::PointD const pos = MapShape::ConvertToLocal(m_position, key.GetGlobalRect().Center(), kShapeCoordScalar);
  uniforms.SetFloatValue("u_position", pos.x, pos.y, 0.0f);
  uniforms.SetFloatValue("u_accuracy", pixelAccuracy);
  uniforms.SetFloatValue("u_opacity", 1.0f);
  RenderPart(mng, uniforms, MY_POSITION_ACCURACY);
}