summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-05-30 09:45:02 +0300
committerAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-05-31 18:40:27 +0300
commit62f6338d5bc0f0a2c515f45ba30bf5de506e9929 (patch)
tree677f981c4e29215bc1480f8ecf23423b48dd69c5
parent0181ef8f63351aa2724d5a89ba9ea3e5484e3aaf (diff)
downloadqtlocation-mapboxgl-62f6338d5bc0f0a2c515f45ba30bf5de506e9929.tar.gz
[core] Fix: fill-extrusion-vertical-gradient was ignored. #14784
fill-extrusion-vertical-gradient "property-type": "data-constant" and it shouldn't be computed through property binders. Fixes: #14784
-rw-r--r--src/mbgl/programs/fill_extrusion_program.cpp9
-rw-r--r--src/mbgl/programs/fill_extrusion_program.hpp12
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp6
3 files changed, 18 insertions, 9 deletions
diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp
index d22e911589..7209072b02 100644
--- a/src/mbgl/programs/fill_extrusion_program.cpp
+++ b/src/mbgl/programs/fill_extrusion_program.cpp
@@ -32,13 +32,14 @@ float lightIntensity(const EvaluatedLight& light) {
}
FillExtrusionProgram::LayoutUniformValues FillExtrusionProgram::layoutUniformValues(
- mat4 matrix, const TransformState& state, const float opacity, const EvaluatedLight& light) {
+ mat4 matrix, const TransformState& state, const float opacity, const EvaluatedLight& light, const float verticalGradient) {
return {
uniforms::matrix::Value( matrix ),
uniforms::opacity::Value( opacity ),
uniforms::lightcolor::Value( lightColor(light) ),
uniforms::lightpos::Value( lightPosition(light, state) ),
- uniforms::lightintensity::Value( lightIntensity(light) )
+ uniforms::lightintensity::Value( lightIntensity(light) ),
+ uniforms::vertical_gradient::Value( verticalGradient )
};
}
@@ -51,7 +52,8 @@ FillExtrusionPatternProgram::layoutUniformValues(mat4 matrix,
const float opacity,
const float heightFactor,
const float pixelRatio,
- const EvaluatedLight& light) {
+ const EvaluatedLight& light,
+ const float verticalGradient) {
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));
@@ -69,6 +71,7 @@ FillExtrusionPatternProgram::layoutUniformValues(mat4 matrix,
uniforms::lightcolor::Value( lightColor(light) ),
uniforms::lightpos::Value( lightPosition(light, state) ),
uniforms::lightintensity::Value( lightIntensity(light) ),
+ uniforms::vertical_gradient::Value( verticalGradient )
};
}
diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp
index 410b281f7a..961f604734 100644
--- a/src/mbgl/programs/fill_extrusion_program.hpp
+++ b/src/mbgl/programs/fill_extrusion_program.hpp
@@ -24,6 +24,7 @@ namespace uniforms {
MBGL_DEFINE_UNIFORM_VECTOR(float, 3, lightpos);
MBGL_DEFINE_UNIFORM_VECTOR(float, 3, lightcolor);
MBGL_DEFINE_UNIFORM_SCALAR(float, lightintensity);
+MBGL_DEFINE_UNIFORM_SCALAR(float, vertical_gradient);
MBGL_DEFINE_UNIFORM_SCALAR(float, height_factor);
} // namespace uniforms
@@ -36,7 +37,8 @@ using FillExtrusionUniforms = TypeList<
uniforms::opacity,
uniforms::lightcolor,
uniforms::lightpos,
- uniforms::lightintensity>;
+ uniforms::lightintensity,
+ uniforms::vertical_gradient>;
using FillExtrusionPatternUniforms = TypeList<
uniforms::matrix,
@@ -49,7 +51,8 @@ using FillExtrusionPatternUniforms = TypeList<
uniforms::height_factor,
uniforms::lightcolor,
uniforms::lightpos,
- uniforms::lightintensity>;
+ uniforms::lightintensity,
+ uniforms::vertical_gradient>;
class FillExtrusionProgram : public Program<
FillExtrusionProgram,
@@ -83,7 +86,7 @@ public:
}
static LayoutUniformValues
- layoutUniformValues(mat4, const TransformState&, const float opacity, const EvaluatedLight&);
+ layoutUniformValues(mat4, const TransformState&, const float opacity, const EvaluatedLight&, const float verticalGradient);
};
class FillExtrusionPatternProgram : public Program<
@@ -106,7 +109,8 @@ public:
const float opacity,
const float heightFactor,
const float pixelRatio,
- const EvaluatedLight&);
+ const EvaluatedLight&,
+ const float verticalGradient);
};
using FillExtrusionLayoutVertex = FillExtrusionProgram::LayoutVertex;
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 6355479193..29002d8bdf 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -134,7 +134,8 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters) {
parameters.state),
parameters.state,
evaluated.get<FillExtrusionOpacity>(),
- parameters.evaluatedLight
+ parameters.evaluatedLight,
+ evaluated.get<FillExtrusionVerticalGradient>()
),
{},
{},
@@ -188,7 +189,8 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters) {
evaluated.get<FillExtrusionOpacity>(),
-std::pow(2, tile.id.canonical.z) / util::tileSize / 8.0f,
parameters.pixelRatio,
- parameters.evaluatedLight
+ parameters.evaluatedLight,
+ evaluated.get<FillExtrusionVerticalGradient>()
),
patternPosA,
patternPosB,