summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/symbol_program.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/programs/symbol_program.cpp')
-rw-r--r--src/mbgl/programs/symbol_program.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp
index 2300dedff3..d6a7a10368 100644
--- a/src/mbgl/programs/symbol_program.cpp
+++ b/src/mbgl/programs/symbol_program.cpp
@@ -42,6 +42,7 @@ std::unique_ptr<SymbolSizeBinder> SymbolSizeBinder::create(const float tileZoom,
template <class Values, class...Args>
Values makeValues(const bool isText,
+ const bool hasVariablePacement,
const style::SymbolPropertyValues& values,
const Size& texsize,
const std::array<float, 2>& pixelsToGLUnits,
@@ -71,7 +72,7 @@ Values makeValues(const bool isText,
const bool rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;
mat4 labelPlaneMatrix;
- if (alongLine) {
+ if (alongLine || (isText && hasVariablePacement)) {
// For labels that follow lines the first part of the projection is handled on the cpu.
// Pass an identity matrix because no transformation needs to be done in the vertex shader.
matrix::identity(labelPlaneMatrix);
@@ -82,30 +83,31 @@ Values makeValues(const bool isText,
mat4 glCoordMatrix = getGlCoordMatrix(tile.matrix, pitchWithMap, rotateWithMap, state, pixelsToTileUnits);
return Values {
- uniforms::u_matrix::Value( tile.translatedMatrix(values.translate,
+ uniforms::matrix::Value( tile.translatedMatrix(values.translate,
values.translateAnchor,
state) ),
- uniforms::u_label_plane_matrix::Value(labelPlaneMatrix),
- uniforms::u_gl_coord_matrix::Value( tile.translateVtxMatrix(glCoordMatrix,
+ uniforms::label_plane_matrix::Value(labelPlaneMatrix),
+ uniforms::gl_coord_matrix::Value( tile.translateVtxMatrix(glCoordMatrix,
values.translate,
values.translateAnchor,
state,
true) ),
- uniforms::u_extrude_scale::Value( extrudeScale ),
- uniforms::u_texsize::Value( texsize ),
- uniforms::u_fade_change::Value( symbolFadeChange ),
- uniforms::u_is_text::Value( isText ),
- uniforms::u_camera_to_center_distance::Value( state.getCameraToCenterDistance() ),
- uniforms::u_pitch::Value( state.getPitch() ),
- uniforms::u_pitch_with_map::Value( pitchWithMap ),
- uniforms::u_rotate_symbol::Value( rotateInShader ),
- uniforms::u_aspect_ratio::Value( state.getSize().aspectRatio() ),
+ uniforms::extrude_scale::Value( extrudeScale ),
+ uniforms::texsize::Value( texsize ),
+ uniforms::fade_change::Value( symbolFadeChange ),
+ uniforms::is_text::Value( isText ),
+ uniforms::camera_to_center_distance::Value( state.getCameraToCenterDistance() ),
+ uniforms::pitch::Value( state.getPitch() ),
+ uniforms::pitch_with_map::Value( pitchWithMap ),
+ uniforms::rotate_symbol::Value( rotateInShader ),
+ uniforms::aspect_ratio::Value( state.getSize().aspectRatio() ),
std::forward<Args>(args)...
};
}
SymbolIconProgram::LayoutUniformValues
SymbolIconProgram::layoutUniformValues(const bool isText,
+ const bool hasVariablePacement,
const style::SymbolPropertyValues& values,
const Size& texsize,
const std::array<float, 2>& pixelsToGLUnits,
@@ -115,6 +117,7 @@ SymbolIconProgram::layoutUniformValues(const bool isText,
const float symbolFadeChange) {
return makeValues<SymbolIconProgram::LayoutUniformValues>(
isText,
+ hasVariablePacement,
values,
texsize,
pixelsToGLUnits,
@@ -128,6 +131,7 @@ SymbolIconProgram::layoutUniformValues(const bool isText,
template <class Name, class PaintProperties>
typename SymbolSDFProgram<Name, PaintProperties>::LayoutUniformValues
SymbolSDFProgram<Name, PaintProperties>::layoutUniformValues(const bool isText,
+ const bool hasVariablePacement,
const style::SymbolPropertyValues& values,
const Size& texsize,
const std::array<float, 2>& pixelsToGLUnits,
@@ -142,6 +146,7 @@ SymbolSDFProgram<Name, PaintProperties>::layoutUniformValues(const bool isText,
return makeValues<SymbolSDFProgram<Name, PaintProperties>::LayoutUniformValues>(
isText,
+ hasVariablePacement,
values,
texsize,
pixelsToGLUnits,
@@ -149,8 +154,8 @@ SymbolSDFProgram<Name, PaintProperties>::layoutUniformValues(const bool isText,
tile,
state,
symbolFadeChange,
- uniforms::u_gamma_scale::Value( gammaScale ),
- uniforms::u_is_halo::Value( part == SymbolSDFPart::Halo )
+ uniforms::gamma_scale::Value( gammaScale ),
+ uniforms::is_halo::Value( part == SymbolSDFPart::Halo )
);
}