#pragma once #include #include #include namespace mbgl { namespace attributes { /* * Pack a pair of values, interpreted as uint8's, into a single float. * Used to conserve vertex attributes. Values are unpacked in the vertex * shader using the `unpack_float()` function, defined in _prelude.vertex.glsl. */ template inline uint16_t packUint8Pair(T a, T b) { return static_cast(a) * 256 + static_cast(b); } // Layout attributes MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_pos); MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_extrude); MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_pos_offset); MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, a_texture_pos); MBGL_DEFINE_ATTRIBUTE(int16_t, 3, a_normal); MBGL_DEFINE_ATTRIBUTE(uint16_t, 1, a_edgedistance); template struct a_data { static auto name() { return "a_data"; } using Type = gl::Attribute; }; struct a_size { static auto name() { return "a_size"; } using Type = gl::Attribute; }; template struct a_offset { static auto name() { return "a_offset"; } using Type = gl::Attribute; }; // Paint attributes struct a_color { static auto name() { return "a_color"; } using Type = gl::Attribute; }; struct a_fill_color { static auto name() { return "a_fill_color"; } using Type = gl::Attribute; }; struct a_halo_color { static auto name() { return "a_halo_color"; } using Type = gl::Attribute; }; struct a_stroke_color { static auto name() { return "a_stroke_color"; } using Type = gl::Attribute; }; struct a_outline_color { static auto name() { return "a_outline_color"; } using Type = gl::Attribute; }; struct a_opacity { static auto name() { return "a_opacity"; } using Type = gl::Attribute; }; struct a_stroke_opacity { static auto name() { return "a_stroke_opacity"; } using Type = gl::Attribute; }; struct a_blur { static auto name() { return "a_blur"; } using Type = gl::Attribute; }; struct a_radius { static auto name() { return "a_radius"; } using Type = gl::Attribute; }; struct a_width { static auto name() { return "a_width"; } using Type = gl::Attribute; }; struct a_height { static auto name() { return "a_height"; } using Type = gl::Attribute; }; struct a_base { static auto name() { return "a_base"; } using Type = gl::Attribute; }; struct a_gap_width { static auto name() { return "a_gapwidth"; } using Type = gl::Attribute; }; struct a_stroke_width { static auto name() { return "a_stroke_width"; } using Type = gl::Attribute; }; template <> struct a_offset<1> { static auto name() { return "a_offset"; } using Type = gl::Attribute; }; struct a_halo_width { static auto name() { return "a_halo_width"; } using Type = gl::Attribute; }; struct a_halo_blur { static auto name() { return "a_halo_blur"; } using Type = gl::Attribute; }; } // namespace attributes } // namespace mbgl