| 142 | } |
| 143 | |
| 144 | void CirclesPackShape::Draw(ref_ptr<dp::GraphicsContext> context, CirclesPackRenderData & data) |
| 145 | { |
| 146 | ASSERT_NOT_EQUAL(data.m_pointsCount, 0, ()); |
| 147 | |
| 148 | uint32_t constexpr kVerticesInPoint = dp::Batcher::VertexPerQuad; |
| 149 | uint32_t constexpr kIndicesInPoint = dp::Batcher::IndexPerQuad; |
| 150 | |
| 151 | std::vector<CirclesPackStaticVertex> staticVertexData; |
| 152 | staticVertexData.reserve(data.m_pointsCount * kVerticesInPoint); |
| 153 | static_assert(kVerticesInPoint == 4, "According to the loop below"); |
| 154 | for (size_t i = 0; i < data.m_pointsCount; ++i) |
| 155 | { |
| 156 | staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(-1.0f, 1.0f, 1.0f)); |
| 157 | staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(-1.0f, -1.0f, 1.0f)); |
| 158 | staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(1.0f, 1.0f, 1.0f)); |
| 159 | staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(1.0f, -1.0f, 1.0f)); |
| 160 | } |
| 161 | |
| 162 | std::vector<CirclesPackDynamicVertex> dynamicVertexData; |
| 163 | dynamicVertexData.resize(data.m_pointsCount * kVerticesInPoint); |
| 164 | |
| 165 | dp::Batcher batcher(data.m_pointsCount * kIndicesInPoint, data.m_pointsCount * kVerticesInPoint); |
| 166 | batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Overlay)); |
| 167 | dp::SessionGuard guard(context, batcher, [&data](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b) |
| 168 | { |
| 169 | data.m_bucket = std::move(b); |
| 170 | data.m_state = state; |
| 171 | }); |
| 172 | |
| 173 | drape_ptr<dp::OverlayHandle> handle = make_unique_dp<CirclesPackHandle>(data.m_pointsCount); |
| 174 | |
| 175 | dp::AttributeProvider provider(2 /* stream count */, static_cast<uint32_t>(staticVertexData.size())); |
| 176 | provider.InitStream(0 /* stream index */, GetCirclesPackStaticBindingInfo(), make_ref(staticVertexData.data())); |
| 177 | provider.InitStream(1 /* stream index */, GetCirclesPackDynamicBindingInfo(), make_ref(dynamicVertexData.data())); |
| 178 | batcher.InsertListOfStrip(context, GetCirclesPackState(), make_ref(&provider), std::move(handle), kVerticesInPoint); |
| 179 | |
| 180 | context->Flush(); |
| 181 | } |
| 182 | } // namespace df |
nothing calls this directly
no test coverage detected