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

Method Render

libs/drape_frontend/gui/shape.cpp:98–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void 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
134void ShapeRenderer::AddShape(dp::RenderState const & state, drape_ptr<dp::RenderBucket> && bucket)
135{

Callers

nothing calls this directly

Calls 15

MakeProjectionFunction · 0.85
ApplyStateFunction · 0.85
make_refFunction · 0.85
SizeXMethod · 0.80
SizeYMethod · 0.80
GetParamsMethod · 0.80
GetParamsSetterMethod · 0.80
HasDynamicAttributesMethod · 0.80
ApplyMutationMethod · 0.80
GetDrawAsLineMethod · 0.80
GetApiVersionMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected