[core] Introduce variable text placement for point labels - Render part

This commit is contained in:
Alexander Shalamov
2019-03-13 23:17:14 +02:00
committed by Mikhail Pozdnyakov
parent dbbfc4a494
commit cb64dbe0d6
5 changed files with 103 additions and 6 deletions

View File

@@ -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);
@@ -106,6 +107,7 @@ Values makeValues(const bool isText,
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,