#pragma once #include #include #include #include namespace mbgl { class SymbolVertex { public: SymbolVertex(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle) : a_pos { x, y }, a_offset { static_cast(::round(ox * 64)), // use 1/64 pixels for placement static_cast(::round(oy * 64)) }, a_texture_pos { static_cast(tx / 4), static_cast(ty / 4) }, a_data { static_cast(labelminzoom * 10), // 1/10 zoom levels: z16 == 160 static_cast(labelangle), static_cast(minzoom * 10), static_cast(::fmin(maxzoom, 25) * 10) } {} const int16_t a_pos[2]; const int16_t a_offset[2]; const uint16_t a_texture_pos[2]; const uint8_t a_data[4]; }; namespace gl { template struct AttributeBindings { std::array operator()(const Shader& shader) { return {{ MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_pos), MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_offset), MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_texture_pos), MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_data) }}; }; }; } // namespace gl } // namespace mbgl