diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-08-10 11:47:31 -0700 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-08-18 11:43:24 +0200 |
commit | 1188707dc3ca6d88349d4bf323d03e3e93c0e548 (patch) | |
tree | 66e7b49b70caf5685d6d6dca6a2eee377e010452 /src/mbgl/programs/line_program.hpp | |
parent | c7d7319c77dd138cac487eda2232f9bc3bc7d0b6 (diff) | |
download | qtlocation-mapboxgl-1188707dc3ca6d88349d4bf323d03e3e93c0e548.tar.gz |
[core] Use separate attribute component for line normals
Selective cherry pick of 822df3dd514ec3d05f876e6746cb8ba6348ac89d
Diffstat (limited to 'src/mbgl/programs/line_program.hpp')
-rw-r--r-- | src/mbgl/programs/line_program.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp index b2e55a4f3b..0a56ae5dad 100644 --- a/src/mbgl/programs/line_program.hpp +++ b/src/mbgl/programs/line_program.hpp @@ -31,7 +31,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_gl_units_to_pixels); } // namespace uniforms struct LineLayoutAttributes : gl::Attributes< - attributes::a_pos, + attributes::a_pos_normal, attributes::a_data<uint8_t, 4>> {}; @@ -52,14 +52,16 @@ public: /* * @param p vertex position * @param e extrude normal - * @param t texture normal + * @param round whether the vertex uses a round line cap + * @param up whether the line normal points up or down * @param dir direction of the line cap (-1/0/1) */ - static LayoutVertex layoutVertex(Point<int16_t> p, Point<double> e, Point<bool> t, int8_t dir, int32_t linesofar = 0) { + static LayoutVertex layoutVertex(Point<int16_t> p, Point<double> e, bool round, bool up, int8_t dir, int32_t linesofar = 0) { return LayoutVertex { {{ - static_cast<int16_t>((p.x * 2) | t.x), - static_cast<int16_t>((p.y * 2) | t.y) + p.x, + p.y, + static_cast<int16_t>(attributes::packUint8Pair(round ? 1 : 0, up ? 1 : 0)) }}, {{ // add 128 to store a byte in an unsigned byte |