diff options
Diffstat (limited to 'src/mbgl/programs/gl/line_sdf.cpp')
-rw-r--r-- | src/mbgl/programs/gl/line_sdf.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp index 2d0a5faacd..493cc76d01 100644 --- a/src/mbgl/programs/gl/line_sdf.cpp +++ b/src/mbgl/programs/gl/line_sdf.cpp @@ -15,9 +15,9 @@ struct ShaderSource; template <> struct ShaderSource<LineSDFProgram> { static constexpr const char* name = "line_sdf"; - static constexpr const uint8_t hash[8] = { 0x21, 0x0f, 0x62, 0x9d, 0x31, 0x97, 0xad, 0x16 }; - static constexpr const auto vertexOffset = 43478; - static constexpr const auto fragmentOffset = 47126; + static constexpr const uint8_t hash[8] = { 0x25, 0x94, 0x7f, 0xad, 0x84, 0xfe, 0x96, 0xad }; + static constexpr const auto vertexOffset = 43595; + static constexpr const auto fragmentOffset = 47282; }; constexpr const char* ShaderSource<LineSDFProgram>::name; @@ -51,7 +51,7 @@ Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programPara // long distances for long segments. Use this value to unscale the distance. #define LINE_DISTANCE_SCALE 2.0 -attribute vec4 a_pos_normal; +attribute vec2 a_pos_normal; attribute vec4 a_data; uniform mat4 u_matrix; @@ -190,11 +190,13 @@ void main() { float a_direction = mod(a_data.z, 4.0) - 1.0; float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE; - vec2 pos = a_pos_normal.xy; + vec2 pos = floor(a_pos_normal * 0.5); // x is 1 if it's a round cap, 0 otherwise // y is 1 if the normal points up, and -1 if it points down - mediump vec2 normal = a_pos_normal.zw; + // We store these in the least significant bit of a_pos_normal + mediump vec2 normal = a_pos_normal - 2.0 * pos; + normal.y = normal.y * 2.0 - 1.0; v_normal = normal; // these transformations used to be applied in the JS and native code bases. |