[core] seamless fill-pattern
seamless across dateline upgrade test-suite version
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.2.21",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#4cee4c1369d013d59fe8b453ae3305f9eb057edf",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#46c907f48d2b3b8ae6531963cdc40cb07958fd01",
|
||||
"node-gyp": "^3.2.1",
|
||||
"request": "^2.67.0",
|
||||
"tape": "^4.2.2"
|
||||
|
||||
@@ -65,7 +65,7 @@ void Painter::renderFill(FillBucket& bucket, const FillLayer& layer, const TileI
|
||||
|
||||
// Image fill.
|
||||
if (pass == RenderPass::Translucent && posA && posB) {
|
||||
float factor = 8.0 / std::pow(2, state.getIntegerZoom() - id.z) / id.overscaling;
|
||||
float factor = (8.0 / std::pow(2, state.getIntegerZoom() - id.z)) / id.overscaling;
|
||||
|
||||
mat3 patternMatrixA;
|
||||
matrix::identity(patternMatrixA);
|
||||
@@ -90,6 +90,26 @@ void Painter::renderFill(FillBucket& bucket, const FillLayer& layer, const TileI
|
||||
patternShader->u_patternmatrix_a = patternMatrixA;
|
||||
patternShader->u_patternmatrix_b = patternMatrixB;
|
||||
|
||||
std::array<int, 2> imageSizeScaledA = {{
|
||||
(int)((*posA).size[0] * properties.pattern.value.fromScale),
|
||||
(int)((*posA).size[1] * properties.pattern.value.fromScale)
|
||||
}};
|
||||
std::array<int, 2> imageSizeScaledB = {{
|
||||
(int)((*posB).size[0] * properties.pattern.value.toScale),
|
||||
(int)((*posB).size[1] * properties.pattern.value.toScale)
|
||||
}};
|
||||
|
||||
int tileSize = 512;
|
||||
|
||||
float offsetAx = ((tileSize % imageSizeScaledA[0]) * id.x) / (float)imageSizeScaledA[0];
|
||||
float offsetAy = ((tileSize % imageSizeScaledA[1]) * id.y) / (float)imageSizeScaledA[1];
|
||||
|
||||
float offsetBx = ((tileSize % imageSizeScaledB[0]) * id.x) / (float)imageSizeScaledB[0];
|
||||
float offsetBy = ((tileSize % imageSizeScaledB[1]) * id.y) / (float)imageSizeScaledB[1];
|
||||
|
||||
patternShader->u_offset_a = std::array<float, 2>{{offsetAx, offsetAy}};
|
||||
patternShader->u_offset_b = std::array<float, 2>{{offsetBx, offsetBy}};
|
||||
|
||||
MBGL_CHECK_ERROR(glActiveTexture(GL_TEXTURE0));
|
||||
spriteAtlas->bind(true);
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ uniform mat4 u_matrix;
|
||||
uniform mat3 u_patternmatrix_a;
|
||||
uniform mat3 u_patternmatrix_b;
|
||||
|
||||
uniform vec2 u_offset_a;
|
||||
uniform vec2 u_offset_b;
|
||||
|
||||
attribute vec2 a_pos;
|
||||
|
||||
varying vec2 v_pos_a;
|
||||
@@ -9,6 +12,6 @@ varying vec2 v_pos_b;
|
||||
|
||||
void main() {
|
||||
gl_Position = u_matrix * vec4(a_pos, 0, 1);
|
||||
v_pos_a = (u_patternmatrix_a * vec3(a_pos, 1)).xy;
|
||||
v_pos_b = (u_patternmatrix_b * vec3(a_pos, 1)).xy;
|
||||
v_pos_a = (u_patternmatrix_a * vec3(a_pos, 1)).xy + u_offset_a;
|
||||
v_pos_b = (u_patternmatrix_b * vec3(a_pos, 1)).xy + u_offset_b;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
Uniform<GLint> u_image = {"u_image", *this};
|
||||
UniformMatrix<3> u_patternmatrix_a = {"u_patternmatrix_a", *this};
|
||||
UniformMatrix<3> u_patternmatrix_b = {"u_patternmatrix_b", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_offset_a = {"u_offset_a", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_offset_b = {"u_offset_b", *this};
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user