[core] Port "combine line-width and line-gap-width in shader"
a9559e911bfcb9bcebae
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.3.5",
|
||||
"express": "^4.11.1",
|
||||
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#d3cdb7f427c7f36ad234b45732b9c77c73440dad",
|
||||
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#4a567b438be303fbbf13e5ddf49d72d8debd811d",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#b3441d9a285ffbe9b876677acb13d7df07e5b975",
|
||||
"node-gyp": "^3.3.1",
|
||||
"request": "^2.72.0",
|
||||
|
||||
@@ -33,20 +33,6 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
bool wireframe = frame.debugOptions & MapDebugOptions::Wireframe;
|
||||
|
||||
float blur = properties.lineBlur + antialiasing;
|
||||
float edgeWidth = wireframe ? 1 : properties.lineWidth / 2.0;
|
||||
float inset = -1;
|
||||
float offset = 0;
|
||||
float shift = 0;
|
||||
|
||||
if (properties.lineGapWidth != 0 && !wireframe) {
|
||||
inset = properties.lineGapWidth / 2.0 + antialiasing * 0.5;
|
||||
edgeWidth = properties.lineWidth;
|
||||
|
||||
// shift outer lines half a pixel towards the middle to eliminate the crack
|
||||
offset = inset - antialiasing / 2.0;
|
||||
}
|
||||
|
||||
float outset = offset + edgeWidth + antialiasing / 2.0 + shift;
|
||||
|
||||
Color color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
|
||||
float opacity = 1.0f;
|
||||
@@ -78,8 +64,9 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
config.program = linesdfShader->getID();
|
||||
|
||||
linesdfShader->u_matrix = vtxMatrix;
|
||||
linesdfShader->u_exmatrix = extrudeMatrix;
|
||||
linesdfShader->u_linewidth = {{ outset, inset }};
|
||||
linesdfShader->u_linewidth = properties.lineWidth / 2;
|
||||
linesdfShader->u_gapwidth = properties.lineGapWidth / 2;
|
||||
linesdfShader->u_antialiasing = antialiasing / 2;
|
||||
linesdfShader->u_ratio = ratio;
|
||||
linesdfShader->u_blur = blur;
|
||||
linesdfShader->u_color = color;
|
||||
@@ -122,8 +109,9 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
config.program = linepatternShader->getID();
|
||||
|
||||
linepatternShader->u_matrix = vtxMatrix;
|
||||
linepatternShader->u_exmatrix = extrudeMatrix;
|
||||
linepatternShader->u_linewidth = {{ outset, inset }};
|
||||
linepatternShader->u_linewidth = properties.lineWidth / 2;
|
||||
linepatternShader->u_gapwidth = properties.lineGapWidth / 2;
|
||||
linepatternShader->u_antialiasing = antialiasing / 2;
|
||||
linepatternShader->u_ratio = ratio;
|
||||
linepatternShader->u_blur = blur;
|
||||
|
||||
@@ -157,8 +145,9 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
config.program = lineShader->getID();
|
||||
|
||||
lineShader->u_matrix = vtxMatrix;
|
||||
lineShader->u_exmatrix = extrudeMatrix;
|
||||
lineShader->u_linewidth = {{ outset, inset }};
|
||||
lineShader->u_linewidth = properties.lineWidth / 2;
|
||||
lineShader->u_gapwidth = properties.lineGapWidth / 2;
|
||||
lineShader->u_antialiasing = antialiasing / 2;
|
||||
lineShader->u_ratio = ratio;
|
||||
lineShader->u_blur = blur;
|
||||
lineShader->u_extra = extra;
|
||||
|
||||
@@ -12,11 +12,12 @@ public:
|
||||
void bind(GLbyte *offset) final;
|
||||
|
||||
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_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_gapwidth = {"u_gapwidth", *this};
|
||||
Uniform<GLfloat> u_antialiasing = {"u_antialiasing", *this};
|
||||
Uniform<GLfloat> u_blur = {"u_blur", *this};
|
||||
Uniform<GLfloat> u_extra = {"u_extra", *this};
|
||||
Uniform<GLfloat> u_offset = {"u_offset", *this};
|
||||
|
||||
@@ -12,8 +12,9 @@ public:
|
||||
void bind(GLbyte *offset) final;
|
||||
|
||||
UniformMatrix<4> u_matrix = {"u_matrix", *this};
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_gapwidth = {"u_gapwidth", *this};
|
||||
Uniform<GLfloat> u_antialiasing = {"u_antialiasing", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_pattern_size_a = {"u_pattern_size_a", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_pattern_tl_a = {"u_pattern_tl_a", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_pattern_br_a = {"u_pattern_br_a", *this};
|
||||
|
||||
@@ -12,10 +12,11 @@ public:
|
||||
void bind(GLbyte *offset) final;
|
||||
|
||||
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_linewidth = {"u_linewidth", *this};
|
||||
Uniform<GLfloat> u_gapwidth = {"u_gapwidth", *this};
|
||||
Uniform<GLfloat> u_antialiasing = {"u_antialiasing", *this};
|
||||
Uniform<GLfloat> u_ratio = {"u_ratio", *this};
|
||||
Uniform<GLfloat> u_blur = {"u_blur", *this};
|
||||
Uniform<std::array<GLfloat, 2>> u_patternscale_a = { "u_patternscale_a", *this};
|
||||
|
||||
Reference in New Issue
Block a user