[core] move Painter and dependents to new *TileID classes

This commit is contained in:
Konstantin Käfer
2016-03-08 17:18:57 +01:00
parent 5b640fb446
commit dde59eaf76
30 changed files with 138 additions and 670 deletions

View File

@@ -11,7 +11,10 @@
using namespace mbgl;
void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileID& id, const mat4& matrix) {
void Painter::renderLine(LineBucket& bucket,
const LineLayer& layer,
const UnwrappedTileID& tileID,
const mat4& matrix) {
// Abort early.
if (pass == RenderPass::Opaque) return;
@@ -50,7 +53,7 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
color[2] *= properties.lineOpacity;
color[3] *= properties.lineOpacity;
const float ratio = 1.0 / id.pixelsToTileUnits(1.0, state.getZoom());
const float ratio = 1.0 / tileID.pixelsToTileUnits(1.0, state.getZoom());
mat2 antialiasingMatrix;
matrix::identity(antialiasingMatrix);
@@ -63,7 +66,8 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
float x = state.getHeight() / 2.0f * std::tan(state.getPitch());
float extra = (topedgelength + x) / topedgelength - 1;
mat4 vtxMatrix = translatedMatrix(matrix, properties.lineTranslate, id, properties.lineTranslateAnchor);
mat4 vtxMatrix =
translatedMatrix(matrix, properties.lineTranslate, tileID, properties.lineTranslateAnchor);
setDepthSublayer(0);
@@ -84,9 +88,9 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
const float widthA = posA.width * properties.lineDasharray.value.fromScale * layer.dashLineWidth;
const float widthB = posB.width * properties.lineDasharray.value.toScale * layer.dashLineWidth;
float scaleXA = 1.0 / id.pixelsToTileUnits(widthA, state.getIntegerZoom());
float scaleXA = 1.0 / tileID.pixelsToTileUnits(widthA, state.getIntegerZoom());
float scaleYA = -posA.height / 2.0;
float scaleXB = 1.0 / id.pixelsToTileUnits(widthB, state.getIntegerZoom());
float scaleXB = 1.0 / tileID.pixelsToTileUnits(widthB, state.getIntegerZoom());
float scaleYB = -posB.height / 2.0;
linesdfShader->u_patternscale_a = {{ scaleXA, scaleYA }};
@@ -121,14 +125,14 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
linepatternShader->u_blur = blur;
linepatternShader->u_pattern_size_a = {{
id.pixelsToTileUnits((*imagePosA).size[0] * properties.linePattern.value.fromScale, state.getIntegerZoom()),
tileID.pixelsToTileUnits((*imagePosA).size[0] * properties.linePattern.value.fromScale, state.getIntegerZoom()),
(*imagePosA).size[1]
}};
linepatternShader->u_pattern_tl_a = (*imagePosA).tl;
linepatternShader->u_pattern_br_a = (*imagePosA).br;
linepatternShader->u_pattern_size_b = {{
id.pixelsToTileUnits((*imagePosB).size[0] * properties.linePattern.value.toScale, state.getIntegerZoom()),
tileID.pixelsToTileUnits((*imagePosB).size[0] * properties.linePattern.value.toScale, state.getIntegerZoom()),
(*imagePosB).size[1]
}};
linepatternShader->u_pattern_tl_b = (*imagePosB).tl;