diff options
Diffstat (limited to 'src/mbgl/programs/fill_program.cpp')
-rw-r--r-- | src/mbgl/programs/fill_program.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp index 46dc830102..b072343e7a 100644 --- a/src/mbgl/programs/fill_program.cpp +++ b/src/mbgl/programs/fill_program.cpp @@ -14,33 +14,25 @@ FillPatternUniforms::Values FillPatternUniforms::values(mat4 matrix, Size framebufferSize, Size atlasSize, - const ImagePosition& a, - const ImagePosition& b, - const Faded<std::string>& fading, + const CrossfadeParameters& crossfade, const UnwrappedTileID& tileID, - const TransformState& state) + const TransformState& state, + const float pixelRatio) { + const auto tileRatio = 1 / tileID.pixelsToTileUnits(1, state.getIntegerZoom()); int32_t tileSizeAtNearestZoom = util::tileSize * state.zoomScale(state.getIntegerZoom() - tileID.canonical.z); int32_t pixelX = tileSizeAtNearestZoom * (tileID.canonical.x + tileID.wrap * state.zoomScale(tileID.canonical.z)); int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y; return FillPatternUniforms::Values { - uniforms::u_matrix::Value{ matrix }, - uniforms::u_world::Value{ framebufferSize }, - uniforms::u_texsize::Value{ atlasSize }, - uniforms::u_pattern_tl_a::Value{ a.tl() }, - uniforms::u_pattern_br_a::Value{ a.br() }, - uniforms::u_pattern_tl_b::Value{ b.tl() }, - uniforms::u_pattern_br_b::Value{ b.br() }, - uniforms::u_pattern_size_a::Value{ a.displaySize() }, - uniforms::u_pattern_size_b::Value{ b.displaySize() }, - uniforms::u_scale_a::Value{ fading.fromScale }, - uniforms::u_scale_b::Value{ fading.toScale }, - uniforms::u_mix::Value{ fading.t }, - uniforms::u_image::Value{ 0 }, - uniforms::u_pixel_coord_upper::Value{ std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }} }, - uniforms::u_pixel_coord_lower::Value{ std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} }, - uniforms::u_tile_units_to_pixels::Value{ 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) }, + uniforms::u_matrix::Value( matrix ), + uniforms::u_world::Value( framebufferSize ), + uniforms::u_texsize::Value( atlasSize ), + uniforms::u_scale::Value({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} } ), + uniforms::u_fade::Value( crossfade.t ), + uniforms::u_image::Value( 0 ), + uniforms::u_pixel_coord_upper::Value( std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }}), + uniforms::u_pixel_coord_lower::Value( std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ) }; } |