[core] Update shaders.

Implements 'icon-pitch-alignment' (issue #9345)
Fixes issue #9456 (map-aligned point label regression)
This commit is contained in:
Chris Loer
2017-07-11 11:22:39 -07:00
committed by Chris Loer
parent af10e2d3be
commit e8657becc5
23 changed files with 458 additions and 118 deletions

View File

@@ -52,6 +52,11 @@ Values makeValues(const bool isText,
const float pixelsToTileUnits = tile.id.pixelsToTileUnits(1.0, state.getZoom());
const bool pitchWithMap = values.pitchAlignment == style::AlignmentType::Map;
const bool rotateWithMap = values.rotationAlignment == style::AlignmentType::Map;
// Line label rotation happens in `updateLineLabels`
// Pitched point labels are automatically rotated by the labelPlaneMatrix projection
// Unpitched point labels need to have their rotation applied after projection
const bool rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;
mat4 labelPlaneMatrix;
if (alongLine) {
@@ -84,6 +89,8 @@ Values makeValues(const bool isText,
uniforms::u_pitch::Value{ state.getPitch() },
uniforms::u_pitch_with_map::Value{ pitchWithMap },
uniforms::u_max_camera_distance::Value{ values.maxCameraDistance },
uniforms::u_rotate_symbol::Value{ rotateInShader },
uniforms::u_aspect_ratio::Value{ state.getSize().aspectRatio() },
std::forward<Args>(args)...
};
}

View File

@@ -41,6 +41,8 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_size_feature_constant);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_size_t);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_size);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_max_camera_distance);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_rotate_symbol);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_aspect_ratio);
} // namespace uniforms
struct SymbolLayoutAttributes : gl::Attributes<
@@ -348,7 +350,9 @@ class SymbolIconProgram : public SymbolProgram<
uniforms::u_camera_to_center_distance,
uniforms::u_pitch,
uniforms::u_pitch_with_map,
uniforms::u_max_camera_distance>,
uniforms::u_max_camera_distance,
uniforms::u_rotate_symbol,
uniforms::u_aspect_ratio>,
style::IconPaintProperties>
{
public:
@@ -387,6 +391,8 @@ class SymbolSDFProgram : public SymbolProgram<
uniforms::u_pitch,
uniforms::u_pitch_with_map,
uniforms::u_max_camera_distance,
uniforms::u_rotate_symbol,
uniforms::u_aspect_ratio,
uniforms::u_gamma_scale,
uniforms::u_is_halo>,
PaintProperties>
@@ -409,6 +415,8 @@ public:
uniforms::u_pitch,
uniforms::u_pitch_with_map,
uniforms::u_max_camera_distance,
uniforms::u_rotate_symbol,
uniforms::u_aspect_ratio,
uniforms::u_gamma_scale,
uniforms::u_is_halo>,
PaintProperties>;