diff --git a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp index be236ba1f..4e3837b24 100644 --- a/src/mbgl/renderer/layers/fill_layer_tweaker.cpp +++ b/src/mbgl/renderer/layers/fill_layer_tweaker.cpp @@ -45,12 +45,11 @@ struct alignas(16) FillDrawableUBO { static_assert(sizeof(FillDrawableUBO) == 208); // move to utils, or does it already exist somewhere? -template -auto concat(const std::array& a1, const std::array& a2) -{ - std::array result; - std::copy (a1.cbegin(), a1.cend(), result.begin()); - std::copy (a2.cbegin(), a2.cend(), result.begin() + N); +template +auto concat(const std::array& a1, const std::array& a2) { + std::array result; + std::copy(a1.cbegin(), a1.cend(), result.begin()); + std::copy(a2.cbegin(), a2.cend(), result.begin() + N); return result; } @@ -84,13 +83,17 @@ void FillLayerTweaker::execute(LayerGroup& layerGroup, const UnwrappedTileID tileID = drawable.getTileID()->toUnwrapped(); const auto& colorProperty = evaluated.get(); - const auto color = (colorProperty.isConstant() && colorProperty.constant()) ? *colorProperty.constant() : Color(0.0f, 0.0f, 0.0f, 0.0f); + const auto color = (colorProperty.isConstant() && colorProperty.constant()) ? *colorProperty.constant() + : Color(0.0f, 0.0f, 0.0f, 0.0f); const auto& outlineColorProperty = evaluated.get(); - const auto outlineColor = (outlineColorProperty.isConstant() && outlineColorProperty.constant()) ? *outlineColorProperty.constant() : Color(0.0f, 0.0f, 0.0f, 0.0f); + const auto outlineColor = (outlineColorProperty.isConstant() && outlineColorProperty.constant()) + ? *outlineColorProperty.constant() + : Color(0.0f, 0.0f, 0.0f, 0.0f); const auto& opacityProperty = evaluated.get(); - const auto opacity = (opacityProperty.isConstant() && opacityProperty.constant()) ? *opacityProperty.constant() : 1.0f; + const auto opacity = (opacityProperty.isConstant() && opacityProperty.constant()) ? *opacityProperty.constant() + : 1.0f; const auto& fillPatternProperty = evaluated.get(); if (fillPatternProperty.isConstant() && fillPatternProperty.constant()) { @@ -121,7 +124,7 @@ void FillLayerTweaker::execute(LayerGroup& layerGroup, const auto& textures = drawable.getTextures(); const auto hasTex = !textures.empty() && textures[0].texture; - const Size textureSize = hasTex ? textures[0].texture->getSize() : Size(0,0); + const Size textureSize = hasTex ? textures[0].texture->getSize() : Size(0, 0); const FillDrawableUBO drawableUBO = { /*.matrix=*/util::cast(matrix), @@ -129,17 +132,17 @@ void FillLayerTweaker::execute(LayerGroup& layerGroup, /*.world=*/{(float)renderableSize.width, (float)renderableSize.height}, /*.pixel_coord_upper=*/{static_cast(pixelX >> 16), static_cast(pixelY >> 16)}, /*.pixel_coord_lower=*/{static_cast(pixelX & 0xFFFF), static_cast(pixelY & 0xFFFF)}, - /*.texsize=*/ { static_cast(textureSize.width), static_cast(textureSize.height) }, + /*.texsize=*/{static_cast(textureSize.width), static_cast(textureSize.height)}, /*.fade=*/crossfade.t, /*.color_t=*/crossfade.t, /*.opacity_t=*/crossfade.t, /*.outline_color_t=*/crossfade.t, /*.pattern_from_t=*/crossfade.t, /*.pattern_to_t=*/crossfade.t, - /*.color=*/ attributeValue(color), - /*.opacity=*/ {opacity, opacity}, + /*.color=*/attributeValue(color), + /*.opacity=*/{opacity, opacity}, /*.outline_color_pad=*/{0.0f}, - /*.outline_color=*/ util::cast(outlineColor.toArray()), + /*.outline_color=*/util::cast(outlineColor.toArray()), /*.pattern_from=*/{0.0f}, /*.pattern_to=*/{0.0f}, }; diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 93eeed57b..f5479a852 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -515,8 +515,8 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, if (auto& binder = paintPropertyBinders.get()) { const auto count = binder->getVertexCount(); - for (auto& attrs : - {std::reference_wrapper(patternVertexAttrs), std::reference_wrapper(patternOutlineVertexAttrs)}) { + for (auto& attrs : {std::reference_wrapper(patternVertexAttrs), + std::reference_wrapper(patternOutlineVertexAttrs)}) { if (auto& attr = attrs.get().getOrAdd("a_opacity")) { for (std::size_t i = 0; i < count; ++i) { const auto& opacity = @@ -528,21 +528,23 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, } } } -// if (auto& binder = paintPropertyBinders.get()) { -// const auto count = binder->getVertexCount(); -// for (auto& attrs : -// {std::reference_wrapper(patternVertexAttrs), std::reference_wrapper(patternOutlineVertexAttrs)}) { -// if (auto& attr = attrs.get().getOrAdd("a_pattern_from")) { -// for (std::size_t i = 0; i < count; ++i) { -// const auto& opacity = -// static_cast>*>( -// binder->getVertexValue(i)) -// ->a1; -// attr->set(i, {}); -// } -// } -// } -// } + // if (auto& binder = paintPropertyBinders.get()) { + // const auto count = binder->getVertexCount(); + // for (auto& attrs : + // {std::reference_wrapper(patternVertexAttrs), + // std::reference_wrapper(patternOutlineVertexAttrs)}) { + // if (auto& attr = attrs.get().getOrAdd("a_pattern_from")) { + // for (std::size_t i = 0; i < count; ++i) { + // const auto& opacity = + // static_cast>*>( + // binder->getVertexValue(i)) + // ->a1; + // attr->set(i, {}); + // } + // } + // } + // } if (!patternBuilder && patternShader) { patternBuilder = context.createDrawableBuilder("fill-pattern");