| 96 | } |
| 97 | |
| 98 | void ShapeRenderer::Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng, |
| 99 | ScreenBase const & screen) |
| 100 | { |
| 101 | m2::RectD const & pxRect = screen.PixelRectIn3d(); |
| 102 | auto m = dp::MakeProjection(context->GetApiVersion(), 0.0f, static_cast<float>(pxRect.SizeX()), |
| 103 | static_cast<float>(pxRect.SizeY()), 0.0f); |
| 104 | glsl::mat4 const projection = glsl::make_mat4(m.data()); |
| 105 | |
| 106 | ForEachShapeInfo([&projection, &screen, context, mng](ShapeControl::ShapeInfo & info) mutable |
| 107 | { |
| 108 | if (!info.m_handle->Update(screen)) |
| 109 | return; |
| 110 | |
| 111 | if (!info.m_handle->IsVisible()) |
| 112 | return; |
| 113 | |
| 114 | ref_ptr<dp::GpuProgram> prg = mng->GetProgram(info.m_state.GetProgram<gpu::Program>()); |
| 115 | prg->Bind(); |
| 116 | dp::ApplyState(context, prg, info.m_state); |
| 117 | |
| 118 | auto params = info.m_handle->GetParams(); |
| 119 | params.m_projection = projection; |
| 120 | mng->GetParamsSetter()->Apply(context, prg, params); |
| 121 | |
| 122 | if (info.m_handle->HasDynamicAttributes()) |
| 123 | { |
| 124 | dp::AttributeBufferMutator mutator; |
| 125 | ref_ptr<dp::AttributeBufferMutator> mutatorRef = make_ref(&mutator); |
| 126 | info.m_handle->GetAttributeMutation(mutatorRef); |
| 127 | info.m_buffer->ApplyMutation(context, nullptr, mutatorRef); |
| 128 | } |
| 129 | |
| 130 | info.m_buffer->Render(context, info.m_state.GetDrawAsLine()); |
| 131 | }); |
| 132 | } |
| 133 | |
| 134 | void ShapeRenderer::AddShape(dp::RenderState const & state, drape_ptr<dp::RenderBucket> && bucket) |
| 135 | { |
nothing calls this directly
no test coverage detected