| 93 | } |
| 94 | |
| 95 | void 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 | |
| 128 | void 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 |
nothing calls this directly
no test coverage detected