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

Method DrawHatchingArea

libs/drape_frontend/area_shape.cpp:95–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void AreaShape::DrawHatchingArea(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Batcher> batcher,
96 m2::PointD const & colorUv, ref_ptr<dp::Texture> texture,
97 ref_ptr<dp::Texture> hatchingTexture) const
98{
99 glsl::vec2 const uv = glsl::ToVec2(colorUv);
100
101 m2::RectD bbox;
102 for (auto const & v : m_vertexes)
103 bbox.Add(v);
104
105 double const maxU = m_params.m_baseGtoPScale / hatchingTexture->GetWidth();
106 double const maxV = m_params.m_baseGtoPScale / hatchingTexture->GetHeight();
107
108 gpu::VBReservedSizeT<gpu::HatchingAreaVertex> vertexes;
109 vertexes.reserve(m_vertexes.size());
110 for (m2::PointD const & vertex : m_vertexes)
111 {
112 vertexes.emplace_back(ToShapeVertex3(vertex), uv,
113 glsl::vec2(static_cast<float>(maxU * (vertex.x - bbox.minX())),
114 static_cast<float>(maxV * (vertex.y - bbox.minY()))));
115 }
116
117 auto state = CreateRenderState(gpu::Program::HatchingArea, DepthLayer::GeometryLayer);
118 state.SetDepthTestEnabled(m_params.m_depthTestEnabled);
119 state.SetColorTexture(texture);
120 state.SetMaskTexture(hatchingTexture);
121 state.SetTextureFilter(dp::TextureFilter::Linear);
122
123 dp::AttributeProvider provider(1, static_cast<uint32_t>(vertexes.size()));
124 provider.InitStream(0, gpu::HatchingAreaVertex::GetBindingInfo(), make_ref(vertexes.data()));
125 batcher->InsertTriangleList(context, state, make_ref(&provider));
126}
127
128void AreaShape::DrawArea3D(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Batcher> batcher,
129 m2::PointD const & colorUv, m2::PointD const & outlineUv, ref_ptr<dp::Texture> texture) const

Callers

nothing calls this directly

Calls 15

ToVec2Function · 0.85
vec2Class · 0.85
CreateRenderStateFunction · 0.85
GetBindingInfoFunction · 0.85
make_refFunction · 0.85
minXMethod · 0.80
minYMethod · 0.80
SetColorTextureMethod · 0.80
SetMaskTextureMethod · 0.80
SetTextureFilterMethod · 0.80
InitStreamMethod · 0.80
InsertTriangleListMethod · 0.80

Tested by

no test coverage detected