Merge pull request #14126 from mapbox/gfx-refactor-4

Graphics refactor #4
This commit is contained in:
Konstantin Käfer
2019-03-15 20:31:12 +01:00
committed by GitHub
parent 62695c5695
commit c8cfdb1ced
156 changed files with 2486 additions and 2573 deletions

View File

@@ -1,4 +1,5 @@
#include <mbgl/programs/fill_program.hpp>
#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/renderer/image_atlas.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/tile/tile_id.hpp>
@@ -6,19 +7,23 @@
namespace mbgl {
template std::unique_ptr<gfx::Program<FillProgram>> gfx::Context::createProgram(const ProgramParameters&);
template std::unique_ptr<gfx::Program<FillPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
template std::unique_ptr<gfx::Program<FillOutlineProgram>> gfx::Context::createProgram(const ProgramParameters&);
template std::unique_ptr<gfx::Program<FillOutlinePatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
using namespace style;
static_assert(sizeof(FillLayoutVertex) == 4, "expected FillLayoutVertex size");
FillPatternProgram::UniformValues
FillPatternProgram::uniformValues(mat4 matrix,
Size framebufferSize,
Size atlasSize,
const CrossfadeParameters& crossfade,
const UnwrappedTileID& tileID,
const TransformState& state,
const float pixelRatio)
{
FillPatternProgram::LayoutUniformValues
FillPatternProgram::layoutUniformValues(mat4 matrix,
Size framebufferSize,
Size atlasSize,
const CrossfadeParameters& crossfade,
const UnwrappedTileID& tileID,
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));