コード例 #1
0
ファイル: selection_shape.cpp プロジェクト: Mapotempo/omim
void SelectionShape::Render(ScreenBase const & screen, int zoomLevel, ref_ptr<dp::GpuProgramManager> mng,
                            dp::UniformValuesStorage const & commonUniforms)
{
  ShowHideAnimation::EState state = m_animation.GetState();
  if (state == ShowHideAnimation::STATE_VISIBLE ||
      state == ShowHideAnimation::STATE_SHOW_DIRECTION)
  {
    dp::UniformValuesStorage uniforms = commonUniforms;
    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, -m_positionZ);

    float accuracy = m_mapping.GetValue(m_animation.GetT());
    if (screen.isPerspective())
    {
      m2::PointD const pt1 = screen.GtoP(m_position);
      m2::PointD const pt2(pt1.x + 1, pt1.y);
      float const scale = screen.PtoP3d(pt2).x - screen.PtoP3d(pt1).x;
      accuracy /= scale;
    }
    uniforms.SetFloatValue("u_accuracy", accuracy);
    uniforms.SetFloatValue("u_opacity", 1.0f);
    m_renderNode->Render(mng, uniforms);
  }
}
コード例 #2
0
ref_ptr<MarksIDGroups> UserMarkGenerator::GetUserLinesGroups(TileKey const & tileKey)
{
  auto itTile = m_index.end();
  int const lineZoom = GetNearestLineIndexZoom(tileKey.m_zoomLevel);
  CalcTilesCoverage(tileKey.GetGlobalRect(), lineZoom,
                    [this, &itTile, lineZoom](int tileX, int tileY)
  {
    itTile = m_index.find(TileKey(tileX, tileY, lineZoom));
  });
  if (itTile != m_index.end())
    return make_ref(itTile->second);
  return nullptr;
}
コード例 #3
0
ファイル: my_position.cpp プロジェクト: rokuz/omim
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);
}
コード例 #4
0
ファイル: my_position.cpp プロジェクト: rokuz/omim
void MyPosition::RenderMyPosition(ScreenBase const & screen, int zoomLevel,
                                  ref_ptr<dp::GpuProgramManager> mng,
                                  dp::UniformValuesStorage const & commonUniforms)
{
  if (m_showAzimuth)
  {
    m_arrow3d.SetPosition(m_position);
    m_arrow3d.SetAzimuth(m_azimuth);
    m_arrow3d.Render(screen, zoomLevel, mng);
  }
  else
  {
    dp::UniformValuesStorage uniforms = commonUniforms;
    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, dp::depth::MY_POSITION_MARK);
    uniforms.SetFloatValue("u_azimut", -(m_azimuth + screen.GetAngle()));
    uniforms.SetFloatValue("u_opacity", 1.0);
    RenderPart(mng, uniforms, MY_POSITION_POINT);
  }
}