From e5e87adbd1605a0f670ee29e522770e6febb5621 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 12:00:55 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../style/layers/custom_drawable_layer.hpp | 4 +- .../app/ExampleCustomDrawableStyleLayer.mm | 2 +- platform/glfw/CMakeLists.txt | 2 +- platform/glfw/assets/sphere.obj | 2 +- .../example_custom_drawable_style_layer.cpp | 227 +++++++++++------- .../example_custom_drawable_style_layer.hpp | 2 +- platform/glfw/glfw_metal_backend.mm | 2 +- platform/glfw/glfw_view.cpp | 1 - src/mbgl/mtl/upload_pass.cpp | 7 +- src/mbgl/shaders/mtl/location_indicator.cpp | 8 +- .../style/layers/custom_drawable_layer.cpp | 13 +- 11 files changed, 163 insertions(+), 107 deletions(-) diff --git a/include/mbgl/style/layers/custom_drawable_layer.hpp b/include/mbgl/style/layers/custom_drawable_layer.hpp index 825fe912373..8dcab8df6be 100644 --- a/include/mbgl/style/layers/custom_drawable_layer.hpp +++ b/include/mbgl/style/layers/custom_drawable_layer.hpp @@ -33,7 +33,6 @@ class CustomDrawableLayerHost { class CustomDrawableLayerHost::Interface { public: - enum class LineShaderType { Classic, WideVector @@ -181,7 +180,8 @@ class CustomDrawableLayerHost::Interface { const std::array, 2>& textureCoordinates = {{{0, 0}, {1, 1}}}); util::SimpleIdentity addGeometry(std::shared_ptr> vertices, - std::shared_ptr> indices, bool is3D); + std::shared_ptr> indices, + bool is3D); /** * @brief Finish the current drawable building session diff --git a/platform/darwin/app/ExampleCustomDrawableStyleLayer.mm b/platform/darwin/app/ExampleCustomDrawableStyleLayer.mm index 6dec493539b..1a9b9a67573 100644 --- a/platform/darwin/app/ExampleCustomDrawableStyleLayer.mm +++ b/platform/darwin/app/ExampleCustomDrawableStyleLayer.mm @@ -129,7 +129,7 @@ void update(Interface& interface) override { // add polyline interface.addPolyline(polyline, Interface::LineShaderType::WideVector); - + // add clone for(auto &p : polyline) { p.y += 0.05f * extent / numLines; diff --git a/platform/glfw/CMakeLists.txt b/platform/glfw/CMakeLists.txt index d26bb80b78c..a33d7aacd0b 100644 --- a/platform/glfw/CMakeLists.txt +++ b/platform/glfw/CMakeLists.txt @@ -26,7 +26,7 @@ add_executable( if(MLN_DRAWABLE_RENDERER) target_sources(mbgl-glfw PRIVATE ${PROJECT_SOURCE_DIR}/platform/glfw/example_custom_drawable_style_layer.cpp) - + include(${PROJECT_SOURCE_DIR}/vendor/tinyobjloader.cmake) target_link_libraries( diff --git a/platform/glfw/assets/sphere.obj b/platform/glfw/assets/sphere.obj index 9f48c6de145..d876cd13b74 100644 --- a/platform/glfw/assets/sphere.obj +++ b/platform/glfw/assets/sphere.obj @@ -1848,4 +1848,4 @@ f 141/332/141 173/387/173 168/386/168 f 164/331/164 200/233/200 173/387/173 # 720 faces, 387 coords texture -# End of File \ No newline at end of file +# End of File diff --git a/platform/glfw/example_custom_drawable_style_layer.cpp b/platform/glfw/example_custom_drawable_style_layer.cpp index 30e09de031b..f79418a4d64 100644 --- a/platform/glfw/example_custom_drawable_style_layer.cpp +++ b/platform/glfw/example_custom_drawable_style_layer.cpp @@ -16,20 +16,13 @@ ExampleCustomDrawableStyleLayerHost::ExampleCustomDrawableStyleLayerHost(const std::string& assetsPath_) : assetsPath(assetsPath_) {} -ExampleCustomDrawableStyleLayerHost::~ExampleCustomDrawableStyleLayerHost() { +ExampleCustomDrawableStyleLayerHost::~ExampleCustomDrawableStyleLayerHost() {} -} - -void ExampleCustomDrawableStyleLayerHost::initialize() { - -} +void ExampleCustomDrawableStyleLayerHost::initialize() {} -void ExampleCustomDrawableStyleLayerHost::deinitialize() { +void ExampleCustomDrawableStyleLayerHost::deinitialize() {} -} - void ExampleCustomDrawableStyleLayerHost::update(Interface& interface) { - // if we have built our drawable(s) already, either update or skip if (interface.getDrawableCount() == 0) { createDrawables(interface); @@ -44,32 +37,67 @@ mbgl::Point ExampleCustomDrawableStyleLayerHost::project(const mbgl::Lat } void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) { - constexpr float extent = mbgl::util::EXTENT; // add classic polylines { using namespace mbgl; - + // set tile interface.setTileID({11, 327, 792}); - + constexpr auto numLines = 6; - Interface::LineOptions options[numLines] { - {/*geometry=*/{}, /*blur=*/0.0f, /*opacity=*/1.0f, /*gapWidth=*/0.0f, /*offset=*/0.0f, /*width=*/8.0f, /*color=*/Color::red() }, - {/*geometry=*/{}, /*blur=*/4.0f, /*opacity=*/1.0f, /*gapWidth=*/2.0f, /*offset=*/-1.0f, /*width=*/4.0f, /*color=*/Color::blue() }, - {/*geometry=*/{}, /*blur=*/16.0f, /*opacity=*/1.0f, /*gapWidth=*/1.0f, /*offset=*/2.0f, /*width=*/16.0f, /*color=*/Color(1.f, 0.5f, 0, 0.5f) }, - {/*geometry=*/{}, /*blur=*/2.0f, /*opacity=*/1.0f, /*gapWidth=*/1.0f, /*offset=*/-2.0f, /*width=*/2.0f, /*color=*/Color(1.f, 1.f, 0, 0.3f) }, - {/*geometry=*/{}, /*blur=*/0.5f, /*opacity=*/0.5f, /*gapWidth=*/1.0f, /*offset=*/0.5f, /*width=*/0.5f, /*color=*/Color::black() }, - {/*geometry=*/{}, /*blur=*/24.0f, /*opacity=*/0.5f, /*gapWidth=*/1.0f, /*offset=*/-5.0f, /*width=*/24.0f, /*color=*/Color(1.f, 0, 1.f, 0.2f) }, + Interface::LineOptions options[numLines]{ + {/*geometry=*/{}, + /*blur=*/0.0f, + /*opacity=*/1.0f, + /*gapWidth=*/0.0f, + /*offset=*/0.0f, + /*width=*/8.0f, + /*color=*/Color::red()}, + {/*geometry=*/{}, + /*blur=*/4.0f, + /*opacity=*/1.0f, + /*gapWidth=*/2.0f, + /*offset=*/-1.0f, + /*width=*/4.0f, + /*color=*/Color::blue()}, + {/*geometry=*/{}, + /*blur=*/16.0f, + /*opacity=*/1.0f, + /*gapWidth=*/1.0f, + /*offset=*/2.0f, + /*width=*/16.0f, + /*color=*/Color(1.f, 0.5f, 0, 0.5f)}, + {/*geometry=*/{}, + /*blur=*/2.0f, + /*opacity=*/1.0f, + /*gapWidth=*/1.0f, + /*offset=*/-2.0f, + /*width=*/2.0f, + /*color=*/Color(1.f, 1.f, 0, 0.3f)}, + {/*geometry=*/{}, + /*blur=*/0.5f, + /*opacity=*/0.5f, + /*gapWidth=*/1.0f, + /*offset=*/0.5f, + /*width=*/0.5f, + /*color=*/Color::black()}, + {/*geometry=*/{}, + /*blur=*/24.0f, + /*opacity=*/0.5f, + /*gapWidth=*/1.0f, + /*offset=*/-5.0f, + /*width=*/24.0f, + /*color=*/Color(1.f, 0, 1.f, 0.2f)}, }; - for(auto& opt: options) { + for (auto& opt : options) { opt.geometry.beginCap = style::LineCapType::Butt; opt.geometry.endCap = style::LineCapType::Butt; opt.geometry.joinType = style::LineJoinType::Miter; } - + constexpr auto numPoints = 10; GeometryCoordinates polyline; for (auto ipoint{0}; ipoint < numPoints; ++ipoint) { @@ -77,15 +105,15 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) static_cast(ipoint * extent / numPoints), static_cast(std::sin(ipoint * 2 * M_PI / numPoints) * extent / numLines / 2.f)); } - - for (auto index {0}; index < numLines; ++index) { - for(auto &p : polyline) { + + for (auto index{0}; index < numLines; ++index) { + for (auto& p : polyline) { p.y += extent / numLines; } - + // set property values interface.setLineOptions(options[index]); - + // add polyline interface.addPolyline(polyline, Interface::LineShaderType::Classic); } @@ -94,26 +122,62 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) // add wide vector polylines with tile coordinates { using namespace mbgl; - + // set tile interface.setTileID({11, 327, 792}); - + constexpr auto numLines = 6; - Interface::LineOptions options[numLines] { - {/*geometry=*/{}, /*blur=*/0.0f, /*opacity=*/1.0f, /*gapWidth=*/0.0f, /*offset=*/0.0f, /*width=*/8.0f, /*color=*/Color::red() }, - {/*geometry=*/{}, /*blur=*/4.0f, /*opacity=*/1.0f, /*gapWidth=*/2.0f, /*offset=*/-1.0f, /*width=*/4.0f, /*color=*/Color::blue() }, - {/*geometry=*/{}, /*blur=*/16.0f, /*opacity=*/1.0f, /*gapWidth=*/1.0f, /*offset=*/2.0f, /*width=*/16.0f, /*color=*/Color(1.f, 0.5f, 0, 0.5f) }, - {/*geometry=*/{}, /*blur=*/2.0f, /*opacity=*/1.0f, /*gapWidth=*/1.0f, /*offset=*/-2.0f, /*width=*/2.0f, /*color=*/Color(1.f, 1.f, 0, 0.3f) }, - {/*geometry=*/{}, /*blur=*/0.5f, /*opacity=*/0.5f, /*gapWidth=*/1.0f, /*offset=*/0.5f, /*width=*/0.5f, /*color=*/Color::black() }, - {/*geometry=*/{}, /*blur=*/24.0f, /*opacity=*/0.5f, /*gapWidth=*/1.0f, /*offset=*/-5.0f, /*width=*/24.0f, /*color=*/Color(1.f, 0, 1.f, 0.2f) }, + Interface::LineOptions options[numLines]{ + {/*geometry=*/{}, + /*blur=*/0.0f, + /*opacity=*/1.0f, + /*gapWidth=*/0.0f, + /*offset=*/0.0f, + /*width=*/8.0f, + /*color=*/Color::red()}, + {/*geometry=*/{}, + /*blur=*/4.0f, + /*opacity=*/1.0f, + /*gapWidth=*/2.0f, + /*offset=*/-1.0f, + /*width=*/4.0f, + /*color=*/Color::blue()}, + {/*geometry=*/{}, + /*blur=*/16.0f, + /*opacity=*/1.0f, + /*gapWidth=*/1.0f, + /*offset=*/2.0f, + /*width=*/16.0f, + /*color=*/Color(1.f, 0.5f, 0, 0.5f)}, + {/*geometry=*/{}, + /*blur=*/2.0f, + /*opacity=*/1.0f, + /*gapWidth=*/1.0f, + /*offset=*/-2.0f, + /*width=*/2.0f, + /*color=*/Color(1.f, 1.f, 0, 0.3f)}, + {/*geometry=*/{}, + /*blur=*/0.5f, + /*opacity=*/0.5f, + /*gapWidth=*/1.0f, + /*offset=*/0.5f, + /*width=*/0.5f, + /*color=*/Color::black()}, + {/*geometry=*/{}, + /*blur=*/24.0f, + /*opacity=*/0.5f, + /*gapWidth=*/1.0f, + /*offset=*/-5.0f, + /*width=*/24.0f, + /*color=*/Color(1.f, 0, 1.f, 0.2f)}, }; - for(auto& opt: options) { + for (auto& opt : options) { opt.geometry.beginCap = style::LineCapType::Butt; opt.geometry.endCap = style::LineCapType::Butt; opt.geometry.joinType = style::LineJoinType::Miter; } - + constexpr auto numPoints = 10; GeometryCoordinates polyline; for (auto ipoint{0}; ipoint < numPoints; ++ipoint) { @@ -121,30 +185,30 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) static_cast(ipoint * extent / numPoints), static_cast(std::sin(ipoint * 2 * M_PI / numPoints) * extent / numLines / 2.f)); } - - for (auto index {0}; index < numLines; ++index) { - for(auto &p : polyline) { + + for (auto index{0}; index < numLines; ++index) { + for (auto& p : polyline) { if (0 == index) p.y += 0.25f * extent / numLines; p.y += extent / numLines; } - + // set property values interface.setLineOptions(options[index]); - + // add polyline interface.addPolyline(polyline); - + // add clone - for(auto &p : polyline) { + for (auto& p : polyline) { p.y += 0.05f * extent / numLines; } interface.addPolyline(polyline); - for(auto &p : polyline) { + for (auto& p : polyline) { p.y -= 0.05f * extent / numLines; } } } - + // add fill polygon { using namespace mbgl; @@ -155,19 +219,19 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) GeometryCollection geometry{ { // ring 1 - {static_cast(extent* 0.1f), static_cast(extent* 0.2f)}, - {static_cast(extent* 0.5f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.7f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.5f), static_cast(extent* 1.0f)}, - {static_cast(extent* 0.0f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.1f), static_cast(extent* 0.2f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.2f)}, + {static_cast(extent * 0.5f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.7f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.5f), static_cast(extent * 1.0f)}, + {static_cast(extent * 0.0f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.2f)}, }, { // ring 2 - {static_cast(extent* 0.1f), static_cast(extent* 0.25f)}, - {static_cast(extent* 0.15f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.25f), static_cast(extent* 0.45f)}, - {static_cast(extent* 0.1f), static_cast(extent* 0.25f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.25f)}, + {static_cast(extent * 0.15f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.25f), static_cast(extent * 0.45f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.25f)}, }, }; @@ -177,7 +241,7 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) // add fill interface.addFill(geometry); } - + // add symbol { using namespace mbgl; @@ -185,7 +249,7 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) // set tile interface.setTileID({11, 327, 789}); - GeometryCoordinate position {static_cast(extent* 0.0f), static_cast(extent* 0.5f)}; + GeometryCoordinate position{static_cast(extent * 0.0f), static_cast(extent * 0.5f)}; // load image std::shared_ptr image = std::make_shared( @@ -258,7 +322,7 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) options.geometry.type = FeatureType::LineString; interface.setLineOptions(options); - LineString polyline_geo { + LineString polyline_geo{ // San Francisco {-122.38186800073211, 37.77466003457463}, {-122.3869373450997, 37.774352128895615}, @@ -275,11 +339,11 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) }; interface.addPolyline(polyline_geo, Interface::LineShaderType::Classic); } - + // add polylines using wide vectors in tile coordinates { using namespace mbgl; - + // set tile interface.setTileID({11, 327, 790}); @@ -294,30 +358,29 @@ void ExampleCustomDrawableStyleLayerHost::createDrawables(Interface& interface) options.geometry.beginCap = style::LineCapType::Round; options.geometry.endCap = style::LineCapType::Round; options.geometry.joinType = style::LineJoinType::Round; - + // add polyline with tile coordinates GeometryCollection polyline_tile{ { // ring 1 - {static_cast(extent* 0.1f), static_cast(extent* 0.2f)}, - {static_cast(extent* 0.5f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.7f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.5f), static_cast(extent* 1.0f)}, - {static_cast(extent* 0.0f), static_cast(extent* 0.5f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.2f)}, + {static_cast(extent * 0.5f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.7f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.5f), static_cast(extent * 1.0f)}, + {static_cast(extent * 0.0f), static_cast(extent * 0.5f)}, }, { // ring 2 - {static_cast(extent* 0.1f), static_cast(extent* 0.25f)}, - {static_cast(extent* 0.15f), static_cast(extent* 0.5f)}, - {static_cast(extent* 0.25f), static_cast(extent* 0.45f)}, + {static_cast(extent * 0.1f), static_cast(extent * 0.25f)}, + {static_cast(extent * 0.15f), static_cast(extent * 0.5f)}, + {static_cast(extent * 0.25f), static_cast(extent * 0.45f)}, }, }; - + options.geometry.type = FeatureType::Polygon; interface.setLineOptions(options); interface.addPolyline(polyline_tile[0], Interface::LineShaderType::Classic); interface.addPolyline(polyline_tile[1], Interface::LineShaderType::Classic); - } generateGeometry(interface); @@ -336,7 +399,7 @@ void ExampleCustomDrawableStyleLayerHost::generateGeometry(Interface& interface) // load image std::shared_ptr image = std::make_shared( mbgl::decodeImage(mbgl::util::read_file(assetsPath + "puck.png"))); - + options.texture = interface.context.createTexture2D(); options.texture->setImage(image); options.texture->setSamplerConfiguration( @@ -370,10 +433,9 @@ void ExampleCustomDrawableStyleLayerHost::generateGeometry(Interface& interface) interface.setGeometryOptions(options); - interface.setGeometryTweakerCallback([=, rotation = 0.0f]( - [[maybe_unused]] mbgl::gfx::Drawable& drawable, - const mbgl::PaintParameters& params, - Interface::GeometryOptions& currentOptions) mutable { + interface.setGeometryTweakerCallback([=, rotation = 0.0f]([[maybe_unused]] mbgl::gfx::Drawable& drawable, + const mbgl::PaintParameters& params, + Interface::GeometryOptions& currentOptions) mutable { const mbgl::Point& center = project(location, params.state); rotation += 0.1f; @@ -392,14 +454,14 @@ void ExampleCustomDrawableStyleLayerHost::generateGeometry(Interface& interface) void ExampleCustomDrawableStyleLayerHost::loadGeometry(Interface& interface) { constexpr float itemScale = 0.1f; - constexpr std::array itemRotation = { 90.0f, 0.0f, 0.0f }; + constexpr std::array itemRotation = {90.0f, 0.0f, 0.0f}; const mbgl::LatLng location{37.76, -122.47}; Interface::GeometryOptions options; interface.setGeometryTweakerCallback([=]([[maybe_unused]] mbgl::gfx::Drawable& drawable, - const mbgl::PaintParameters& params, - Interface::GeometryOptions& currentOptions) mutable { + const mbgl::PaintParameters& params, + Interface::GeometryOptions& currentOptions) mutable { const mbgl::Point& center = project(location, params.state); const float scale = itemScale * static_cast(std::pow(2.f, params.state.getZoom())) * @@ -417,7 +479,7 @@ void ExampleCustomDrawableStyleLayerHost::loadGeometry(Interface& interface) { const std::shared_ptr sharedVertices = std::make_shared(); const std::shared_ptr sharedIndices = std::make_shared(); - //importObj(interface, "../../_deps/tinyobjloader-src/models/cube.obj", *sharedVertices, *sharedIndices, options); + // importObj(interface, "../../_deps/tinyobjloader-src/models/cube.obj", *sharedVertices, *sharedIndices, options); importObj(interface, assetsPath + "sphere.obj", *sharedVertices, *sharedIndices, options); interface.setGeometryOptions(options); @@ -494,7 +556,6 @@ mbgl::gfx::Texture2DPtr ExampleCustomDrawableStyleLayerHost::createCheckerboardT uint16_t blockSize, const std::array& color1, const std::array& color2) { - std::shared_ptr image = std::make_shared( mbgl::Size(wb * blockSize, hb * blockSize)); diff --git a/platform/glfw/example_custom_drawable_style_layer.hpp b/platform/glfw/example_custom_drawable_style_layer.hpp index eaa9fcf5174..9a1e130f26d 100644 --- a/platform/glfw/example_custom_drawable_style_layer.hpp +++ b/platform/glfw/example_custom_drawable_style_layer.hpp @@ -36,4 +36,4 @@ class ExampleCustomDrawableStyleLayerHost : public mbgl::style::CustomDrawableLa protected: const std::string assetsPath; -}; \ No newline at end of file +}; diff --git a/platform/glfw/glfw_metal_backend.mm b/platform/glfw/glfw_metal_backend.mm index 77d793429ab..6ef1d697092 100644 --- a/platform/glfw/glfw_metal_backend.mm +++ b/platform/glfw/glfw_metal_backend.mm @@ -7,7 +7,7 @@ #include GLFWMetalBackend::GLFWMetalBackend(GLFWwindow* window_, [[maybe_unused]] const bool capFrameRate) - : + : window(glfwGetCocoaWindow(window_)), rendererBackend(window) { diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 050b8f556e8..c7d1b9e478c 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -831,7 +831,6 @@ void GLFWView::popAnnotation() { } void GLFWView::toggleCustomDrawableStyle() { - #ifndef MBGL_LAYER_CUSTOM_DISABLE_ALL auto &style = map->getStyle(); diff --git a/src/mbgl/mtl/upload_pass.cpp b/src/mbgl/mtl/upload_pass.cpp index fb56455af88..fefbc41637e 100644 --- a/src/mbgl/mtl/upload_pass.cpp +++ b/src/mbgl/mtl/upload_pass.cpp @@ -89,11 +89,8 @@ std::unique_ptr UploadPass::createTextureResource(const Si throw std::runtime_error("UploadPass::createTextureResource not implemented on Metal!"); } -void UploadPass::updateTextureResource(gfx::TextureResource&, - const Size, - const void*, - gfx::TexturePixelType, - gfx::TextureChannelDataType) { +void UploadPass::updateTextureResource( + gfx::TextureResource&, const Size, const void*, gfx::TexturePixelType, gfx::TextureChannelDataType) { assert(false); throw std::runtime_error("UploadPass::updateTextureResource not implemented on Metal!"); } diff --git a/src/mbgl/shaders/mtl/location_indicator.cpp b/src/mbgl/shaders/mtl/location_indicator.cpp index 7cbc810a661..fcdd06d4eee 100644 --- a/src/mbgl/shaders/mtl/location_indicator.cpp +++ b/src/mbgl/shaders/mtl/location_indicator.cpp @@ -6,11 +6,11 @@ namespace shaders { using LocationIndicatorShaderSource = ShaderSource; -const std::array LocationIndicatorShaderSource::attributes = { - AttributeInfo{locationIndicatorUBOCount + 0, gfx::AttributeDataType::Float2, idLocationIndicatorPosVertexAttribute} -}; +const std::array LocationIndicatorShaderSource::attributes = {AttributeInfo{ + locationIndicatorUBOCount + 0, gfx::AttributeDataType::Float2, idLocationIndicatorPosVertexAttribute}}; -using LocationIndicatorTexturedShaderSource = ShaderSource; +using LocationIndicatorTexturedShaderSource = + ShaderSource; const std::array LocationIndicatorTexturedShaderSource::attributes = { AttributeInfo{locationIndicatorUBOCount + 0, gfx::AttributeDataType::Float2, idLocationIndicatorPosVertexAttribute}, diff --git a/src/mbgl/style/layers/custom_drawable_layer.cpp b/src/mbgl/style/layers/custom_drawable_layer.cpp index 5fb568ffce2..5e8dc663b7b 100644 --- a/src/mbgl/style/layers/custom_drawable_layer.cpp +++ b/src/mbgl/style/layers/custom_drawable_layer.cpp @@ -333,7 +333,7 @@ class FillDrawableTweaker : public gfx::DrawableTweaker { if (!drawableUniformBuffer) { drawableUniformBuffer = parameters.context.createUniformBuffer( &drawableUBO, sizeof(drawableUBO), false, true); - + layerUniforms->set(idFillDrawableUBO, drawableUniformBuffer); drawable.setUBOIndex(0); } else { @@ -416,9 +416,8 @@ class SymbolDrawableTweaker : public gfx::DrawableTweaker { class GeometryDrawableTweaker : public gfx::DrawableTweaker { public: - GeometryDrawableTweaker( - const CustomDrawableLayerHost::Interface::GeometryOptions& options_, - CustomDrawableLayerHost::Interface::GeometryTweakerCallback&& callback_) + GeometryDrawableTweaker(const CustomDrawableLayerHost::Interface::GeometryOptions& options_, + CustomDrawableLayerHost::Interface::GeometryTweakerCallback&& callback_) : options(options_), callback(callback_) {} ~GeometryDrawableTweaker() override = default; @@ -680,8 +679,8 @@ util::SimpleIdentity CustomDrawableLayerHost::Interface::addSymbol( util::SimpleIdentity CustomDrawableLayerHost::Interface::addGeometry( std::shared_ptr> vertices, - std::shared_ptr> indices, bool is3D) { - + std::shared_ptr> indices, + bool is3D) { if (!vertices || !indices) { return util::SimpleIdentity::Empty; } @@ -701,7 +700,7 @@ util::SimpleIdentity CustomDrawableLayerHost::Interface::addGeometry( SegmentVector triangleSegments; triangleSegments.emplace_back(Segment{0, 0, vertices->elements(), indices->elements()}); - + // add to builder auto attrs = context.createVertexAttributeArray(); if (const auto& attr = attrs->set(idLocationIndicatorPosVertexAttribute)) {