@@ -19,7 +19,7 @@
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.3.5",
|
||||
"express": "^4.11.1",
|
||||
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#0eda4509d2893adb3aaf92ac68301cdc7722e7b1",
|
||||
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#d3cdb7f427c7f36ad234b45732b9c77c73440dad",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#b3441d9a285ffbe9b876677acb13d7df07e5b975",
|
||||
"node-gyp": "^3.3.1",
|
||||
"request": "^2.72.0",
|
||||
|
||||
@@ -43,13 +43,10 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
|
||||
} else {
|
||||
if (wireframe) {
|
||||
plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
|
||||
plainShader->u_opacity = 1.0f;
|
||||
} else {
|
||||
Color color = properties.backgroundColor;
|
||||
color[0] *= properties.backgroundOpacity;
|
||||
color[1] *= properties.backgroundOpacity;
|
||||
color[2] *= properties.backgroundOpacity;
|
||||
color[3] *= properties.backgroundOpacity;
|
||||
plainShader->u_color = color;
|
||||
plainShader->u_color = properties.backgroundColor;
|
||||
plainShader->u_opacity = properties.backgroundOpacity;
|
||||
}
|
||||
|
||||
config.program = plainShader->getID();
|
||||
@@ -102,18 +99,10 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
|
||||
|
||||
patternShader->u_offset_a = std::array<float, 2>{{offsetAx, offsetAy}};
|
||||
patternShader->u_offset_b = std::array<float, 2>{{offsetBx, offsetBy}};
|
||||
|
||||
|
||||
} else {
|
||||
plainShader->u_matrix = vtxMatrix;
|
||||
if (wireframe) {
|
||||
plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
|
||||
} else {
|
||||
plainShader->u_color = properties.backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)tileStencilBuffer.index()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,6 @@ void Painter::renderCircle(CircleBucket& bucket,
|
||||
mat4 vtxMatrix = translatedMatrix(matrix, properties.circleTranslate, tileID,
|
||||
properties.circleTranslateAnchor);
|
||||
|
||||
Color color = properties.circleColor;
|
||||
color[0] *= properties.circleOpacity;
|
||||
color[1] *= properties.circleOpacity;
|
||||
color[2] *= properties.circleOpacity;
|
||||
color[3] *= properties.circleOpacity;
|
||||
|
||||
// Antialiasing factor: this is a minimum blur distance that serves as
|
||||
// a faux-antialiasing for the circle. since blur is a ratio of the circle's
|
||||
// size and the intent is to keep the blur at roughly 1px, the two
|
||||
@@ -40,7 +34,8 @@ void Painter::renderCircle(CircleBucket& bucket,
|
||||
|
||||
circleShader->u_matrix = vtxMatrix;
|
||||
circleShader->u_exmatrix = extrudeMatrix;
|
||||
circleShader->u_color = color;
|
||||
circleShader->u_color = properties.circleColor;
|
||||
circleShader->u_opacity = properties.circleOpacity;
|
||||
circleShader->u_blur = std::max<float>(properties.circleBlur, antialiasing);
|
||||
circleShader->u_size = properties.circleRadius;
|
||||
|
||||
|
||||
@@ -18,19 +18,11 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
translatedMatrix(matrix, properties.fillTranslate, tileID, properties.fillTranslateAnchor);
|
||||
|
||||
Color fill_color = properties.fillColor;
|
||||
fill_color[0] *= properties.fillOpacity;
|
||||
fill_color[1] *= properties.fillOpacity;
|
||||
fill_color[2] *= properties.fillOpacity;
|
||||
fill_color[3] *= properties.fillOpacity;
|
||||
float opacity = properties.fillOpacity;
|
||||
|
||||
Color stroke_color = properties.fillOutlineColor;
|
||||
if (stroke_color[3] < 0) {
|
||||
stroke_color = fill_color;
|
||||
} else {
|
||||
stroke_color[0] *= properties.fillOpacity;
|
||||
stroke_color[1] *= properties.fillOpacity;
|
||||
stroke_color[2] *= properties.fillOpacity;
|
||||
stroke_color[3] *= properties.fillOpacity;
|
||||
}
|
||||
|
||||
bool pattern = !properties.fillPattern.value.from.empty();
|
||||
@@ -41,6 +33,7 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
if (wireframe) {
|
||||
fill_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
|
||||
stroke_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
|
||||
opacity = 1.0f;
|
||||
pattern = false;
|
||||
outline = true;
|
||||
fringeline = true;
|
||||
@@ -60,6 +53,7 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
config.lineWidth = 2.0f; // This is always fixed and does not depend on the pixelRatio!
|
||||
|
||||
outlineShader->u_color = stroke_color;
|
||||
outlineShader->u_opacity = opacity;
|
||||
|
||||
// Draw the entire line
|
||||
outlineShader->u_world = {{
|
||||
@@ -164,7 +158,7 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
}
|
||||
} else if (!wireframe) {
|
||||
// No image fill.
|
||||
if ((fill_color[3] >= 1.0f) == (pass == RenderPass::Opaque)) {
|
||||
if ((fill_color[3] >= 1.0f && opacity >= 1.0f) == (pass == RenderPass::Opaque)) {
|
||||
// Only draw the fill when it's either opaque and we're drawing opaque
|
||||
// fragments or when it's translucent and we're drawing translucent
|
||||
// fragments
|
||||
@@ -172,6 +166,7 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
config.program = plainShader->getID();
|
||||
plainShader->u_matrix = vtxMatrix;
|
||||
plainShader->u_color = fill_color;
|
||||
plainShader->u_opacity = opacity;
|
||||
|
||||
// Draw the actual triangles into the color & stencil buffer.
|
||||
setDepthSublayer(1);
|
||||
@@ -187,7 +182,8 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
config.lineWidth = 2.0f; // This is always fixed and does not depend on the pixelRatio!
|
||||
|
||||
outlineShader->u_color = fill_color;
|
||||
|
||||
outlineShader->u_opacity = opacity;
|
||||
|
||||
// Draw the entire line
|
||||
outlineShader->u_world = {{
|
||||
static_cast<float>(frame.framebufferSize[0]),
|
||||
|
||||
@@ -49,12 +49,10 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
float outset = offset + edgeWidth + antialiasing / 2.0 + shift;
|
||||
|
||||
Color color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
|
||||
float opacity = 1.0f;
|
||||
if (!wireframe) {
|
||||
color = properties.lineColor;
|
||||
color[0] *= properties.lineOpacity;
|
||||
color[1] *= properties.lineOpacity;
|
||||
color[2] *= properties.lineOpacity;
|
||||
color[3] *= properties.lineOpacity;
|
||||
opacity = properties.lineOpacity;
|
||||
}
|
||||
|
||||
const float ratio = 1.0 / tileID.pixelsToTileUnits(1.0, state.getZoom());
|
||||
@@ -85,6 +83,7 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
linesdfShader->u_ratio = ratio;
|
||||
linesdfShader->u_blur = blur;
|
||||
linesdfShader->u_color = color;
|
||||
linesdfShader->u_opacity = opacity;
|
||||
|
||||
LinePatternPos posA = lineAtlas->getDashPosition(properties.lineDasharray.value.from, layout.lineCap == LineCapType::Round, glObjectStore);
|
||||
LinePatternPos posB = lineAtlas->getDashPosition(properties.lineDasharray.value.to, layout.lineCap == LineCapType::Round, glObjectStore);
|
||||
@@ -167,6 +166,7 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
lineShader->u_antialiasingmatrix = antialiasingMatrix;
|
||||
|
||||
lineShader->u_color = color;
|
||||
lineShader->u_opacity = opacity;
|
||||
|
||||
bucket.drawLines(*lineShader, glObjectStore);
|
||||
}
|
||||
|
||||
@@ -87,15 +87,8 @@ void Painter::renderSDF(SymbolBucket &bucket,
|
||||
// to draw the halo first.
|
||||
if (haloColor[3] > 0.0f && haloWidth > 0.0f) {
|
||||
sdfShader.u_gamma = (haloBlur * blurOffset / fontScale / sdfPx + gamma) * gammaScale;
|
||||
|
||||
if (opacity < 1.0f) {
|
||||
haloColor[0] *= opacity;
|
||||
haloColor[1] *= opacity;
|
||||
haloColor[2] *= opacity;
|
||||
haloColor[3] *= opacity;
|
||||
}
|
||||
|
||||
sdfShader.u_color = haloColor;
|
||||
sdfShader.u_opacity = opacity;
|
||||
sdfShader.u_buffer = (haloOffset - haloWidth / fontScale) / sdfPx;
|
||||
|
||||
setDepthSublayer(0);
|
||||
@@ -105,15 +98,8 @@ void Painter::renderSDF(SymbolBucket &bucket,
|
||||
// Then, we draw the text/icon over the halo
|
||||
if (color[3] > 0.0f) {
|
||||
sdfShader.u_gamma = gamma * gammaScale;
|
||||
|
||||
if (opacity < 1.0f) {
|
||||
color[0] *= opacity;
|
||||
color[1] *= opacity;
|
||||
color[2] *= opacity;
|
||||
color[3] *= opacity;
|
||||
}
|
||||
|
||||
sdfShader.u_color = color;
|
||||
sdfShader.u_opacity = opacity;
|
||||
sdfShader.u_buffer = (256.0f - 64.0f) / 256.0f;
|
||||
|
||||
setDepthSublayer(1);
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
Uniform<GLfloat> u_size = {"u_size", *this};
|
||||
Uniform<GLfloat> u_blur = {"u_blur", *this};
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_ratio = {"u_ratio", *this};
|
||||
Uniform<GLfloat> u_blur = {"u_blur", *this};
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_ratio = {"u_ratio", *this};
|
||||
Uniform<GLfloat> u_blur = {"u_blur", *this};
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_world = {"u_world", *this};
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<GLfloat, 4>> u_color = {"u_color", *this};
|
||||
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_texsize = {"u_texsize", *this};
|
||||
Uniform<GLfloat> u_buffer = {"u_buffer", *this};
|
||||
Uniform<GLfloat> u_gamma = {"u_gamma", *this};
|
||||
|
||||
Reference in New Issue
Block a user