diff options
Diffstat (limited to 'src/mbgl/programs/gl/line_pattern.cpp')
-rw-r--r-- | src/mbgl/programs/gl/line_pattern.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp index 17ec324c11..96da8a4f2a 100644 --- a/src/mbgl/programs/gl/line_pattern.cpp +++ b/src/mbgl/programs/gl/line_pattern.cpp @@ -15,9 +15,9 @@ struct ShaderSource; template <> struct ShaderSource<LinePatternProgram> { static constexpr const char* name = "line_pattern"; - static constexpr const uint8_t hash[8] = { 0x14, 0x72, 0xee, 0xac, 0x1f, 0xc7, 0xf6, 0x82 }; - static constexpr const auto vertexOffset = 37768; - static constexpr const auto fragmentOffset = 41123; + static constexpr const uint8_t hash[8] = { 0x38, 0x9c, 0x3d, 0xde, 0xb4, 0xe0, 0xd1, 0x61 }; + static constexpr const auto vertexOffset = 37846; + static constexpr const auto fragmentOffset = 41240; }; constexpr const char* ShaderSource<LinePatternProgram>::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; @@ -184,11 +184,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; // float tileRatio = u_scale.y; - 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. |