#include #include #include #include #include #include #include namespace mbgl { namespace vulkan { gfx::UniqueDrawable DrawableBuilder::createDrawable() const { return std::make_unique(drawableName.empty() ? name : drawableName); }; std::unique_ptr DrawableBuilder::createSegment(gfx::DrawMode mode, SegmentBase&& seg) { return std::make_unique(mode, std::move(seg)); } void DrawableBuilder::init() { auto& drawable = static_cast(*currentDrawable); if (impl->rawVerticesCount) { auto raw = impl->rawVertices; drawable.setVertices(std::move(raw), impl->rawVerticesCount, impl->rawVerticesType); } else { const auto& verts = impl->vertices.vector(); constexpr auto vertSize = sizeof(std::remove_reference::type::value_type); std::vector raw(verts.size() * vertSize); std::memcpy(raw.data(), verts.data(), raw.size()); drawable.setVertices(std::move(raw), verts.size(), gfx::AttributeDataType::Short2); } if (!impl->sharedIndexes && !impl->buildIndexes.empty()) { impl->sharedIndexes = std::make_shared(std::move(impl->buildIndexes)); } assert(impl->sharedIndexes && impl->sharedIndexes->elements()); drawable.setIndexData(std::move(impl->sharedIndexes), std::move(impl->segments)); impl->clear(); textures.fill(nullptr); } } // namespace vulkan } // namespace mbgl