From 888a516f1fec172081c06f4d2a98c08ae13a4d93 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 24 Jul 2018 15:40:33 -0700 Subject: [core] Compress shader source code --- scripts/generate-shaders.js | 42 +- src/mbgl/shaders/background.cpp | 68 ++-- src/mbgl/shaders/background_pattern.cpp | 135 +++--- src/mbgl/shaders/circle.cpp | 497 ++++++++++------------ src/mbgl/shaders/clipping_mask.cpp | 51 ++- src/mbgl/shaders/collision_box.cpp | 141 ++++--- src/mbgl/shaders/collision_circle.cpp | 205 ++++++---- src/mbgl/shaders/debug.cpp | 55 ++- src/mbgl/shaders/extrusion_texture.cpp | 83 ++-- src/mbgl/shaders/fill.cpp | 157 ++++--- src/mbgl/shaders/fill_extrusion.cpp | 321 ++++++++------- src/mbgl/shaders/fill_extrusion_pattern.cpp | 305 +++++++------- src/mbgl/shaders/fill_outline.cpp | 181 +++++---- src/mbgl/shaders/fill_outline_pattern.cpp | 213 +++++----- src/mbgl/shaders/fill_pattern.cpp | 185 +++++---- src/mbgl/shaders/heatmap.cpp | 313 ++++++++------ src/mbgl/shaders/heatmap_texture.cpp | 91 +++-- src/mbgl/shaders/hillshade.cpp | 251 ++++++++---- src/mbgl/shaders/hillshade_prepare.cpp | 249 ++++++++---- src/mbgl/shaders/line.cpp | 494 +++++++++++----------- src/mbgl/shaders/line_pattern.cpp | 544 ++++++++++++++----------- src/mbgl/shaders/line_sdf.cpp | 604 ++++++++++++++------------- src/mbgl/shaders/preludes.cpp | 244 ++++++----- src/mbgl/shaders/raster.cpp | 211 ++++++---- src/mbgl/shaders/symbol_icon.cpp | 321 ++++++++------- src/mbgl/shaders/symbol_sdf.cpp | 610 +++++++++++++++------------- 26 files changed, 3705 insertions(+), 2866 deletions(-) diff --git a/scripts/generate-shaders.js b/scripts/generate-shaders.js index 6758793056..39307f358a 100755 --- a/scripts/generate-shaders.js +++ b/scripts/generate-shaders.js @@ -4,6 +4,7 @@ require('flow-remove-types/register'); const path = require('path'); const outputPath = 'src/mbgl/shaders'; +const zlib = require('zlib'); var shaders = require('../mapbox-gl-js/src/shaders'); @@ -11,6 +12,25 @@ delete shaders.lineGradient; require('./style-code'); +function compressedData(src) { + return zlib.deflateSync(src, {level: zlib.Z_BEST_COMPRESSION}) + .toString('hex') + .match(/.{1,16}/g) + .map(line => line.match(/.{1,2}/g).map(n => `0x${n}`).join(', ')) + .join(',\n ') + .trim(); +} + +function compressedConstant(data) { + return `[] () { + static const uint8_t compressed[] = { + ${compressedData(data)} + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}()` +} + writeIfModified(path.join(outputPath, 'preludes.hpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #pragma once @@ -28,16 +48,15 @@ extern const char* fragmentPrelude; writeIfModified(path.join(outputPath, 'preludes.cpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { -const char* vertexPrelude = R"MBGL_SHADER( -${shaders.prelude.vertexSource} -)MBGL_SHADER"; -const char* fragmentPrelude = R"MBGL_SHADER( -${shaders.prelude.fragmentSource} -)MBGL_SHADER"; +const char* vertexPrelude = ${compressedConstant(shaders.prelude.vertexSource)}; +const char* fragmentPrelude = ${compressedConstant(shaders.prelude.fragmentSource)}; } // namespace shaders } // namespace mbgl @@ -70,17 +89,16 @@ public: writeIfModified(path.join(outputPath, `${shaderName}.cpp`), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* ${shaderName}::name = "${shaderName}"; -const char* ${shaderName}::vertexSource = R"MBGL_SHADER( -${shaders[key].vertexSource} -)MBGL_SHADER"; -const char* ${shaderName}::fragmentSource = R"MBGL_SHADER( -${shaders[key].fragmentSource} -)MBGL_SHADER"; +const char* ${shaderName}::vertexSource = ${compressedConstant(shaders[key].vertexSource)}; +const char* ${shaderName}::fragmentSource = ${compressedConstant(shaders[key].fragmentSource)}; } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/background.cpp b/src/mbgl/shaders/background.cpp index 3eafa47b49..e9eb315939 100644 --- a/src/mbgl/shaders/background.cpp +++ b/src/mbgl/shaders/background.cpp @@ -1,34 +1,56 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* background::name = "background"; -const char* background::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; - -uniform mat4 u_matrix; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); -} - -)MBGL_SHADER"; -const char* background::fragmentSource = R"MBGL_SHADER( -uniform vec4 u_color; -uniform float u_opacity; - -void main() { - gl_FragColor = u_color * u_opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* background::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x4b, 0x2c, 0x29, 0x29, 0xca, 0x4c, + 0x2a, 0x2d, 0x49, 0x55, 0x28, 0x4b, 0x4d, 0x36, + 0x52, 0x48, 0x8c, 0x2f, 0xc8, 0x2f, 0xb6, 0xe6, + 0xe2, 0x2a, 0xcd, 0xcb, 0x4c, 0xcb, 0x2f, 0xca, + 0x55, 0xc8, 0x4d, 0x2c, 0x31, 0x51, 0x28, 0x8d, + 0x07, 0x52, 0x45, 0x99, 0x15, 0x40, 0xf1, 0xb2, + 0xfc, 0xcc, 0x14, 0xa0, 0x60, 0x66, 0x9e, 0x86, + 0xa6, 0x42, 0x35, 0x97, 0x02, 0x10, 0xa4, 0xe7, + 0xc4, 0x07, 0xe4, 0x17, 0x67, 0x96, 0x64, 0xe6, + 0xe7, 0x29, 0xd8, 0xc2, 0x95, 0x2a, 0x68, 0x81, + 0xcc, 0x33, 0xd1, 0x00, 0x9b, 0xa7, 0xa3, 0x60, + 0xa0, 0xa3, 0x60, 0xa8, 0x69, 0xcd, 0x55, 0xcb, + 0x05, 0x00, 0x45, 0x7b, 0x23, 0xb2 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* background::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0x2f, + 0xca, 0x55, 0x28, 0x4b, 0x4d, 0x36, 0x51, 0x28, + 0x8d, 0x4f, 0xce, 0xcf, 0xc9, 0x2f, 0xb2, 0xe6, + 0x2a, 0x85, 0x8a, 0xa6, 0xe5, 0xe4, 0x27, 0x96, + 0x00, 0x85, 0xf3, 0x0b, 0x12, 0x93, 0x33, 0x4b, + 0x2a, 0xad, 0xb9, 0xb8, 0xca, 0xf2, 0x33, 0x53, + 0x14, 0x72, 0x13, 0x33, 0xf3, 0x34, 0x34, 0x15, + 0xaa, 0xb9, 0x14, 0x80, 0x20, 0x3d, 0x27, 0xde, + 0xad, 0x28, 0x31, 0xdd, 0x19, 0xa4, 0x53, 0xc1, + 0x16, 0x66, 0x86, 0x82, 0x16, 0x8a, 0x36, 0xe5, + 0xcc, 0xb4, 0x94, 0xd4, 0x34, 0x05, 0xff, 0x30, + 0xd7, 0x20, 0x97, 0x20, 0xc7, 0xf0, 0x78, 0x4f, + 0xbf, 0xe0, 0x00, 0x57, 0xe7, 0x10, 0xff, 0x20, + 0x6c, 0x46, 0x80, 0xdc, 0xa2, 0x61, 0xa8, 0x67, + 0xa0, 0x69, 0xcd, 0xa5, 0x9c, 0x9a, 0x97, 0x92, + 0x99, 0xc6, 0x55, 0xcb, 0x05, 0x00, 0xbb, 0x66, + 0x35, 0xbb + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/background_pattern.cpp b/src/mbgl/shaders/background_pattern.cpp index 6fd0a53d19..83f4307bea 100644 --- a/src/mbgl/shaders/background_pattern.cpp +++ b/src/mbgl/shaders/background_pattern.cpp @@ -1,65 +1,92 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* background_pattern::name = "background_pattern"; -const char* background_pattern::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_pattern_size_a; -uniform vec2 u_pattern_size_b; -uniform vec2 u_pixel_coord_upper; -uniform vec2 u_pixel_coord_lower; -uniform float u_scale_a; -uniform float u_scale_b; -uniform float u_tile_units_to_pixels; - -attribute vec2 a_pos; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); - - v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos); - v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos); -} - -)MBGL_SHADER"; -const char* background_pattern::fragmentSource = R"MBGL_SHADER( -uniform vec2 u_pattern_tl_a; -uniform vec2 u_pattern_br_a; -uniform vec2 u_pattern_tl_b; -uniform vec2 u_pattern_br_b; -uniform vec2 u_texsize; -uniform float u_mix; -uniform float u_opacity; - -uniform sampler2D u_image; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; - -void main() { - vec2 imagecoord = mod(v_pos_a, 1.0); - vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord); - vec4 color1 = texture2D(u_image, pos); - - vec2 imagecoord_b = mod(v_pos_b, 1.0); - vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b); - vec4 color2 = texture2D(u_image, pos2); - - gl_FragColor = mix(color1, color2, u_mix) * u_opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* background_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x91, 0x4d, 0x6e, 0xc3, 0x20, + 0x10, 0x85, 0xf7, 0x9c, 0x82, 0xa5, 0x5d, 0xb1, + 0x48, 0xa2, 0xec, 0xa2, 0xde, 0x21, 0x37, 0x40, + 0xe0, 0x60, 0x6b, 0x24, 0xc2, 0x58, 0x30, 0x38, + 0x7f, 0xca, 0xdd, 0x33, 0xd4, 0x51, 0xd2, 0xd4, + 0x6e, 0xba, 0x29, 0x1b, 0xa4, 0x6f, 0xde, 0xe8, + 0x3d, 0x1e, 0x39, 0x40, 0x8b, 0x71, 0x2f, 0xf7, + 0x86, 0xd6, 0x32, 0x6b, 0xbe, 0x22, 0x1c, 0x37, + 0x22, 0xdf, 0xf1, 0xe0, 0x9a, 0x15, 0xe3, 0xde, + 0x10, 0xb9, 0x18, 0x74, 0x82, 0xb3, 0xd3, 0xe6, + 0xfd, 0xd8, 0x4e, 0xc7, 0x70, 0x74, 0x5e, 0x37, + 0x88, 0x71, 0xa7, 0x73, 0xdf, 0xbb, 0xf8, 0x56, + 0xe1, 0xf1, 0xf0, 0x5d, 0xd1, 0x7a, 0x34, 0xc4, + 0x92, 0xd4, 0x18, 0xff, 0xe2, 0xfd, 0x3a, 0xb0, + 0xd3, 0x01, 0x01, 0x73, 0x86, 0x94, 0x34, 0xe1, + 0x68, 0x91, 0x36, 0x42, 0x70, 0xd6, 0x08, 0x36, + 0x93, 0x1b, 0xcd, 0x8d, 0xee, 0xb1, 0xe0, 0xc1, + 0xc4, 0x13, 0x84, 0x6e, 0x84, 0x43, 0x81, 0xc5, + 0x6c, 0x86, 0xda, 0x22, 0x46, 0xd8, 0x71, 0x65, + 0x10, 0xaa, 0x5a, 0x5e, 0x84, 0xe4, 0xd3, 0x79, + 0xbd, 0xc5, 0x04, 0x04, 0x18, 0xe4, 0xe7, 0xa3, + 0x48, 0xf9, 0x51, 0x36, 0xd7, 0xd5, 0x97, 0x89, + 0x92, 0x0b, 0x25, 0x97, 0x35, 0xaf, 0x97, 0x85, + 0xbb, 0x05, 0x8b, 0x3b, 0x47, 0x8f, 0x06, 0x99, + 0x55, 0x33, 0x85, 0xa9, 0xb9, 0x8e, 0xd4, 0xb3, + 0x15, 0xf6, 0xf9, 0xf9, 0x49, 0xea, 0x97, 0x06, + 0xd4, 0xf8, 0x62, 0x8e, 0xf1, 0x4c, 0x61, 0xff, + 0x25, 0x85, 0x9d, 0xa6, 0xb0, 0x7f, 0xa7, 0xb8, + 0x8a, 0x1b, 0x2c, 0x40, 0xe9, 0xd0 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* background_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x91, 0x41, 0x4f, 0x84, 0x30, + 0x10, 0x85, 0xef, 0xfd, 0x15, 0x93, 0xec, 0x05, + 0x0c, 0x51, 0xb7, 0xf1, 0x46, 0x3c, 0x98, 0x65, + 0x4d, 0xbc, 0xb8, 0x06, 0x8d, 0x1e, 0x9b, 0x16, + 0x0a, 0x69, 0x42, 0x29, 0x29, 0x65, 0xc3, 0x6a, + 0xfc, 0xef, 0xb6, 0x0b, 0x4a, 0x90, 0x2e, 0x3d, + 0xce, 0x7b, 0x7d, 0xf3, 0xcd, 0x4c, 0x57, 0x8b, + 0x42, 0x69, 0x09, 0x47, 0x9e, 0x61, 0xe8, 0x48, + 0x43, 0x8d, 0xe1, 0xba, 0x26, 0xa6, 0x22, 0x34, + 0x46, 0x9d, 0x5f, 0x64, 0x7a, 0x45, 0xb4, 0x3f, + 0xd9, 0xda, 0xcf, 0xa5, 0x68, 0x78, 0xdf, 0x8a, + 0x4f, 0x3e, 0xd5, 0x8b, 0x4a, 0x51, 0x63, 0x05, + 0x29, 0xfa, 0x65, 0x51, 0x35, 0x34, 0x13, 0xe6, + 0x14, 0xa3, 0x3f, 0xa5, 0xa5, 0xb2, 0xa9, 0xb8, + 0xc6, 0x89, 0x55, 0x85, 0xa4, 0xa5, 0x4d, 0x42, + 0x47, 0xaa, 0x4f, 0xa2, 0x2e, 0x87, 0x16, 0x47, + 0xd2, 0xa8, 0xd6, 0x21, 0x7b, 0xaa, 0xcc, 0x99, + 0x95, 0xc8, 0x41, 0x52, 0x51, 0x07, 0x21, 0x7c, + 0x21, 0xb0, 0xef, 0x6c, 0x38, 0x67, 0x65, 0x4a, + 0xe9, 0x1c, 0xee, 0x41, 0xaa, 0x3c, 0x18, 0x73, + 0x22, 0xd8, 0x5e, 0xdf, 0x86, 0xf1, 0x64, 0xb4, + 0x55, 0xe7, 0x10, 0x7d, 0x30, 0x5f, 0x20, 0xdc, + 0x4c, 0xd3, 0x45, 0xff, 0xf6, 0x37, 0xd7, 0xa6, + 0x56, 0x53, 0xee, 0x1d, 0x64, 0xaa, 0x52, 0x7a, + 0x6b, 0xa3, 0xad, 0xcf, 0x74, 0x9a, 0xe3, 0x24, + 0x18, 0x27, 0x8c, 0x5c, 0x4f, 0x6b, 0xf5, 0xc1, + 0x12, 0x36, 0xc3, 0x65, 0x3e, 0x5c, 0xec, 0xe3, + 0x65, 0x2b, 0xbc, 0xec, 0x12, 0x2f, 0x61, 0x0b, + 0x62, 0x7c, 0x91, 0x18, 0xff, 0x22, 0x97, 0x15, + 0x79, 0xd4, 0xb4, 0xdc, 0x39, 0xfb, 0x88, 0x32, + 0x0c, 0x1b, 0x8d, 0x11, 0xd1, 0x70, 0xfe, 0x10, + 0xae, 0x66, 0x27, 0xdf, 0x88, 0x22, 0xe7, 0x05, + 0x1c, 0xde, 0xf7, 0x69, 0x92, 0x3e, 0x7c, 0x90, + 0xa7, 0xe7, 0xd7, 0x97, 0xfd, 0xee, 0xed, 0x90, + 0xfa, 0x52, 0x1d, 0x51, 0x30, 0xcc, 0xbe, 0xe1, + 0x75, 0x2e, 0x0a, 0xf4, 0x8d, 0x7e, 0x00, 0x79, + 0xe0, 0xfb, 0xaf + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/circle.cpp b/src/mbgl/shaders/circle.cpp index c14335914b..ded6979634 100644 --- a/src/mbgl/shaders/circle.cpp +++ b/src/mbgl/shaders/circle.cpp @@ -1,287 +1,232 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* circle::name = "circle"; -const char* circle::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform bool u_scale_with_map; -uniform bool u_pitch_with_map; -uniform vec2 u_extrude_scale; -uniform highp float u_camera_to_center_distance; - -attribute vec2 a_pos; - - -#ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; -attribute highp vec4 a_color; -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_radius -uniform lowp float a_radius_t; -attribute mediump vec2 a_radius; -varying mediump float radius; -#else -uniform mediump float u_radius; -#endif - - -#ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; -attribute lowp vec2 a_blur; -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_color -uniform lowp float a_stroke_color_t; -attribute highp vec4 a_stroke_color; -varying highp vec4 stroke_color; -#else -uniform highp vec4 u_stroke_color; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_width -uniform lowp float a_stroke_width_t; -attribute mediump vec2 a_stroke_width; -varying mediump float stroke_width; -#else -uniform mediump float u_stroke_width; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_opacity -uniform lowp float a_stroke_opacity_t; -attribute lowp vec2 a_stroke_opacity; -varying lowp float stroke_opacity; -#else -uniform lowp float u_stroke_opacity; -#endif - - -varying vec3 v_data; - -void main(void) { - -#ifndef HAS_UNIFORM_u_color - color = unpack_mix_vec4(a_color, a_color_t); -#else - highp vec4 color = u_color; -#endif - - -#ifndef HAS_UNIFORM_u_radius - radius = unpack_mix_vec2(a_radius, a_radius_t); -#else - mediump float radius = u_radius; -#endif - - -#ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); -#else - lowp float blur = u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_color - stroke_color = unpack_mix_vec4(a_stroke_color, a_stroke_color_t); -#else - highp vec4 stroke_color = u_stroke_color; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_width - stroke_width = unpack_mix_vec2(a_stroke_width, a_stroke_width_t); -#else - mediump float stroke_width = u_stroke_width; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_opacity - stroke_opacity = unpack_mix_vec2(a_stroke_opacity, a_stroke_opacity_t); -#else - lowp float stroke_opacity = u_stroke_opacity; -#endif - - - // unencode the extrusion vector that we snuck into the a_pos vector - vec2 extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); - - // multiply a_pos by 0.5, since we had it * 2 in order to sneak - // in extrusion data - vec2 circle_center = floor(a_pos * 0.5); - if (u_pitch_with_map) { - vec2 corner_position = circle_center; - if (u_scale_with_map) { - corner_position += extrude * (radius + stroke_width) * u_extrude_scale; - } else { - // Pitching the circle with the map effectively scales it with the map - // To counteract the effect for pitch-scale: viewport, we rescale the - // whole circle based on the pitch scaling effect at its central point - vec4 projected_center = u_matrix * vec4(circle_center, 0, 1); - corner_position += extrude * (radius + stroke_width) * u_extrude_scale * (projected_center.w / u_camera_to_center_distance); - } - - gl_Position = u_matrix * vec4(corner_position, 0, 1); - } else { - gl_Position = u_matrix * vec4(circle_center, 0, 1); - - if (u_scale_with_map) { - gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * u_camera_to_center_distance; - } else { - gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * gl_Position.w; - } - } - - // This is a minimum blur distance that serves as a faux-antialiasing for - // the circle. since blur is a ratio of the circle's size and the intent is - // to keep the blur at roughly 1px, the two are inversely related. - lowp float antialiasblur = 1.0 / DEVICE_PIXEL_RATIO / (radius + stroke_width); - - v_data = vec3(extrude.x, extrude.y, antialiasblur); -} - -)MBGL_SHADER"; -const char* circle::fragmentSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_color -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_radius -varying mediump float radius; -#else -uniform mediump float u_radius; -#endif - - -#ifndef HAS_UNIFORM_u_blur -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_color -varying highp vec4 stroke_color; -#else -uniform highp vec4 u_stroke_color; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_width -varying mediump float stroke_width; -#else -uniform mediump float u_stroke_width; -#endif - - -#ifndef HAS_UNIFORM_u_stroke_opacity -varying lowp float stroke_opacity; -#else -uniform lowp float u_stroke_opacity; -#endif - - -varying vec3 v_data; - -void main() { - -#ifdef HAS_UNIFORM_u_color - highp vec4 color = u_color; -#endif - - -#ifdef HAS_UNIFORM_u_radius - mediump float radius = u_radius; -#endif - - -#ifdef HAS_UNIFORM_u_blur - lowp float blur = u_blur; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - -#ifdef HAS_UNIFORM_u_stroke_color - highp vec4 stroke_color = u_stroke_color; -#endif - - -#ifdef HAS_UNIFORM_u_stroke_width - mediump float stroke_width = u_stroke_width; -#endif - - -#ifdef HAS_UNIFORM_u_stroke_opacity - lowp float stroke_opacity = u_stroke_opacity; -#endif - - - vec2 extrude = v_data.xy; - float extrude_length = length(extrude); - - lowp float antialiasblur = v_data.z; - float antialiased_blur = -max(blur, antialiasblur); - - float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0); - - float color_t = stroke_width < 0.01 ? 0.0 : smoothstep( - antialiased_blur, - 0.0, - extrude_length - radius / (radius + stroke_width) - ); - - gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* circle::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xb5, 0x57, 0xcb, 0x6e, 0xdc, 0x36, + 0x14, 0xdd, 0xcf, 0x57, 0x10, 0xc8, 0xa2, 0xe3, + 0x44, 0x1e, 0x3f, 0x92, 0x6c, 0x3a, 0xf0, 0x22, + 0x68, 0x5d, 0xd4, 0x40, 0xdb, 0x18, 0x69, 0x52, + 0x74, 0x27, 0x70, 0x24, 0xca, 0x62, 0x47, 0x12, + 0x05, 0x8a, 0x9a, 0x47, 0x0b, 0xff, 0x7b, 0xef, + 0x25, 0x29, 0x89, 0xd4, 0x83, 0x4e, 0x8b, 0xd6, + 0x1b, 0x6b, 0x78, 0x0f, 0xcf, 0x3d, 0x24, 0x8f, + 0xce, 0x70, 0xda, 0x8a, 0x67, 0x42, 0x96, 0xa4, + 0xa4, 0xea, 0x1d, 0x69, 0x63, 0xf8, 0x27, 0xf9, + 0x69, 0xbb, 0x6a, 0xed, 0xf0, 0x4e, 0x88, 0x02, + 0x86, 0x9b, 0x84, 0x16, 0x2c, 0x3e, 0x72, 0x95, + 0x03, 0xa2, 0x9e, 0x94, 0x6b, 0xae, 0x92, 0x7c, + 0xa6, 0x7c, 0x60, 0xc9, 0x2d, 0x94, 0xd9, 0x49, + 0xc9, 0x36, 0x65, 0x86, 0x65, 0xa8, 0xe6, 0xfc, +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x7d, 0x7d, 0x2d, 0x20, + 0xd1, 0xc1, 0x04, 0x55, 0x36, 0x4a, 0x8a, 0x3d, + 0x0b, 0x59, 0xd1, 0x45, 0x04, 0x1c, 0xe9, 0xc2, + 0x66, 0x8d, 0xe9, 0x03, 0x02, 0xfe, 0x1c, 0x03, + 0xbf, 0x46, 0xff, 0x91, 0xa7, 0x2a, 0x0f, 0xea, + 0xd7, 0x88, 0xa0, 0x65, 0x5d, 0xe0, 0x92, 0x71, + 0x7d, 0x4c, 0xd8, 0xbe, 0x63, 0xec, 0xd7, 0xac, + 0x23, 0x68, 0x1a, 0x1f, 0xb3, 0xec, 0x1d, 0x1f, + 0x37, 0x6b, 0xa1, 0x31, 0x24, 0xe0, 0xa4, 0x29, + 0xd4, 0x2e, 0xa4, 0xa3, 0x85, 0xae, 0x6f, 0xc9, + 0x21, 0x4e, 0xa9, 0xa2, 0x90, 0x75, 0x07, 0xc1, + 0x53, 0x08, 0x69, 0x5e, 0xad, 0xf1, 0xe9, 0x82, + 0xfc, 0xb5, 0x22, 0xf0, 0x17, 0x4c, 0x40, 0x04, + 0xe8, 0x27, 0x72, 0x47, 0xda, 0x0a, 0xfa, 0xec, + 0xe3, 0x92, 0x9f, 0x62, 0xb4, 0xc3, 0xda, 0x46, + 0x5d, 0x34, 0x64, 0xe2, 0x45, 0xa7, 0x16, 0xa7, + 0x8d, 0x83, 0x0f, 0x19, 0xc6, 0xce, 0x09, 0xf4, + 0xb7, 0x21, 0x87, 0x08, 0xf3, 0x38, 0x51, 0x70, + 0xbb, 0xee, 0xb2, 0x2c, 0x72, 0x82, 0xcf, 0xd3, + 0x30, 0x17, 0x6d, 0x5a, 0xc7, 0x38, 0xbf, 0x02, + 0x42, 0x74, 0x86, 0x61, 0x1d, 0x1f, 0x66, 0x45, + 0x60, 0x21, 0xea, 0x33, 0xcd, 0x13, 0x30, 0x8a, + 0x2e, 0xdd, 0xdb, 0x8f, 0xa8, 0x40, 0xe7, 0xce, + 0x71, 0x08, 0xb1, 0xcf, 0xb3, 0xfd, 0x6d, 0x2d, + 0x72, 0xc3, 0x6b, 0x49, 0x85, 0xc3, 0x33, 0xf5, + 0x4d, 0x40, 0x8b, 0x17, 0x46, 0x88, 0x73, 0x07, + 0x66, 0xcd, 0xe1, 0x02, 0xa2, 0x49, 0x58, 0x2d, + 0x59, 0x65, 0x4c, 0xbb, 0x10, 0x39, 0x2f, 0x2b, + 0x35, 0xb1, 0xe3, 0x28, 0xd5, 0x03, 0xb3, 0xfb, + 0xe7, 0x02, 0xa2, 0x49, 0x2c, 0x05, 0x0c, 0x35, + 0x66, 0x5e, 0xc8, 0x95, 0x97, 0xc5, 0xba, 0x27, + 0xed, 0x0f, 0x85, 0x04, 0x3b, 0xe7, 0x3e, 0xce, + 0x9f, 0xa5, 0xe3, 0x9f, 0x92, 0x2f, 0x87, 0x08, + 0x4e, 0xbd, 0xba, 0x82, 0xf6, 0xac, 0x4a, 0x44, + 0xca, 0x88, 0xca, 0x19, 0xd1, 0xd7, 0xb0, 0x86, + 0x8b, 0x0a, 0x4f, 0x4b, 0xc1, 0x11, 0xa9, 0x1c, + 0x58, 0x8f, 0x8c, 0x34, 0x55, 0x9b, 0xec, 0x09, + 0xaf, 0x94, 0xd0, 0x38, 0x7d, 0xbd, 0xb2, 0x18, + 0x4d, 0xa4, 0xf3, 0xcf, 0x5e, 0xe2, 0xa0, 0xad, + 0x5e, 0x48, 0x29, 0xd2, 0xb5, 0x06, 0x46, 0xe4, + 0x76, 0x73, 0x7d, 0x41, 0x5e, 0xe3, 0x3f, 0x72, + 0x49, 0x6e, 0xe0, 0xc3, 0xb6, 0xef, 0x5f, 0xb6, + 0x85, 0xe2, 0x75, 0x71, 0xb6, 0x9c, 0xbb, 0x33, + 0xb9, 0xde, 0xbc, 0x8f, 0x48, 0xc3, 0xe1, 0x5e, + 0x87, 0x9d, 0x73, 0x9a, 0x12, 0xae, 0x70, 0x32, + 0xb4, 0x27, 0x42, 0xa6, 0x0c, 0x54, 0x09, 0x10, + 0xc4, 0xe8, 0xbe, 0xe3, 0x80, 0xc2, 0xa0, 0x1c, + 0xd3, 0x70, 0xd0, 0x94, 0x70, 0x99, 0xc0, 0xbd, + 0xd4, 0x5c, 0x18, 0x41, 0x19, 0xec, 0x93, 0x90, + 0x46, 0x16, 0x70, 0x42, 0x2b, 0x90, 0x82, 0x60, + 0x9e, 0x91, 0xf5, 0xf8, 0x96, 0xda, 0x45, 0xe8, + 0x40, 0x26, 0x64, 0x05, 0xd7, 0x4e, 0x98, 0xcb, + 0x15, 0xb6, 0xba, 0xf3, 0xe9, 0xb7, 0x3d, 0xda, + 0xb0, 0xf9, 0x57, 0x62, 0x97, 0xcd, 0xe4, 0xae, + 0x4f, 0xf6, 0xe6, 0xae, 0xdf, 0xc0, 0xd7, 0x64, + 0x6d, 0xc3, 0xec, 0x8d, 0x67, 0x42, 0xdc, 0xc3, + 0xc9, 0x5d, 0xb9, 0xe3, 0x7b, 0x26, 0xe8, 0x88, + 0x51, 0x13, 0xd8, 0x9c, 0x47, 0x5c, 0x13, 0x7e, + 0x5b, 0xe0, 0xc1, 0x19, 0xbd, 0x04, 0x35, 0xe9, + 0xcf, 0xa0, 0x8b, 0xb0, 0x2c, 0x83, 0x83, 0xe4, + 0x07, 0x06, 0x87, 0xa0, 0x39, 0x1b, 0xdc, 0x70, + 0x17, 0x32, 0xa6, 0xfc, 0x2c, 0x40, 0x7d, 0x8b, + 0x4b, 0xa6, 0x89, 0x32, 0xc6, 0xd1, 0x1c, 0x04, + 0xbe, 0xc3, 0x88, 0xde, 0xc3, 0x4b, 0x4d, 0xf4, + 0x2d, 0x39, 0x70, 0x76, 0xac, 0x85, 0x54, 0x11, + 0x1e, 0xa5, 0x64, 0x7a, 0x14, 0x27, 0x8c, 0x19, + 0x8f, 0xb9, 0x28, 0x7a, 0x75, 0x3b, 0xda, 0xb0, + 0x94, 0xc0, 0x96, 0x20, 0xb3, 0xa6, 0xd3, 0xba, + 0x70, 0x0d, 0xb6, 0x0f, 0x98, 0x92, 0xab, 0x86, + 0xe0, 0xb6, 0x4b, 0x5a, 0x90, 0x5a, 0x80, 0x33, + 0x3d, 0x4a, 0x1d, 0x36, 0xb5, 0x14, 0x7f, 0x00, + 0x9a, 0xa5, 0xc3, 0xf1, 0x77, 0x3f, 0x5f, 0x60, + 0x23, 0x75, 0x8e, 0x79, 0xe7, 0x17, 0x91, 0xeb, + 0x88, 0xdc, 0x5c, 0x6c, 0xff, 0x87, 0x63, 0x42, + 0xec, 0x58, 0xce, 0xe6, 0x48, 0xae, 0x42, 0xbf, + 0x6a, 0x1c, 0x21, 0xcf, 0xab, 0xfe, 0xf1, 0xa9, + 0x88, 0x1f, 0x07, 0xff, 0x4d, 0xd6, 0xe3, 0xab, + 0xf5, 0x56, 0x34, 0x31, 0xc8, 0x0b, 0x54, 0xb3, + 0x5b, 0xf3, 0x8f, 0x2c, 0xee, 0x34, 0xd8, 0x9c, + 0xce, 0xff, 0x7e, 0xeb, 0x82, 0x3f, 0xfd, 0x82, + 0xfe, 0xff, 0xaf, 0x14, 0xb8, 0x3c, 0x47, 0xf7, + 0x5c, 0x9c, 0xd3, 0xc1, 0x17, 0x23, 0xe7, 0xf0, + 0xf2, 0x34, 0x84, 0x92, 0x92, 0x57, 0xbc, 0x6c, + 0x4b, 0x73, 0x2d, 0xe8, 0xc4, 0x9a, 0x38, 0x6d, + 0x98, 0x3c, 0xc0, 0x3b, 0x46, 0x11, 0x96, 0xd1, + 0xf6, 0x74, 0x49, 0x2b, 0xc5, 0xc1, 0xde, 0xb4, + 0x41, 0x87, 0x67, 0x36, 0x51, 0x81, 0x6d, 0x78, + 0x61, 0x37, 0x36, 0x0f, 0x35, 0x9b, 0xe6, 0x97, + 0x14, 0xb4, 0x10, 0x91, 0x39, 0xa0, 0x6f, 0x1a, + 0x40, 0xfd, 0x09, 0xe1, 0x5c, 0xa5, 0x7a, 0x14, + 0xde, 0x09, 0xd8, 0x2b, 0x80, 0xf7, 0x7c, 0x82, + 0xec, 0x19, 0xab, 0x75, 0x51, 0x33, 0xe1, 0xa5, + 0x49, 0xb4, 0x4f, 0x39, 0xbc, 0xf8, 0x37, 0xf5, + 0x29, 0xd2, 0x05, 0x75, 0x14, 0x84, 0x4a, 0x9c, + 0x7d, 0x60, 0xb2, 0xc1, 0x4c, 0x90, 0xac, 0xa0, + 0xe0, 0xda, 0xcd, 0xf8, 0xcb, 0xa6, 0x97, 0x6d, + 0xaf, 0x3e, 0x90, 0xeb, 0x60, 0xe8, 0xef, 0xef, + 0x7f, 0x7b, 0xf8, 0xee, 0x3e, 0x7e, 0x7c, 0xf8, + 0xfd, 0xfe, 0xa7, 0xf8, 0xd3, 0x87, 0xcf, 0x0f, + 0x1f, 0x61, 0x70, 0x61, 0xab, 0xad, 0x9d, 0xcc, + 0x0d, 0xd6, 0x7c, 0x6d, 0xbc, 0x5d, 0xdb, 0xad, + 0xdf, 0x80, 0x9e, 0xee, 0x11, 0xbf, 0x03, 0xdd, + 0x66, 0x30, 0xf1, 0x79, 0xf5, 0x37, 0xfa, 0x66, + 0x94, 0xc5 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* circle::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x53, 0xcb, 0x6e, 0xdb, 0x30, + 0x10, 0xbc, 0xf3, 0x2b, 0x16, 0xc8, 0x45, 0x76, + 0x15, 0xd7, 0x69, 0x7b, 0xaa, 0x5b, 0x14, 0x41, + 0x9a, 0xa0, 0x39, 0x34, 0x2e, 0x9c, 0x3e, 0x8e, + 0x04, 0x6b, 0x51, 0x32, 0x51, 0x49, 0x34, 0x24, + 0xca, 0x71, 0x1a, 0xf4, 0xdf, 0xcb, 0x97, 0x1c, + 0x92, 0x7a, 0x45, 0x17, 0x49, 0x9c, 0xdd, 0x99, + 0xe5, 0xee, 0x2c, 0x3a, 0x63, 0x69, 0x99, 0xd0, + 0x14, 0xbe, 0x5c, 0xde, 0xe3, 0x1f, 0x77, 0xb7, + 0x37, 0xeb, 0xcd, 0x57, 0xdc, 0xe0, 0x2d, 0xcf, + 0x79, 0x85, 0x0e, 0xa4, 0x7a, 0x64, 0x65, 0x06, + 0x3b, 0x96, 0xed, 0xf6, 0x70, 0xa0, 0xdb, 0x77, + 0xa0, 0x81, 0x15, 0x3a, 0xa3, 0x79, 0x4d, 0x51, + 0x53, 0xb2, 0x94, 0x57, 0x85, 0x8b, 0xdb, 0x54, + 0x15, 0x51, 0x26, 0x2c, 0x45, 0x08, 0xf5, 0x0b, + 0x54, 0x24, 0x61, 0x4d, 0x7d, 0x52, 0x28, 0xa8, + 0xfc, 0x2d, 0xf6, 0x90, 0xe6, 0x9c, 0x08, 0x30, + 0x60, 0xa8, 0xe2, 0xc7, 0xb4, 0x14, 0x93, 0x4a, + 0xbf, 0xf3, 0xe6, 0xf9, 0x26, 0x39, 0x7f, 0x68, + 0x09, 0xd4, 0x79, 0x28, 0xe1, 0xc0, 0x26, 0x71, + 0x92, 0x9d, 0xef, 0xc9, 0x96, 0x89, 0xc7, 0x3e, + 0x01, 0x0b, 0x8d, 0x6a, 0x38, 0x31, 0xa3, 0x32, + 0xb5, 0xa8, 0xf8, 0x1f, 0x3a, 0x3c, 0x16, 0x17, + 0x1f, 0x9d, 0x4e, 0x18, 0xf8, 0x12, 0xd5, 0x07, + 0x96, 0x88, 0xdd, 0xc0, 0xa8, 0xdc, 0x90, 0xa9, + 0x81, 0x85, 0xb1, 0x2f, 0xd1, 0x1e, 0xe9, 0xaf, + 0x1f, 0x31, 0xda, 0xe6, 0x6e, 0xa8, 0xd5, 0x6e, + 0x69, 0x65, 0x77, 0xde, 0xc2, 0x01, 0x27, 0x44, + 0x90, 0x95, 0x3c, 0xe5, 0x2c, 0x81, 0x82, 0xb0, + 0x32, 0x9a, 0xc1, 0x13, 0x02, 0xf9, 0xa8, 0x22, + 0x87, 0xb6, 0x44, 0xe1, 0xe1, 0x86, 0xc0, 0x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 0x4f, 0x47, 0xed, 0x84, 0xa8, + 0x62, 0x4e, 0x3f, 0x9d, 0x12, 0xec, 0x1e, 0xbd, + 0x86, 0xc8, 0x7e, 0xbd, 0xf2, 0xa4, 0x67, 0x3a, + 0xb3, 0x2d, 0x32, 0xcb, 0xf1, 0x4d, 0x45, 0xb2, + 0x2b, 0x6b, 0xc8, 0xe7, 0xdb, 0xcf, 0xa1, 0x60, + 0xc7, 0xc8, 0x18, 0x75, 0xde, 0x9e, 0xc7, 0xbe, + 0x81, 0xe7, 0x81, 0x21, 0xe2, 0xf6, 0xb6, 0x8a, + 0xdd, 0xda, 0x6b, 0xfd, 0xf3, 0x7a, 0xf3, 0x79, + 0x73, 0xf9, 0x0b, 0xdf, 0xde, 0xdd, 0x7f, 0xbb, + 0xbe, 0xfa, 0xbe, 0xde, 0xf4, 0xe9, 0xaa, 0xe5, + 0x88, 0x4c, 0xef, 0xac, 0x81, 0xfe, 0xa1, 0xff, + 0xaa, 0xf7, 0x8d, 0xe5 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/clipping_mask.cpp b/src/mbgl/shaders/clipping_mask.cpp index fb08d7cb00..772ef34fa8 100644 --- a/src/mbgl/shaders/clipping_mask.cpp +++ b/src/mbgl/shaders/clipping_mask.cpp @@ -1,27 +1,46 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* clipping_mask::name = "clipping_mask"; -const char* clipping_mask::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; - -uniform mat4 u_matrix; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); -} - -)MBGL_SHADER"; -const char* clipping_mask::fragmentSource = R"MBGL_SHADER( -void main() { - gl_FragColor = vec4(1.0); -} - -)MBGL_SHADER"; +const char* clipping_mask::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x4b, 0x2c, 0x29, 0x29, 0xca, 0x4c, + 0x2a, 0x2d, 0x49, 0x55, 0x28, 0x4b, 0x4d, 0x36, + 0x52, 0x48, 0x8c, 0x2f, 0xc8, 0x2f, 0xb6, 0xe6, + 0xe2, 0x2a, 0xcd, 0xcb, 0x4c, 0xcb, 0x2f, 0xca, + 0x55, 0xc8, 0x4d, 0x2c, 0x31, 0x51, 0x28, 0x8d, + 0x07, 0x52, 0x45, 0x99, 0x15, 0x40, 0xf1, 0xb2, + 0xfc, 0xcc, 0x14, 0xa0, 0x60, 0x66, 0x9e, 0x86, + 0xa6, 0x42, 0x35, 0x97, 0x02, 0x10, 0xa4, 0xe7, + 0xc4, 0x07, 0xe4, 0x17, 0x67, 0x96, 0x64, 0xe6, + 0xe7, 0x29, 0xd8, 0xc2, 0x95, 0x2a, 0x68, 0x81, + 0xcc, 0x33, 0xd1, 0x00, 0x9b, 0xa7, 0xa3, 0x60, + 0xa0, 0xa3, 0x60, 0xa8, 0x69, 0xcd, 0x55, 0xcb, + 0x05, 0x00, 0x45, 0x7b, 0x23, 0xb2 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* clipping_mask::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x2b, 0xcb, 0xcf, 0x4c, 0x51, 0xc8, + 0x4d, 0xcc, 0xcc, 0xd3, 0xd0, 0x54, 0xa8, 0xe6, + 0x52, 0x00, 0x82, 0xf4, 0x9c, 0x78, 0xb7, 0xa2, + 0xc4, 0x74, 0xe7, 0xfc, 0x9c, 0xfc, 0x22, 0x05, + 0x5b, 0x85, 0xb2, 0xd4, 0x64, 0x13, 0x0d, 0x43, + 0x3d, 0x03, 0x4d, 0x6b, 0xae, 0x5a, 0x2e, 0x00, + 0x4c, 0x3f, 0x0d, 0x3a + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/collision_box.cpp b/src/mbgl/shaders/collision_box.cpp index bc5d9bc6f9..5ac0f1e145 100644 --- a/src/mbgl/shaders/collision_box.cpp +++ b/src/mbgl/shaders/collision_box.cpp @@ -1,63 +1,100 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* collision_box::name = "collision_box"; -const char* collision_box::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; -attribute vec2 a_anchor_pos; -attribute vec2 a_extrude; -attribute vec2 a_placed; - -uniform mat4 u_matrix; -uniform vec2 u_extrude_scale; -uniform float u_camera_to_center_distance; - -varying float v_placed; -varying float v_notUsed; - -void main() { - vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1); - highp float camera_to_anchor_distance = projectedPoint.w; - highp float collision_perspective_ratio = clamp( - 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance), - 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles - 4.0); - - gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0); - gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio; - - v_placed = a_placed.x; - v_notUsed = a_placed.y; -} - -)MBGL_SHADER"; -const char* collision_box::fragmentSource = R"MBGL_SHADER( - -varying float v_placed; -varying float v_notUsed; - -void main() { - - float alpha = 0.5; - - // Red = collision, hide label - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha; - - // Blue = no collision, label is showing - if (v_placed > 0.5) { - gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha; - } - - if (v_notUsed > 0.5) { - // This box not used, fade it out - gl_FragColor *= .1; - } -} -)MBGL_SHADER"; +const char* collision_box::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x52, 0xcb, 0x6e, 0xc2, 0x30, + 0x10, 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xdd, 0xbe, 0xea, 0x07, + 0x5d, 0xad, 0xf6, 0xe4, 0x8b, 0x55, 0x69, 0xf8, + 0x7f, 0x42, 0x7a, 0x78, 0xa0, 0x66, 0x6b, 0x29, + 0x10, 0x3b, 0x55, 0xa1, 0x0f, 0x95, 0x90, 0xa9, + 0x41, 0xe5, 0x75, 0x24, 0x16, 0xbd, 0xb1, 0xba, + 0xac, 0x46, 0x9d, 0xe8, 0x7c, 0xe6, 0xe9, 0x07, + 0x4c, 0xbb, 0xef, 0x04, 0x46, 0x2f, 0x42, 0x82, + 0xec, 0xb9, 0xab, 0xf1, 0xec, 0xa6, 0x9d, 0x3c, + 0x29, 0xcb, 0x60, 0xed, 0xb1, 0x91, 0x06, 0x01, + 0xb8, 0x11, 0x0f, 0x74, 0xc2, 0x02, 0x1c, 0x6a, + 0xff, 0xb6, 0x25, 0xb4, 0x05, 0x6c, 0xb8, 0xc5, + 0x00, 0xe4, 0xa0, 0xa2, 0x68, 0xf6, 0x58, 0x64, + 0x67, 0xd6, 0x89, 0xb9, 0x14, 0x5a, 0x24, 0x8b, + 0x61, 0xe8, 0xb7, 0x4c, 0xe7, 0x92, 0x4f, 0x77, + 0xdd, 0x59, 0xb5, 0xe6, 0x40, 0xf2, 0x0a, 0xf7, + 0x30, 0xd7, 0xbf, 0x40, 0xcf, 0xf3, 0x17, 0x9d, + 0xe8, 0x4e, 0x93, 0xb6, 0x47, 0x98, 0xae, 0xae, + 0xfb, 0x26, 0xc2, 0xbb, 0x95, 0x91, 0xca, 0x2d, + 0xff, 0x20, 0xf7, 0x17, 0x51, 0xf6, 0xae, 0x2e, + 0xbb, 0x02, 0xab, 0x61, 0x61, 0xd3, 0x36, 0xef, + 0xa1, 0x7e, 0x5d, 0x6e, 0xb1, 0x63, 0x9e, 0xfc, + 0x24, 0xbf, 0xdf, 0xcb, 0x16, 0xcc + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* collision_box::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x6d, 0x90, 0xc1, 0x4e, 0xc3, 0x40, + 0x0c, 0x44, 0xef, 0xfb, 0x15, 0x73, 0x4c, 0xab, + 0x28, 0x6d, 0x25, 0x38, 0x55, 0xe5, 0x00, 0x12, + 0x1f, 0x80, 0xe0, 0x5c, 0xb9, 0xc9, 0x26, 0xb1, + 0x64, 0xd6, 0x55, 0xb2, 0x09, 0x20, 0xd4, 0x7f, + 0xc7, 0x49, 0x1a, 0x28, 0x50, 0x1f, 0x56, 0xda, + 0xd9, 0xf1, 0xf8, 0xad, 0x5d, 0x4f, 0xcd, 0x07, + 0x87, 0x0a, 0xa5, 0x28, 0x45, 0xf4, 0xfb, 0xa3, + 0x50, 0xee, 0x8b, 0xad, 0xfb, 0xab, 0x07, 0x8d, + 0x2f, 0xed, 0xf0, 0xe0, 0x7a, 0xe5, 0x02, 0xaf, + 0xc4, 0x21, 0x59, 0xe0, 0xd3, 0x39, 0x58, 0x4d, + 0x26, 0x92, 0x63, 0x4d, 0xd8, 0x61, 0x9d, 0xdd, + 0x6e, 0x27, 0x7d, 0xb5, 0xc2, 0x93, 0x2f, 0x4c, + 0xca, 0x55, 0x84, 0x5b, 0xd6, 0x90, 0xa2, 0xe6, + 0xc2, 0x43, 0xe8, 0xe0, 0x65, 0xb4, 0x54, 0xb2, + 0x7f, 0x6c, 0xa8, 0x7a, 0x50, 0xd1, 0xc6, 0x8c, + 0xbd, 0xcf, 0x6f, 0x92, 0x4d, 0xb6, 0x4e, 0x2d, + 0x65, 0x3e, 0xec, 0xba, 0xc0, 0x72, 0x8a, 0xff, + 0x09, 0xbe, 0x97, 0xce, 0x5b, 0x43, 0xd0, 0xcb, + 0xf0, 0x31, 0x17, 0xdc, 0xa2, 0xad, 0xf5, 0xcd, + 0xf0, 0x47, 0x33, 0x97, 0x48, 0xe6, 0x8f, 0xe1, + 0x6e, 0xc0, 0x1b, 0xc0, 0x71, 0xae, 0x6b, 0x00, + 0xbf, 0x66, 0xa7, 0x53, 0xc7, 0x37, 0xc0, 0xd0, + 0x74, 0x72, 0x17, 0xc9, 0xe7, 0xd5, 0xfc, 0x8f, + 0x36, 0xca, 0xe7, 0xda, 0x60, 0x0e, 0xfa, 0x6e, + 0x9c, 0x11, 0x9d, 0xb9, 0x52, 0x94, 0x64, 0x0b, + 0xe0, 0x08, 0xed, 0xe2, 0x75, 0x88, 0xe5, 0x0e, + 0xd9, 0x66, 0x9e, 0x73, 0xfa, 0x02, 0x88, 0x26, + 0x74, 0x25 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/collision_circle.cpp b/src/mbgl/shaders/collision_circle.cpp index 82ebbf05a0..4742ba9360 100644 --- a/src/mbgl/shaders/collision_circle.cpp +++ b/src/mbgl/shaders/collision_circle.cpp @@ -1,87 +1,140 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* collision_circle::name = "collision_circle"; -const char* collision_circle::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; -attribute vec2 a_anchor_pos; -attribute vec2 a_extrude; -attribute vec2 a_placed; - -uniform mat4 u_matrix; -uniform vec2 u_extrude_scale; -uniform float u_camera_to_center_distance; - -varying float v_placed; -varying float v_notUsed; -varying float v_radius; - -varying vec2 v_extrude; -varying vec2 v_extrude_scale; - -void main() { - vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1); - highp float camera_to_anchor_distance = projectedPoint.w; - highp float collision_perspective_ratio = clamp( - 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance), - 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles - 4.0); - - gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0); - - highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur - gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio; - - v_placed = a_placed.x; - v_notUsed = a_placed.y; - v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius - - v_extrude = a_extrude * padding_factor; - v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio; -} - -)MBGL_SHADER"; -const char* collision_circle::fragmentSource = R"MBGL_SHADER( -uniform float u_overscale_factor; - -varying float v_placed; -varying float v_notUsed; -varying float v_radius; -varying vec2 v_extrude; -varying vec2 v_extrude_scale; - -void main() { - float alpha = 0.5; - - // Red = collision, hide label - vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha; - - // Blue = no collision, label is showing - if (v_placed > 0.5) { - color = vec4(0.0, 0.0, 1.0, 0.5) * alpha; - } - - if (v_notUsed > 0.5) { - // This box not used, fade it out - color *= .2; - } - - float extrude_scale_length = length(v_extrude_scale); - float extrude_length = length(v_extrude) * extrude_scale_length; - float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor; - float radius = v_radius * extrude_scale_length; - - float distance_to_edge = abs(extrude_length - radius); - float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge); - - gl_FragColor = opacity_t * color; -} - -)MBGL_SHADER"; +const char* collision_circle::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x85, 0x53, 0x4d, 0x93, 0xda, 0x30, + 0x0c, 0xbd, 0xe7, 0x57, 0xe8, 0x56, 0x60, 0xd9, + 0x00, 0x3b, 0xf4, 0x94, 0xe1, 0x3f, 0x70, 0xe9, + 0xf4, 0x98, 0x11, 0xb6, 0x01, 0x6d, 0x1d, 0x3b, + 0xb5, 0x9d, 0x2c, 0x6c, 0xa7, 0xff, 0xbd, 0xb2, + 0x49, 0xc2, 0xc7, 0x64, 0x69, 0x0e, 0xc9, 0x44, + 0x7a, 0x92, 0xdf, 0x7b, 0x92, 0x31, 0x04, 0x47, + 0xbb, 0x26, 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58, 0x70, + 0x20, 0xcb, 0xf5, 0x42, 0x63, 0x55, 0x4f, 0x52, + 0x51, 0x7c, 0x96, 0xf9, 0x77, 0x78, 0x49, 0xef, + 0x19, 0x4c, 0x9e, 0x78, 0x0e, 0x8b, 0xaf, 0x59, + 0x4d, 0xe7, 0x37, 0xed, 0x58, 0xd2, 0x62, 0x01, + 0x5b, 0xa7, 0x5a, 0x6e, 0xe0, 0xc1, 0xb6, 0xcc, + 0x81, 0x3e, 0x95, 0x04, 0xa3, 0xd0, 0xbd, 0xee, + 0x49, 0x69, 0x09, 0x82, 0x9c, 0xd0, 0xca, 0x03, + 0x19, 0xa8, 0x29, 0x88, 0xa3, 0x92, 0x8b, 0x88, + 0xfb, 0xb4, 0xb6, 0x62, 0x60, 0x20, 0xce, 0x0d, + 0x1d, 0xd7, 0xf9, 0x92, 0x1d, 0x4a, 0xbf, 0x07, + 0x5d, 0x6e, 0xad, 0x27, 0xd6, 0x61, 0x46, 0x9d, + 0xbd, 0x58, 0x1a, 0x19, 0xac, 0xae, 0x45, 0xb7, + 0xce, 0xd4, 0x28, 0x25, 0xcf, 0xb4, 0xdc, 0xa3, + 0x08, 0xd6, 0x71, 0x8f, 0x55, 0xfe, 0x56, 0x24, + 0xba, 0xc8, 0xc7, 0x1e, 0xe3, 0x1e, 0xbb, 0x40, + 0x82, 0x99, 0x79, 0xcd, 0x65, 0x41, 0x9f, 0x21, + 0x58, 0x9e, 0xf2, 0x2f, 0x05, 0x8e, 0xb9, 0x01, + 0xaf, 0x27, 0xa0, 0x09, 0xf4, 0x8a, 0x9a, 0xd0, + 0xc3, 0x4e, 0x37, 0xee, 0x91, 0x58, 0x7e, 0x3a, + 0xc3, 0xcb, 0xe6, 0x7a, 0x4b, 0x98, 0xdd, 0xc3, + 0xa2, 0x73, 0xe4, 0x81, 0xc7, 0xec, 0xae, 0xc1, + 0x07, 0xff, 0x3f, 0x19, 0x61, 0x27, 0xab, 0x5f, + 0x79, 0xd8, 0x0c, 0xf7, 0x2e, 0x3f, 0x15, 0x5d, + 0xaa, 0xdb, 0xfa, 0xdb, 0xdc, 0xb9, 0xcf, 0x5d, + 0x16, 0x3f, 0xa6, 0x76, 0x7e, 0x32, 0xd0, 0xcc, + 0xcf, 0xd3, 0x64, 0xc4, 0x4f, 0x05, 0xd2, 0x9a, + 0x6f, 0xe1, 0x32, 0x97, 0xe4, 0x49, 0x37, 0xac, + 0x39, 0x78, 0x0b, 0x3b, 0x1b, 0x8e, 0xc0, 0xf7, + 0x34, 0x0e, 0x76, 0x9f, 0xb2, 0xa9, 0x3e, 0x32, + 0x8d, 0x43, 0x88, 0x62, 0xd0, 0x71, 0xf0, 0x77, + 0x83, 0x3a, 0x4e, 0xb7, 0xc2, 0x03, 0x83, 0xa3, + 0x0d, 0xec, 0x63, 0x84, 0x5f, 0x4e, 0xef, 0x25, + 0xf4, 0x1e, 0xdd, 0xfb, 0x75, 0xef, 0x4e, 0x71, + 0x8f, 0xed, 0x3c, 0xdc, 0x8c, 0xb8, 0xfa, 0x6c, + 0x7b, 0xff, 0x63, 0xe9, 0xdf, 0xec, 0x1f, 0x57, + 0xdf, 0xc0, 0xf4 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* collision_circle::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x75, 0x52, 0xcb, 0x6e, 0x83, 0x30, + 0x10, 0xbc, 0xf3, 0x15, 0x7b, 0x84, 0x88, 0x3c, + 0xd5, 0x9c, 0xa2, 0xf4, 0xd0, 0x4a, 0xfd, 0x80, + 0xaa, 0x3d, 0x5b, 0x0e, 0x36, 0x60, 0xd5, 0x61, + 0x91, 0x6d, 0x48, 0xa2, 0x2a, 0xff, 0xde, 0x35, + 0x90, 0xf2, 0x48, 0xe2, 0x03, 0xc2, 0xeb, 0xd9, + 0x99, 0xd9, 0x47, 0x55, 0xa8, 0x14, 0xcd, 0x11, + 0x52, 0x8d, 0xdc, 0x41, 0xc5, 0xb0, 0x96, 0xc6, + 0x26, 0x5c, 0x4b, 0x96, 0xf2, 0xc4, 0xa1, 0xd9, + 0x05, 0x41, 0xcd, 0xcd, 0x45, 0x15, 0x59, 0x07, + 0xa9, 0x59, 0xa9, 0x79, 0x22, 0xc5, 0xee, 0x2e, + 0x5e, 0xa0, 0xfb, 0xb6, 0x8f, 0x1e, 0x0c, 0x17, + 0xaa, 0xb2, 0x7d, 0xbc, 0x96, 0xc9, 0x86, 0xc2, + 0xf2, 0xec, 0x4c, 0x25, 0xe4, 0xb3, 0x38, 0x6b, + 0x6c, 0x78, 0x7d, 0x54, 0x02, 0x8e, 0x5c, 0x15, + 0x61, 0x04, 0xbf, 0x01, 0xd0, 0x69, 0x89, 0xb9, + 0x2e, 0x73, 0x0e, 0x7b, 0x58, 0x2d, 0xb6, 0x84, + 0xf2, 0xf1, 0xe5, 0x12, 0x3e, 0xa5, 0xa0, 0x50, + 0x82, 0x5a, 0x2b, 0xab, 0xb0, 0x88, 0x21, 0x57, + 0x42, 0x82, 0xe6, 0x07, 0xa9, 0x1b, 0x08, 0x69, + 0xbc, 0xf8, 0x67, 0x34, 0x04, 0xf3, 0x97, 0x70, + 0xbd, 0x58, 0xc5, 0xc4, 0x71, 0xfb, 0xd0, 0x35, + 0x82, 0x59, 0x4b, 0xde, 0xd3, 0xbe, 0xe9, 0x4a, + 0x52, 0x42, 0x81, 0x43, 0xea, 0x86, 0x15, 0x94, + 0x05, 0x9b, 0xe3, 0x89, 0x0a, 0x68, 0xc0, 0x2a, + 0x85, 0xf0, 0xd6, 0x23, 0x78, 0xf5, 0xe6, 0x6e, + 0xae, 0xfd, 0x19, 0x29, 0x8f, 0x44, 0xe3, 0x16, + 0xfa, 0xaf, 0xec, 0xd1, 0xd7, 0x60, 0x40, 0xd9, + 0xb5, 0xf7, 0x9e, 0x93, 0xec, 0x7d, 0xe5, 0xe4, + 0xe2, 0x80, 0x67, 0x32, 0x48, 0x43, 0x24, 0x54, + 0x0c, 0x29, 0xa7, 0xba, 0x95, 0x03, 0xac, 0xdc, + 0x44, 0x7d, 0xb6, 0x87, 0xc5, 0x66, 0x24, 0xd0, + 0xf6, 0x73, 0xd4, 0x77, 0xa6, 0x65, 0x91, 0xb9, + 0x9c, 0xac, 0xb6, 0x3f, 0xe1, 0x64, 0x2e, 0xd1, + 0xee, 0x41, 0xe6, 0xd3, 0x1c, 0x5f, 0xd7, 0x23, + 0xfa, 0x21, 0x89, 0x75, 0x06, 0x7f, 0x24, 0x3b, + 0x29, 0xd1, 0x50, 0xac, 0xb7, 0x8b, 0xd5, 0x93, + 0x2c, 0x58, 0x3e, 0x5c, 0xd4, 0x9e, 0xaa, 0x5d, + 0x38, 0xdf, 0xe6, 0x6e, 0xf7, 0x9e, 0xca, 0x0f, + 0x92, 0x84, 0xb2, 0x8e, 0x17, 0x89, 0x64, 0x0e, + 0x99, 0x14, 0x99, 0x1f, 0x37, 0x3f, 0xd8, 0x70, + 0x52, 0xdb, 0xbc, 0x23, 0x1f, 0xd5, 0x8f, 0x25, + 0x4f, 0x94, 0xbb, 0x30, 0x47, 0x39, 0xf6, 0x88, + 0xe8, 0x72, 0xeb, 0x64, 0x19, 0xce, 0x87, 0x25, + 0x75, 0x93, 0x9e, 0x4f, 0x65, 0xa2, 0xce, 0x44, + 0xa6, 0xd9, 0x87, 0xe1, 0xd9, 0x7b, 0xb7, 0x20, + 0x3d, 0xe5, 0xac, 0x1d, 0xdb, 0x2e, 0xb8, 0x06, + 0x7f, 0x6e, 0x86, 0x2b, 0x59 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/debug.cpp b/src/mbgl/shaders/debug.cpp index 9012cfa755..9294ae9e26 100644 --- a/src/mbgl/shaders/debug.cpp +++ b/src/mbgl/shaders/debug.cpp @@ -1,29 +1,48 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* debug::name = "debug"; -const char* debug::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; - -uniform mat4 u_matrix; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); -} - -)MBGL_SHADER"; -const char* debug::fragmentSource = R"MBGL_SHADER( -uniform highp vec4 u_color; - -void main() { - gl_FragColor = u_color; -} - -)MBGL_SHADER"; +const char* debug::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x4b, 0x2c, 0x29, 0x29, 0xca, 0x4c, + 0x2a, 0x2d, 0x49, 0x55, 0x28, 0x4b, 0x4d, 0x36, + 0x52, 0x48, 0x8c, 0x2f, 0xc8, 0x2f, 0xb6, 0xe6, + 0xe2, 0x2a, 0xcd, 0xcb, 0x4c, 0xcb, 0x2f, 0xca, + 0x55, 0xc8, 0x4d, 0x2c, 0x31, 0x51, 0x28, 0x8d, + 0x07, 0x52, 0x45, 0x99, 0x15, 0x40, 0xf1, 0xb2, + 0xfc, 0xcc, 0x14, 0xa0, 0x60, 0x66, 0x9e, 0x86, + 0xa6, 0x42, 0x35, 0x97, 0x02, 0x10, 0xa4, 0xe7, + 0xc4, 0x07, 0xe4, 0x17, 0x67, 0x96, 0x64, 0xe6, + 0xe7, 0x29, 0xd8, 0xc2, 0x95, 0x2a, 0x68, 0x81, + 0xcc, 0x33, 0xd1, 0x00, 0x9b, 0xa7, 0xa3, 0x60, + 0xa0, 0xa3, 0x60, 0xa8, 0x69, 0xcd, 0x55, 0xcb, + 0x05, 0x00, 0x45, 0x7b, 0x23, 0xb2 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* debug::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0x2f, + 0xca, 0x55, 0xc8, 0xc8, 0x4c, 0xcf, 0x28, 0x50, + 0x28, 0x4b, 0x4d, 0x36, 0x51, 0x28, 0x8d, 0x4f, + 0xce, 0xcf, 0xc9, 0x2f, 0xb2, 0xe6, 0xe2, 0x2a, + 0xcb, 0xcf, 0x4c, 0x51, 0xc8, 0x4d, 0xcc, 0xcc, + 0xd3, 0xd0, 0x54, 0xa8, 0xe6, 0x52, 0x00, 0x82, + 0xf4, 0x9c, 0x78, 0xb7, 0xa2, 0xc4, 0x74, 0x67, + 0x90, 0x02, 0x05, 0x5b, 0x84, 0xd2, 0x5a, 0x2e, + 0x00, 0x9b, 0x4e, 0x17, 0xff + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/extrusion_texture.cpp b/src/mbgl/shaders/extrusion_texture.cpp index c756db181c..2a9b0909af 100644 --- a/src/mbgl/shaders/extrusion_texture.cpp +++ b/src/mbgl/shaders/extrusion_texture.cpp @@ -1,39 +1,66 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* extrusion_texture::name = "extrusion_texture"; -const char* extrusion_texture::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_world; -attribute vec2 a_pos; -varying vec2 v_pos; - -void main() { - gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1); - - v_pos.x = a_pos.x; - v_pos.y = 1.0 - a_pos.y; -} - -)MBGL_SHADER"; -const char* extrusion_texture::fragmentSource = R"MBGL_SHADER( -uniform sampler2D u_image; -uniform float u_opacity; -varying vec2 v_pos; - -void main() { - gl_FragColor = texture2D(u_image, v_pos) * u_opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(0.0); -#endif -} - -)MBGL_SHADER"; +const char* extrusion_texture::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x4d, 0x8d, 0x41, 0x0a, 0x83, 0x30, + 0x10, 0x45, 0xf7, 0x73, 0x8a, 0x59, 0x6a, 0xb1, + 0xa2, 0xc5, 0x5d, 0xe8, 0x1d, 0x7a, 0x83, 0x90, + 0x56, 0x2b, 0x03, 0x9a, 0x94, 0x98, 0x44, 0x43, + 0xe9, 0xdd, 0x3b, 0x9a, 0x50, 0x3a, 0x9b, 0x99, + 0x79, 0x9f, 0xff, 0xbf, 0xd7, 0xf4, 0x34, 0x76, + 0xc6, 0x59, 0xb9, 0x0e, 0xbd, 0xe4, 0x65, 0x69, + 0x13, 0xe0, 0x33, 0x0e, 0xc3, 0xe3, 0xc2, 0x78, + 0x35, 0x76, 0xea, 0x05, 0x28, 0xc7, 0xea, 0xdd, + 0xbb, 0x21, 0x71, 0x25, 0x5f, 0x66, 0x11, 0x10, + 0x94, 0x8d, 0xa4, 0xc7, 0xc4, 0x42, 0x62, 0x10, + 0x0c, 0xf5, 0x1c, 0x4a, 0xba, 0x28, 0xf1, 0x0d, + 0xc8, 0x33, 0x4e, 0xf2, 0x66, 0x16, 0x72, 0x64, + 0x34, 0x5e, 0x7f, 0x55, 0x78, 0xda, 0x7d, 0x5d, + 0x71, 0x64, 0xf1, 0x93, 0xbb, 0x2a, 0x6c, 0x2a, + 0x6c, 0x4b, 0x0e, 0xda, 0xad, 0x47, 0x68, 0xbd, + 0xb1, 0x4d, 0xa5, 0x4b, 0xfc, 0xe1, 0xc8, 0xb8, + 0xad, 0x1b, 0x3c, 0x67, 0x31, 0x0a, 0xf8, 0xc0, + 0x17, 0xe6, 0x77, 0x44, 0xb1 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* extrusion_texture::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x6d, 0x8e, 0xb1, 0x0a, 0xc2, 0x30, + 0x18, 0x84, 0xf7, 0xff, 0x29, 0x7e, 0xe8, 0xd2, + 0x8a, 0x48, 0x29, 0x6e, 0xc1, 0x41, 0x6c, 0x05, + 0x17, 0x2b, 0x55, 0x74, 0x0c, 0xa1, 0x4d, 0x42, + 0x20, 0x69, 0x4a, 0x9a, 0x04, 0x8b, 0xf8, 0xee, + 0x16, 0xec, 0xe0, 0xe0, 0x8d, 0x77, 0xdc, 0x77, + 0x17, 0x7a, 0x25, 0xac, 0x33, 0x38, 0x32, 0x33, + 0x68, 0xee, 0x8a, 0x12, 0x03, 0x55, 0x86, 0x49, + 0x4e, 0x20, 0x2c, 0x91, 0xd0, 0x96, 0xf9, 0xd9, + 0xb6, 0x03, 0x6b, 0x95, 0x9f, 0x08, 0x44, 0xe6, + 0x26, 0xd5, 0x4b, 0x8c, 0xbc, 0x2d, 0x30, 0xd2, + 0xc1, 0x8e, 0x04, 0x20, 0x5a, 0xd5, 0xa1, 0x61, + 0xaa, 0x4f, 0x33, 0x7c, 0x01, 0xce, 0x92, 0x9a, + 0x1e, 0x1d, 0x93, 0x07, 0xab, 0xad, 0xc3, 0x1d, + 0x7a, 0xfe, 0xf4, 0xc1, 0xf1, 0xa2, 0x4c, 0x97, + 0x85, 0xf5, 0xb7, 0x9b, 0xe1, 0xea, 0x17, 0x0e, + 0x89, 0x12, 0x1d, 0x17, 0x58, 0xdf, 0xab, 0xa6, + 0x6c, 0xf6, 0x0f, 0x7a, 0x3a, 0x5f, 0x2f, 0xd5, + 0xe1, 0x56, 0x37, 0xff, 0xa0, 0xf3, 0x85, 0x6d, + 0x9a, 0x6f, 0xf2, 0x8c, 0x40, 0xc2, 0xfb, 0x4e, + 0x09, 0x78, 0xc3, 0x07, 0x17, 0x5e, 0x44, 0xe1 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill.cpp b/src/mbgl/shaders/fill.cpp index 3ba00836a2..12aa31237b 100644 --- a/src/mbgl/shaders/fill.cpp +++ b/src/mbgl/shaders/fill.cpp @@ -1,91 +1,88 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill::name = "fill"; -const char* fill::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; - -uniform mat4 u_matrix; - - -#ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; -attribute highp vec4 a_color; -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_color - color = unpack_mix_vec4(a_color, a_color_t); -#else - highp vec4 color = u_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - - gl_Position = u_matrix * vec4(a_pos, 0, 1); -} - -)MBGL_SHADER"; -const char* fill::fragmentSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_color -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_color - highp vec4 color = u_color; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - gl_FragColor = color * opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x92, 0x3f, 0x4f, 0xc3, 0x30, + 0x10, 0xc5, 0x77, 0x7f, 0x8a, 0x93, 0xba, 0xa4, + 0x28, 0x03, 0x54, 0xdd, 0x22, 0x06, 0x16, 0x04, + 0x03, 0x7f, 0x04, 0x62, 0x3e, 0x99, 0x24, 0x4e, + 0x4f, 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 0x7c, 0xe9, 0x91, 0xf3, + 0x7a, 0x0a, 0xe3, 0xca, 0x4e, 0x61, 0xba, 0x0e, + 0xa7, 0xd0, 0xce, 0xcc, 0x9f, 0xc0, 0x39, 0x8b, + 0x3f, 0x2f, 0x32, 0x6c, 0x92, 0x80, 0x28, 0x8d, + 0x71, 0xce, 0x72, 0x2c, 0x91, 0x8d, 0x49, 0x96, + 0x68, 0x9c, 0xb9, 0xaa, 0xf1, 0x59, 0xf5, 0xa4, + 0x49, 0xc9, 0xd1, 0xf5, 0xfb, 0xf7, 0xe0, 0x02, + 0xfc, 0x8b, 0xed, 0x07, 0x4d, 0xe1, 0x32, 0x85, + 0x2b, 0x3b, 0xe2, 0x9b, 0xfd, 0x00, 0x83, 0x90, + 0xec, 0xfc + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x75, 0x8f, 0x4f, 0x0b, 0x82, 0x40, + 0x14, 0xc4, 0xef, 0xef, 0x53, 0x3c, 0xf0, 0x62, + 0x1d, 0xa2, 0xa0, 0x5b, 0x74, 0x10, 0x4b, 0xf2, + 0x50, 0x86, 0xf6, 0xe7, 0xb8, 0x2c, 0xea, 0xea, + 0xc2, 0xb6, 0x2b, 0xa6, 0x46, 0x44, 0xdf, 0xbd, + 0xb6, 0xcc, 0x24, 0xed, 0x5d, 0x67, 0xe6, 0xfd, + 0x66, 0xc0, 0xe0, 0x4c, 0x46, 0x31, 0xc3, 0x95, + 0x15, 0x90, 0xfd, 0xc6, 0x75, 0x3c, 0x7f, 0x4d, + 0x4a, 0x12, 0x2a, 0xa1, 0x72, 0xa8, 0x68, 0x7e, + 0xe5, 0x32, 0xc1, 0x94, 0x27, 0x69, 0x86, 0x55, + 0x1c, 0x4e, 0xf1, 0x25, 0xcc, 0xc0, 0x88, 0xc5, + 0x39, 0x86, 0x52, 0x72, 0xa6, 0xf2, 0x53, 0x5b, + 0xaf, 0xa3, 0xda, 0x21, 0x23, 0xce, 0x00, 0xa0, + 0x1f, 0xa0, 0x32, 0x1a, 0xf2, 0xe2, 0xda, 0x20, + 0x84, 0xba, 0x64, 0xc8, 0x84, 0xa2, 0x05, 0xd6, + 0xd2, 0x2f, 0xa4, 0xe5, 0x68, 0xe2, 0x2d, 0x4c, + 0xa5, 0x78, 0x84, 0x27, 0xca, 0xa5, 0x39, 0xc0, + 0x1b, 0xe0, 0xf3, 0x34, 0xf9, 0xdf, 0x32, 0xad, + 0xff, 0xae, 0xc2, 0x79, 0xb7, 0xfd, 0xff, 0x3f, + 0x9f, 0x01, 0xda, 0xd1, 0x2d, 0xff, 0xfa, 0xd5, + 0x2d, 0xa9, 0xcd, 0x89, 0x20, 0x4e, 0x4e, 0x13, + 0xbb, 0x46, 0xbe, 0xd1, 0xc3, 0xef, 0xea, 0x0f, + 0xce, 0x3b, 0x2c, 0xfd, 0x85, 0x6f, 0x1d, 0x89, + 0xbb, 0x09, 0xb6, 0x4b, 0x7b, 0xe7, 0xf9, 0x7d, + 0x71, 0x5d, 0xdf, 0x9c, 0x8c, 0xc6, 0x83, 0x86, + 0x72, 0x87, 0x07, 0x0d, 0x6b, 0x96, 0x59 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill_extrusion.cpp b/src/mbgl/shaders/fill_extrusion.cpp index 5bb2b9cd07..cff544acc1 100644 --- a/src/mbgl/shaders/fill_extrusion.cpp +++ b/src/mbgl/shaders/fill_extrusion.cpp @@ -1,164 +1,179 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill_extrusion::name = "fill_extrusion"; -const char* fill_extrusion::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec3 u_lightcolor; -uniform lowp vec3 u_lightpos; -uniform lowp float u_lightintensity; - -attribute vec2 a_pos; -attribute vec4 a_normal_ed; - -varying vec4 v_color; - - -#ifndef HAS_UNIFORM_u_base -uniform lowp float a_base_t; -attribute lowp vec2 a_base; -varying lowp float base; -#else -uniform lowp float u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height -uniform lowp float a_height_t; -attribute lowp vec2 a_height; -varying lowp float height; -#else -uniform lowp float u_height; -#endif - - - -#ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; -attribute highp vec4 a_color; -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_base - base = unpack_mix_vec2(a_base, a_base_t); -#else - lowp float base = u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height - height = unpack_mix_vec2(a_height, a_height_t); -#else - lowp float height = u_height; -#endif - - -#ifndef HAS_UNIFORM_u_color - color = unpack_mix_vec4(a_color, a_color_t); -#else - highp vec4 color = u_color; -#endif - - - vec3 normal = a_normal_ed.xyz; - - base = max(0.0, base); - height = max(0.0, height); - - float t = mod(normal.x, 2.0); - - gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1); - - // Relative luminance (how dark/bright is the surface color?) - float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722; - - v_color = vec4(0.0, 0.0, 0.0, 1.0); - - // Add slight ambient lighting so no extrusions are totally black - vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0); - color += ambientlight; - - // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray - float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0); - - // Adjust directional so that - // the range of values for highlight/shading is narrower - // with lower light intensity - // and with lighter/brighter surface colors - directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional); - - // Add gradient along z axis of side surfaces - if (normal.y != 0.0) { - directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0); - } - - // Assign final color based on surface + ambient light color, diffuse light directional, and light color - // with lower bounds adjusted to hue of light - // so that shading is tinted with the complementary (opposite) color to the light color - v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0); - v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0); - v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0); -} - -)MBGL_SHADER"; -const char* fill_extrusion::fragmentSource = R"MBGL_SHADER( -varying vec4 v_color; - -#ifndef HAS_UNIFORM_u_base -varying lowp float base; -#else -uniform lowp float u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height -varying lowp float height; -#else -uniform lowp float u_height; -#endif - - -#ifndef HAS_UNIFORM_u_color -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_base - lowp float base = u_base; -#endif - - -#ifdef HAS_UNIFORM_u_height - lowp float height = u_height; -#endif - - -#ifdef HAS_UNIFORM_u_color - highp vec4 color = u_color; -#endif - - - gl_FragColor = v_color; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill_extrusion::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x56, 0xdb, 0x8e, 0xdb, 0x36, + 0x10, 0x7d, 0xf7, 0x57, 0x4c, 0x91, 0x17, 0x39, + 0xab, 0xfa, 0xb6, 0xde, 0x6c, 0xda, 0xc5, 0x26, + 0x08, 0x0a, 0x14, 0xed, 0x43, 0xda, 0x22, 0x45, + 0x9f, 0x05, 0xca, 0xa2, 0x24, 0x26, 0x14, 0x29, + 0x50, 0x94, 0x2f, 0x29, 0xf2, 0xef, 0x19, 0xde, + 0x74, 0x5b, 0xd9, 0xc8, 0x3e, 0x78, 0x2d, 0xce, + 0x70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 0xd6, 0x41, 0x2d, + 0x2f, 0x49, 0xc0, 0x37, 0xb0, 0x79, 0xcb, 0x18, + 0xde, 0xc0, 0xde, 0x26, 0x9d, 0x87, 0x47, 0x77, + 0x94, 0x2c, 0xc3, 0x9e, 0x64, 0x22, 0x5a, 0xc2, + 0xff, 0x0b, 0xc0, 0xbf, 0x5b, 0x42, 0x1b, 0xbb, + 0xf9, 0x02, 0xcf, 0xd0, 0x8a, 0x9a, 0x1c, 0xbe, + 0x24, 0x15, 0x3b, 0x27, 0x86, 0xb7, 0xc8, 0x49, + 0x1a, 0x77, 0xc2, 0x2f, 0x03, 0x0c, 0x73, 0x67, + 0xa2, 0xaf, 0xb9, 0x3e, 0xd1, 0xf1, 0x46, 0x66, + 0xaf, 0xa5, 0xf1, 0x70, 0x5f, 0x67, 0xb3, 0x3b, + 0x53, 0x3c, 0xd0, 0xf7, 0x1a, 0x82, 0x3e, 0xc8, + 0x0b, 0xb1, 0x6e, 0xa0, 0x70, 0x7a, 0x19, 0x07, + 0xfb, 0xed, 0x05, 0x86, 0x7d, 0xe4, 0x85, 0x89, + 0x7b, 0x05, 0x47, 0x08, 0xa6, 0x32, 0x59, 0x00, + 0x53, 0x39, 0x8c, 0xa3, 0x1d, 0x75, 0x37, 0x91, + 0xe8, 0x33, 0x18, 0xce, 0xd5, 0xf9, 0xf2, 0xf5, + 0x69, 0x31, 0x14, 0xa1, 0x22, 0xe7, 0x68, 0xb3, + 0xda, 0xc4, 0xf6, 0x19, 0xb3, 0x8d, 0x38, 0xea, + 0x8c, 0xee, 0x64, 0xe9, 0xaf, 0x3a, 0x12, 0xac, + 0x83, 0xcc, 0x22, 0x17, 0x7c, 0x75, 0x8e, 0x61, + 0xb7, 0xda, 0x04, 0x97, 0x82, 0x27, 0xff, 0x48, + 0xdc, 0x20, 0x4c, 0x0a, 0x8b, 0xd2, 0x2d, 0x2b, + 0x78, 0x0d, 0xbe, 0x4e, 0x5c, 0x22, 0x31, 0x46, + 0x78, 0x07, 0x18, 0x1e, 0xde, 0x87, 0x8c, 0xbf, + 0x82, 0xeb, 0x80, 0x6d, 0x08, 0xb3, 0x5e, 0xc3, + 0x27, 0xca, 0x89, 0x66, 0x47, 0x1c, 0xb0, 0xb6, + 0x62, 0x82, 0x88, 0x03, 0x85, 0xa8, 0x94, 0x27, + 0xc8, 0x88, 0xfa, 0xb2, 0x4e, 0x95, 0xbd, 0xc7, + 0x1a, 0xd0, 0x25, 0x85, 0xa6, 0x55, 0x39, 0x41, + 0xbb, 0xa5, 0xe4, 0xfd, 0x72, 0x80, 0xd5, 0x9e, + 0x1c, 0x09, 0x6f, 0x4d, 0xc9, 0xf6, 0x61, 0xa5, + 0x10, 0xcc, 0x66, 0xb5, 0xdb, 0xee, 0xde, 0xc0, + 0x9d, 0x3f, 0x2a, 0xec, 0xd1, 0xe3, 0xf6, 0x61, + 0xd7, 0x1d, 0xa5, 0xf6, 0x68, 0xf3, 0xb8, 0xdb, + 0x79, 0x44, 0x7e, 0x9d, 0x61, 0x18, 0x5b, 0x89, + 0x65, 0xa7, 0xff, 0xd8, 0xf6, 0x0c, 0x20, 0xf4, + 0x0f, 0x59, 0x06, 0x8d, 0x5d, 0xa8, 0x40, 0xaa, + 0x94, 0x51, 0xa1, 0xc1, 0xaf, 0xd7, 0x02, 0x1a, + 0x89, 0x02, 0x01, 0x3d, 0x6b, 0xd5, 0x36, 0x48, + 0x52, 0x03, 0x44, 0x51, 0xd0, 0x52, 0x13, 0xce, + 0x2f, 0x90, 0x72, 0x6c, 0x8b, 0xa0, 0xe4, 0x3e, + 0x5c, 0xe6, 0x5e, 0x95, 0x90, 0xf8, 0xde, 0x26, + 0xed, 0x3e, 0x5d, 0xee, 0xbe, 0xbd, 0xee, 0x9e, + 0x47, 0x17, 0x7b, 0x58, 0xbf, 0x11, 0x7e, 0x68, + 0x91, 0x54, 0x43, 0x54, 0x13, 0x21, 0x71, 0x9a, + 0x2c, 0x63, 0x38, 0x95, 0xd4, 0x20, 0x30, 0x4f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 0xa6, + 0x74, 0x9a, 0x29, 0xbd, 0x9d, 0x29, 0xfd, 0x81, + 0x4c, 0x69, 0x97, 0xe9, 0xdb, 0xe2, 0x3b, 0xe2, + 0x90, 0x8c, 0xa9 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill_extrusion::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x52, 0xbb, 0x0a, 0xc2, 0x30, + 0x14, 0xdd, 0xf3, 0x15, 0x17, 0x5c, 0x74, 0x11, + 0x05, 0x37, 0x71, 0x10, 0xb5, 0xe8, 0xa0, 0x95, + 0xfa, 0x1a, 0x43, 0xb4, 0x49, 0x1b, 0x88, 0x89, + 0x54, 0x1b, 0x11, 0xf1, 0xdf, 0x6d, 0x9a, 0x50, + 0x35, 0x5a, 0x33, 0xde, 0xf3, 0xe2, 0x1c, 0xa2, + 0x49, 0x76, 0xe3, 0x32, 0x01, 0x4d, 0x0f, 0x3d, + 0xd0, 0xf8, 0xa0, 0x84, 0xca, 0xfa, 0x08, 0x35, + 0x38, 0x93, 0x31, 0x65, 0x30, 0x1d, 0xae, 0xf0, + 0x66, 0x31, 0x0b, 0xc2, 0x68, 0x8e, 0x73, 0xbc, + 0x27, 0x67, 0x8a, 0xb4, 0x53, 0x08, 0x75, 0x3d, + 0x01, 0x13, 0x8a, 0x5c, 0xc0, 0xdc, 0xfb, 0xa8, + 0x41, 0x45, 0x01, 0xe7, 0x92, 0x33, 0x95, 0x1d, + 0xdf, 0x61, 0x2b, 0x34, 0x04, 0x19, 0x73, 0x86, + 0xea, 0xdc, 0x53, 0xca, 0x93, 0xf4, 0xf2, 0xcb, + 0xdf, 0x22, 0x7f, 0x13, 0x5e, 0x94, 0xbf, 0x19, + 0x65, 0xbf, 0x2a, 0x22, 0x2d, 0x34, 0x27, 0x5b, + 0xdd, 0x15, 0xff, 0x4c, 0x78, 0xc3, 0x73, 0x5c, + 0x31, 0x5c, 0x80, 0x56, 0x3c, 0x86, 0x23, 0xe1, + 0xb2, 0xd9, 0x82, 0x3b, 0x82, 0xe2, 0x99, 0xcc, + 0x9a, 0xd1, 0x0c, 0xec, 0x0d, 0x06, 0x83, 0xaf, + 0x61, 0xea, 0x4d, 0xdc, 0x36, 0x9e, 0x8d, 0xbd, + 0x96, 0x46, 0x7e, 0xff, 0x7a, 0x2b, 0x3b, 0x81, + 0xc1, 0xfd, 0xfa, 0xa5, 0x91, 0x5f, 0xd3, 0x10, + 0x13, 0x81, 0x83, 0x8c, 0x24, 0x23, 0x47, 0xfa, + 0xf8, 0x26, 0x26, 0x20, 0xdc, 0x4e, 0xa2, 0x71, + 0x34, 0xdc, 0xe1, 0xd9, 0x62, 0xb5, 0x9c, 0x8c, + 0xd6, 0x61, 0xf4, 0x53, 0x56, 0x04, 0x35, 0xbb, + 0xed, 0x4e, 0xab, 0x72, 0x7f, 0xa0, 0x27, 0xc6, + 0x6e, 0xcd, 0x58 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill_extrusion_pattern.cpp b/src/mbgl/shaders/fill_extrusion_pattern.cpp index 466d0e04fe..d2e3e6d51a 100644 --- a/src/mbgl/shaders/fill_extrusion_pattern.cpp +++ b/src/mbgl/shaders/fill_extrusion_pattern.cpp @@ -1,158 +1,169 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill_extrusion_pattern::name = "fill_extrusion_pattern"; -const char* fill_extrusion_pattern::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_pattern_size_a; -uniform vec2 u_pattern_size_b; -uniform vec2 u_pixel_coord_upper; -uniform vec2 u_pixel_coord_lower; -uniform float u_scale_a; -uniform float u_scale_b; -uniform float u_tile_units_to_pixels; -uniform float u_height_factor; - -uniform vec3 u_lightcolor; -uniform lowp vec3 u_lightpos; -uniform lowp float u_lightintensity; - -attribute vec2 a_pos; -attribute vec4 a_normal_ed; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; -varying vec4 v_lighting; -varying float v_directional; - - -#ifndef HAS_UNIFORM_u_base -uniform lowp float a_base_t; -attribute lowp vec2 a_base; -varying lowp float base; -#else -uniform lowp float u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height -uniform lowp float a_height_t; -attribute lowp vec2 a_height; -varying lowp float height; -#else -uniform lowp float u_height; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_base - base = unpack_mix_vec2(a_base, a_base_t); -#else - lowp float base = u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height - height = unpack_mix_vec2(a_height, a_height_t); -#else - lowp float height = u_height; -#endif - - - vec3 normal = a_normal_ed.xyz; - float edgedistance = a_normal_ed.w; - - base = max(0.0, base); - height = max(0.0, height); - - float t = mod(normal.x, 2.0); - float z = t > 0.0 ? height : base; - - gl_Position = u_matrix * vec4(a_pos, z, 1); - - vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0 - ? a_pos // extrusion top - : vec2(edgedistance, z * u_height_factor); // extrusion side - - v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos); - v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos); - - v_lighting = vec4(0.0, 0.0, 0.0, 1.0); - float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0); - directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional); - - if (normal.y != 0.0) { - directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0); - } - - v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0)); -} - -)MBGL_SHADER"; -const char* fill_extrusion_pattern::fragmentSource = R"MBGL_SHADER( -uniform vec2 u_pattern_tl_a; -uniform vec2 u_pattern_br_a; -uniform vec2 u_pattern_tl_b; -uniform vec2 u_pattern_br_b; -uniform vec2 u_texsize; -uniform float u_mix; - -uniform sampler2D u_image; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; -varying vec4 v_lighting; - - -#ifndef HAS_UNIFORM_u_base -varying lowp float base; -#else -uniform lowp float u_base; -#endif - - -#ifndef HAS_UNIFORM_u_height -varying lowp float height; -#else -uniform lowp float u_height; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_base - lowp float base = u_base; -#endif - - -#ifdef HAS_UNIFORM_u_height - lowp float height = u_height; -#endif - - - vec2 imagecoord = mod(v_pos_a, 1.0); - vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord); - vec4 color1 = texture2D(u_image, pos); - - vec2 imagecoord_b = mod(v_pos_b, 1.0); - vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b); - vec4 color2 = texture2D(u_image, pos2); - - vec4 mixedColor = mix(color1, color2, u_mix); - - gl_FragColor = mixedColor * v_lighting; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill_extrusion_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x55, 0xc9, 0x6e, 0xdb, 0x30, + 0x10, 0xbd, 0xfb, 0x2b, 0x58, 0x04, 0x08, 0xa8, + 0x44, 0x75, 0x9c, 0xd8, 0x69, 0xd3, 0x18, 0x69, + 0xd0, 0x4b, 0xd1, 0x1e, 0xba, 0xa0, 0x45, 0xcf, + 0x04, 0x25, 0x51, 0x0a, 0x51, 0x59, 0x14, 0x24, + 0xca, 0x91, 0x5d, 0xe4, 0xdf, 0x3b, 0xdc, 0x2c, + 0x6a, 0xb1, 0x7b, 0xa9, 0x0f, 0xb6, 0x3c, 0x6f, + 0x96, 0xc7, 0xc7, 0x99, 0x51, 0x53, 0xf0, 0x54, + 0x54, 0x1b, 0xb4, 0xa1, 0x72, 0x85, 0x1a, 0x02, + 0x3f, 0x15, 0x6f, 0xd7, 0xb3, 0xc6, 0x9a, 0xb7, + 0x2c, 0xbe, 0x01, 0x73, 0x49, 0xa5, 0x64, 0x55, + 0x41, 0x6a, 0xbe, 0x67, 0x84, 0x9e, 0x86, 0xa3, + 0x31, 0xcc, 0x5b, 0x96, 0x93, 0x58, 0x88, 0x2a, + 0x21, 0x4d, 0x59, 0xb2, 0xea, 0xa4, 0x47, 0x2e, + 0x9e, 0x7d, 0x8f, 0x34, 0x17, 0x54, 0x82, 0x4b, + 0x1d, 0xd3, 0xbc, 0x57, 0xbb, 0x0f, 0x44, 0x63, + 0x40, 0x72, 0xb0, 0x83, 0x51, 0xd6, 0x44, 0x0a, + 0x53, 0xa2, 0x1e, 0x7b, 0x3d, 0x31, 0x9e, 0x3d, + 0x49, 0x92, 0xd2, 0x58, 0x0a, 0x28, 0xeb, 0x33, + 0x5b, 0x02, 0x9c, 0x2b, 0x34, 0x16, 0xb9, 0xf0, + 0x28, 0x01, 0xc3, 0xb2, 0x87, 0x97, 0xa2, 0x1e, + 0xa0, 0x2e, 0xbb, 0x86, 0x79, 0x21, 0x59, 0x51, + 0x73, 0xb9, 0x83, 0xf4, 0xa0, 0x54, 0xc5, 0xa3, + 0x46, 0x32, 0x73, 0x74, 0x4a, 0x74, 0x6c, 0xcf, + 0xba, 0x02, 0x6b, 0x01, 0x99, 0x68, 0x4e, 0x58, + 0x02, 0x21, 0x5b, 0x5a, 0xed, 0x78, 0x91, 0x99, + 0x80, 0xad, 0x0a, 0x50, 0x32, 0x4c, 0x58, 0xa3, + 0x9e, 0x75, 0x05, 0x56, 0x5b, 0x3e, 0xeb, 0x00, + 0x43, 0x6c, 0x4b, 0x12, 0x5e, 0xb1, 0x58, 0x72, + 0x51, 0xd0, 0x1c, 0x4a, 0xcc, 0xce, 0x78, 0x5a, + 0x24, 0x2c, 0x45, 0x9f, 0x3e, 0xfc, 0x24, 0xbf, + 0xbe, 0x7e, 0xfe, 0xf8, 0xed, 0xc7, 0x17, 0xd2, + 0x90, 0x88, 0xd6, 0x6c, 0xea, 0x5c, 0x54, 0x23, + 0x44, 0xfa, 0xc4, 0x9d, 0x28, 0x37, 0x16, 0xed, + 0x4a, 0x7a, 0x81, 0x06, 0x38, 0x83, 0x8b, 0x60, + 0xd3, 0x7a, 0x39, 0x87, 0x22, 0xe1, 0xe9, 0x51, + 0x5a, 0xe6, 0xca, 0xa6, 0x89, 0xd9, 0xeb, 0x3c, + 0x4a, 0xcd, 0xe0, 0x93, 0xe4, 0x1c, 0x74, 0x82, + 0x5e, 0xe7, 0x62, 0x09, 0x6e, 0x05, 0x4f, 0x60, + 0x76, 0x78, 0x81, 0x03, 0xf4, 0x67, 0x86, 0xe0, + 0x73, 0x4a, 0x4a, 0x85, 0xab, 0x07, 0xf4, 0x80, + 0x9a, 0xa2, 0xa4, 0xf1, 0x6f, 0xb2, 0xe1, 0x2d, + 0x51, 0xcc, 0xb0, 0x11, 0x2d, 0x3c, 0x48, 0x1b, + 0x38, 0x1e, 0x2a, 0x66, 0xa0, 0xa0, 0x0a, 0x1f, + 0x28, 0x75, 0xa2, 0xb2, 0x55, 0x4b, 0x79, 0x98, + 0xc7, 0xc9, 0xea, 0x06, 0x0a, 0x3d, 0x05, 0x8f, + 0x31, 0xe8, 0x92, 0x8c, 0xe5, 0x50, 0xae, 0x7a, + 0x30, 0x4c, 0xff, 0x82, 0x93, 0xd7, 0xca, 0xf3, + 0x76, 0xb7, 0x5f, 0x6b, 0x17, 0x93, 0x88, 0x25, + 0x19, 0x4b, 0x78, 0x2d, 0x69, 0x11, 0xb3, 0x81, + 0xe7, 0xf3, 0x7a, 0xe6, 0x8b, 0xb5, 0xa1, 0x2d, + 0x5e, 0xcc, 0x17, 0xa1, 0xfe, 0x1f, 0xac, 0xfb, + 0x67, 0x39, 0x80, 0xc6, 0x12, 0xd8, 0x50, 0x53, + 0x43, 0x3b, 0x88, 0x04, 0x9b, 0xd4, 0xf3, 0x36, + 0x44, 0x37, 0xf3, 0x45, 0xe0, 0xb3, 0xd8, 0x83, + 0x87, 0x44, 0xef, 0x11, 0xa4, 0x40, 0x8f, 0x2e, + 0xeb, 0xbd, 0xed, 0x54, 0xed, 0x97, 0xe5, 0xe4, + 0xbb, 0x80, 0xf1, 0x85, 0x61, 0xd1, 0xa7, 0x36, + 0x3b, 0x12, 0x5d, 0xe8, 0x21, 0xc3, 0x7a, 0x82, + 0x43, 0xb4, 0x0f, 0xd1, 0xb5, 0x2b, 0xad, 0x5b, + 0x0d, 0xac, 0xe0, 0xed, 0xea, 0xa2, 0x87, 0x07, + 0x74, 0x0d, 0x15, 0xce, 0xcf, 0x9d, 0x69, 0xa7, + 0x4c, 0x8b, 0x9e, 0x69, 0xaf, 0xbd, 0xde, 0x2c, + 0xef, 0x56, 0xf3, 0x85, 0x4e, 0xa4, 0x3e, 0x8f, + 0x66, 0x47, 0xa0, 0xab, 0x2b, 0xc4, 0x5a, 0x59, + 0x35, 0xb5, 0xa2, 0x21, 0x45, 0x79, 0x70, 0xb8, + 0xd7, 0xf5, 0xb0, 0xaf, 0x26, 0xd0, 0x01, 0x7a, + 0x83, 0xdd, 0x16, 0xac, 0xfb, 0x39, 0x6a, 0x9e, + 0x30, 0xcb, 0xd7, 0xec, 0x14, 0xa0, 0x9b, 0x31, + 0x79, 0x58, 0xe6, 0x60, 0xc3, 0x13, 0xbb, 0x3b, + 0x9c, 0x5a, 0xd7, 0x61, 0xb7, 0xa0, 0x75, 0xe1, + 0xfe, 0xfb, 0x22, 0x3c, 0xb2, 0x8c, 0x43, 0x25, + 0x92, 0xbd, 0x0c, 0xbb, 0xc1, 0xfe, 0x0b, 0x87, + 0x68, 0xcc, 0x21, 0xfa, 0x17, 0x07, 0x4b, 0xc2, + 0x2d, 0x4c, 0xe0, 0xa1, 0x6f, 0x57, 0x37, 0x56, + 0xf7, 0x75, 0x3d, 0x68, 0x1e, 0x6f, 0x8b, 0x42, + 0x44, 0x9c, 0xd3, 0x4d, 0x89, 0x13, 0x21, 0x6d, + 0xbb, 0xa1, 0x2b, 0x7d, 0x9b, 0x4b, 0x15, 0xd9, + 0xbd, 0x29, 0x82, 0x51, 0xae, 0x7e, 0x16, 0x18, + 0x4a, 0x8c, 0x55, 0xaf, 0xbc, 0x1e, 0xbd, 0x3f, + 0x20, 0x54, 0x75, 0x3b, 0xb0, 0xba, 0x45, 0x97, + 0x53, 0xa8, 0xca, 0x19, 0xfa, 0xf9, 0xdc, 0xc9, + 0x78, 0x8a, 0xf0, 0xa1, 0xf1, 0x5e, 0xe9, 0xc6, + 0x73, 0x0b, 0x6b, 0xc8, 0xe0, 0xc2, 0x1d, 0x04, + 0x4b, 0x28, 0xa2, 0x27, 0x0e, 0xf4, 0x2c, 0xc5, + 0x33, 0xb6, 0xc3, 0x01, 0xa7, 0xba, 0xb5, 0x92, + 0xdc, 0x2a, 0x46, 0x5c, 0xcd, 0xdf, 0x5b, 0xf5, + 0xf7, 0xdd, 0x9d, 0xa6, 0x30, 0xcd, 0xbc, 0x3b, + 0xef, 0xcb, 0x50, 0xed, 0x79, 0x95, 0x45, 0xe8, + 0xf2, 0x20, 0xa0, 0x4f, 0xa6, 0xf7, 0x0a, 0x36, + 0xc5, 0xd4, 0x82, 0x51, 0x17, 0x03, 0x39, 0xed, + 0xe3, 0x32, 0x18, 0xd4, 0xd5, 0xde, 0x0e, 0x57, + 0x85, 0xa1, 0xf2, 0xcb, 0xec, 0x2f, 0xc0, 0xf5, + 0xee, 0x94 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill_extrusion_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x93, 0xcb, 0x6e, 0x83, 0x30, + 0x10, 0x45, 0xf7, 0x7c, 0x85, 0xa5, 0x6c, 0x48, + 0x85, 0xda, 0x06, 0x65, 0x87, 0xba, 0x88, 0xf2, + 0x50, 0xb3, 0x68, 0x52, 0x91, 0x3e, 0x96, 0x96, + 0x1d, 0x0c, 0xb1, 0x64, 0x30, 0x32, 0x8f, 0xa6, + 0xad, 0xfa, 0xef, 0xb5, 0x63, 0x27, 0x84, 0x60, + 0x60, 0xc7, 0xdc, 0x3b, 0x77, 0x8e, 0xf1, 0x50, + 0x65, 0x34, 0xe6, 0x22, 0x05, 0x35, 0xd9, 0xfb, + 0xa0, 0x82, 0x39, 0x2a, 0x4b, 0x22, 0x32, 0x58, + 0x32, 0x88, 0x02, 0xa7, 0xb2, 0x8b, 0x58, 0x0c, + 0x88, 0xb2, 0x13, 0x0f, 0x75, 0x76, 0xc5, 0x92, + 0x1c, 0x0b, 0xfa, 0x43, 0x9a, 0x7a, 0xcc, 0x38, + 0x2a, 0xa5, 0x90, 0xd2, 0x63, 0xe0, 0x5c, 0xaa, + 0x05, 0x4a, 0x73, 0x46, 0x84, 0xbf, 0x90, 0x0a, + 0x4d, 0x51, 0x22, 0x1b, 0x9c, 0x1a, 0x89, 0x6f, + 0x9a, 0x25, 0x3a, 0xa9, 0x86, 0x39, 0x2f, 0x14, + 0x99, 0xa5, 0x8a, 0x5b, 0xd5, 0xa9, 0xac, 0x32, + 0x9a, 0x1c, 0x4a, 0xf9, 0x2e, 0x53, 0x9c, 0x11, + 0x8d, 0xb3, 0x88, 0xc4, 0xe0, 0x79, 0xb6, 0x83, + 0xef, 0x9b, 0xf5, 0x6a, 0x1b, 0xbe, 0xc0, 0x0a, + 0x62, 0x54, 0x90, 0x4b, 0x17, 0xe3, 0x5f, 0xb9, + 0x01, 0x53, 0xf5, 0xc0, 0x19, 0x11, 0x26, 0xe5, + 0x33, 0xdc, 0x95, 0xac, 0x1b, 0x95, 0x21, 0x8b, + 0x68, 0xdc, 0x9b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0xdb, + 0x86, 0xb6, 0x18, 0x05, 0xe2, 0xea, 0xef, 0x63, + 0x16, 0xe0, 0xcf, 0xf9, 0x07, 0xbd, 0xf2, 0x75, + 0x6c + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill_outline.cpp b/src/mbgl/shaders/fill_outline.cpp index 9ade598d10..367ff7580c 100644 --- a/src/mbgl/shaders/fill_outline.cpp +++ b/src/mbgl/shaders/fill_outline.cpp @@ -1,99 +1,104 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill_outline::name = "fill_outline"; -const char* fill_outline::vertexSource = R"MBGL_SHADER( -attribute vec2 a_pos; - -uniform mat4 u_matrix; -uniform vec2 u_world; - -varying vec2 v_pos; - - -#ifndef HAS_UNIFORM_u_outline_color -uniform lowp float a_outline_color_t; -attribute highp vec4 a_outline_color; -varying highp vec4 outline_color; -#else -uniform highp vec4 u_outline_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_outline_color - outline_color = unpack_mix_vec4(a_outline_color, a_outline_color_t); -#else - highp vec4 outline_color = u_outline_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - - gl_Position = u_matrix * vec4(a_pos, 0, 1); - v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world; -} - -)MBGL_SHADER"; -const char* fill_outline::fragmentSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_outline_color -varying highp vec4 outline_color; -#else -uniform highp vec4 u_outline_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -varying vec2 v_pos; - -void main() { - -#ifdef HAS_UNIFORM_u_outline_color - highp vec4 outline_color = u_outline_color; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - float dist = length(v_pos - gl_FragCoord.xy); - float alpha = 1.0 - smoothstep(0.0, 1.0, dist); - gl_FragColor = outline_color * (alpha * opacity); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill_outline::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x93, 0xcf, 0x4f, 0x83, 0x30, + 0x14, 0xc7, 0xef, 0xfc, 0x15, 0x2f, 0xd9, 0x85, + 0x29, 0x41, 0xb6, 0xec, 0x46, 0x3c, 0x78, 0x31, + 0x7a, 0xf0, 0x47, 0x34, 0x9e, 0x5f, 0xea, 0x80, + 0xed, 0xc5, 0xae, 0x25, 0xac, 0x85, 0x2d, 0xc6, + 0xff, 0xdd, 0x16, 0xb0, 0x16, 0x08, 0x46, 0x2e, + 0x90, 0xd7, 0x4f, 0x5f, 0x3f, 0xfd, 0xb6, 0x30, + 0xa5, 0x2a, 0x7a, 0xd7, 0x2a, 0x87, 0x3a, 0xdf, + 0xae, 0x81, 0x61, 0x29, 0x8f, 0x69, 0x10, 0x68, + 0x41, 0x85, 0xac, 0x0e, 0x70, 0x60, 0x6a, 0x03, + 0x1a, 0xcd, 0xab, 0xa2, 0x53, 0xea, 0xca, 0x2d, + 0xab, 0xb1, 0x91, 0x15, 0xcf, 0x0c, 0x5d, 0xb3, + 0xea, 0x4c, 0x62, 0xd7, 0x95, 0xeb, 0xbe, 0x45, + 0xb0, 0xa0, 0x42, 0x64, 0x79, 0x01, 0x77, 0x37, + 0xaf, 0xf8, 0xf6, 0x78, 0x7f, 0xfb, 0xf4, 0xf2, + 0x80, 0x1a, 0xa5, 0x56, 0x9c, 0x44, 0x8e, 0x5b, + 0xc9, 0x65, 0xe5, 0x1a, 0x72, 0xd9, 0x94, 0x50, + 0x70, 0xc9, 0x94, 0x51, 0x18, 0x20, 0xa8, 0xd2, + 0x80, 0x39, 0xc9, 0x3d, 0xed, 0xf6, 0xa5, 0x5d, + 0x67, 0x33, 0xe6, 0x52, 0x67, 0xe1, 0x31, 0x23, + 0x62, 0x91, 0xf3, 0x63, 0xee, 0xd6, 0xf4, 0x38, + 0x8d, 0x13, 0x52, 0x64, 0x54, 0xcc, 0x6f, 0xa2, + 0x64, 0x5b, 0x52, 0xe7, 0x19, 0xfd, 0x6e, 0x70, + 0x28, 0xde, 0x12, 0x7d, 0xc4, 0x3d, 0xf0, 0x6b, + 0xec, 0x4d, 0x77, 0x63, 0x43, 0x57, 0x8f, 0xd0, + 0xe8, 0x31, 0xbd, 0x65, 0x2d, 0x29, 0x33, 0x67, + 0x45, 0x22, 0x5c, 0xc2, 0x67, 0x00, 0xe6, 0xf9, + 0x57, 0xfa, 0x16, 0x1c, 0x54, 0xe0, 0x1a, 0xb4, + 0x30, 0xdd, 0x3f, 0xf0, 0x40, 0x27, 0xb4, 0xd1, + 0x84, 0xa3, 0x98, 0xa3, 0xe9, 0xf9, 0x2c, 0x7f, + 0x64, 0x6d, 0xbb, 0xb9, 0xf0, 0x6d, 0xe7, 0xb9, + 0x90, 0xff, 0xf2, 0xed, 0x83, 0x6e, 0x4d, 0xbb, + 0xef, 0x89, 0xe3, 0x3a, 0x74, 0x91, 0x46, 0x7e, + 0xfc, 0x03, 0xaf, 0x69, 0xc4, 0x9d, 0xd1, 0x24, + 0x4a, 0x0b, 0xef, 0x38, 0x3e, 0xcb, 0x23, 0x29, + 0x92, 0xa2, 0xa5, 0xba, 0xeb, 0x0f, 0x17, 0xd0, + 0x27, 0x62, 0x2e, 0x78, 0x04, 0x49, 0x04, 0x2b, + 0xb3, 0x84, 0xe5, 0xdb, 0x2b, 0x6f, 0xc8, 0xd0, + 0x9b, 0x18, 0x9f, 0xce, 0x70, 0xe5, 0x77, 0x8a, + 0x1b, 0xb8, 0x84, 0x55, 0x9c, 0x2c, 0x4d, 0x79, + 0x1d, 0x27, 0xa6, 0x9b, 0xfb, 0x81, 0xbe, 0x82, + 0x6f, 0xd3, 0x48, 0x35, 0x91 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill_outline::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x85, 0x90, 0x5f, 0x4f, 0x83, 0x30, + 0x14, 0xc5, 0xdf, 0xfb, 0x29, 0x6e, 0xb2, 0x17, + 0x58, 0x26, 0x41, 0xe3, 0x1b, 0xf1, 0x61, 0x99, + 0x5b, 0xdc, 0x83, 0xc3, 0x30, 0x75, 0x8f, 0x4d, + 0x03, 0x05, 0x9a, 0x94, 0xb6, 0x81, 0x0e, 0x25, + 0xc6, 0xef, 0x6e, 0x3b, 0xfe, 0x84, 0x6d, 0xa2, + 0x7d, 0xbc, 0xfd, 0x9d, 0x73, 0xee, 0xb9, 0x68, + 0xc6, 0x52, 0x91, 0xd0, 0x14, 0x9e, 0x96, 0x7b, + 0xfc, 0xb6, 0xdb, 0x6e, 0xc2, 0xe8, 0x19, 0x1f, + 0xb1, 0x3c, 0x6a, 0xce, 0x04, 0xc5, 0xb1, 0xe4, + 0xb2, 0x44, 0x35, 0x29, 0x1b, 0x26, 0x32, 0xc8, + 0x59, 0x96, 0x2b, 0xa8, 0x69, 0x7c, 0x0f, 0x67, + 0x40, 0x80, 0x66, 0x94, 0x57, 0x14, 0x1d, 0x05, + 0x4b, 0x65, 0x59, 0x8c, 0xb9, 0x0b, 0x2b, 0x4b, + 0x8a, 0x84, 0xa5, 0x08, 0xa1, 0x89, 0x60, 0x45, + 0x62, 0xa6, 0x9b, 0x21, 0x92, 0xcb, 0x0f, 0x05, + 0x29, 0x97, 0x44, 0x43, 0xf7, 0x75, 0x19, 0x36, + 0x22, 0x06, 0xf9, 0x28, 0xa6, 0x37, 0x32, 0xdb, + 0xdc, 0x41, 0x8d, 0x95, 0xac, 0x02, 0x33, 0x94, + 0x2c, 0x81, 0x82, 0x30, 0xe1, 0xb8, 0xf0, 0x85, + 0xc0, 0x3c, 0xbb, 0xce, 0x7f, 0x67, 0xb0, 0xdc, + 0xd4, 0x09, 0xe0, 0x61, 0xba, 0xea, 0x1f, 0xfe, + 0x5d, 0x5b, 0x4b, 0x5c, 0x37, 0x6d, 0x3d, 0xaf, + 0x1a, 0x59, 0xb8, 0xe5, 0x12, 0x56, 0x69, 0x03, + 0x71, 0x2a, 0x32, 0x9d, 0x3b, 0xa7, 0x72, 0x70, + 0x03, 0x19, 0xc7, 0x9b, 0x92, 0x64, 0x2b, 0x29, + 0xcb, 0xc4, 0xfb, 0x6c, 0xdc, 0x60, 0xa4, 0x20, + 0x5c, 0xe5, 0xc4, 0x48, 0x6e, 0x3d, 0xdf, 0x90, + 0x55, 0x21, 0xa5, 0xce, 0x2b, 0x4d, 0x95, 0xe3, + 0x7b, 0xfe, 0xc2, 0x4e, 0x17, 0x27, 0xd3, 0x4e, + 0x33, 0x38, 0xb5, 0x05, 0xcf, 0x0b, 0xcf, 0xc1, + 0x69, 0xdd, 0xe6, 0xfd, 0xbe, 0x46, 0xd5, 0xd7, + 0x0c, 0xdf, 0xd7, 0xd1, 0x63, 0xb4, 0x3c, 0xe0, + 0xed, 0x6e, 0xff, 0xb2, 0x5e, 0xbd, 0x86, 0xd1, + 0x6f, 0x86, 0xf6, 0x8c, 0x8e, 0x09, 0x75, 0x87, + 0x76, 0xdf, 0xe8, 0x07, 0x2a, 0x68, 0xd6, 0xbe + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill_outline_pattern.cpp b/src/mbgl/shaders/fill_outline_pattern.cpp index 11cddb7d07..b1a19afee5 100644 --- a/src/mbgl/shaders/fill_outline_pattern.cpp +++ b/src/mbgl/shaders/fill_outline_pattern.cpp @@ -1,107 +1,128 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill_outline_pattern::name = "fill_outline_pattern"; -const char* fill_outline_pattern::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_world; -uniform vec2 u_pattern_size_a; -uniform vec2 u_pattern_size_b; -uniform vec2 u_pixel_coord_upper; -uniform vec2 u_pixel_coord_lower; -uniform float u_scale_a; -uniform float u_scale_b; -uniform float u_tile_units_to_pixels; - -attribute vec2 a_pos; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; -varying vec2 v_pos; - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - - gl_Position = u_matrix * vec4(a_pos, 0, 1); - - v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos); - v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos); - - v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world; -} - -)MBGL_SHADER"; -const char* fill_outline_pattern::fragmentSource = R"MBGL_SHADER( -uniform vec2 u_pattern_tl_a; -uniform vec2 u_pattern_br_a; -uniform vec2 u_pattern_tl_b; -uniform vec2 u_pattern_br_b; -uniform vec2 u_texsize; -uniform float u_mix; - -uniform sampler2D u_image; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; -varying vec2 v_pos; - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - vec2 imagecoord = mod(v_pos_a, 1.0); - vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord); - vec4 color1 = texture2D(u_image, pos); - - vec2 imagecoord_b = mod(v_pos_b, 1.0); - vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b); - vec4 color2 = texture2D(u_image, pos2); - - // find distance to outline for alpha interpolation - - float dist = length(v_pos - gl_FragCoord.xy); - float alpha = 1.0 - smoothstep(0.0, 1.0, dist); - - - gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill_outline_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x93, 0xbd, 0x6e, 0x83, 0x30, + 0x14, 0x85, 0x77, 0x9e, 0xc2, 0x52, 0x17, 0xd2, + 0x22, 0x9a, 0x44, 0xd9, 0xa2, 0x0e, 0x5d, 0xaa, + 0x76, 0xe8, 0x8f, 0x5a, 0x75, 0xbe, 0x32, 0x60, + 0xa2, 0xab, 0x12, 0x1b, 0x19, 0x9b, 0x90, 0x56, + 0x7d, 0xf7, 0x5e, 0x03, 0x01, 0x52, 0x68, 0xb2, + 0x94, 0x05, 0x74, 0xee, 0x31, 0xe7, 0xb3, 0x39, + 0x58, 0x89, 0xa9, 0xd2, 0x5b, 0xb6, 0xe5, 0x66, + 0xc5, 0x2c, 0xd0, 0x4d, 0x63, 0xb5, 0xf6, 0x6c, + 0x2b, 0x97, 0x22, 0x5e, 0x92, 0xbc, 0x53, 0x3a, + 0x4b, 0x46, 0x6a, 0xce, 0x8d, 0x11, 0x5a, 0x42, + 0x81, 0x9f, 0x02, 0xf8, 0xe9, 0x71, 0x34, 0x1e, + 0x63, 0x25, 0x32, 0x88, 0x95, 0xd2, 0x09, 0xd8, + 0x3c, 0x17, 0xfa, 0xa4, 0x23, 0x53, 0xbb, 0xa1, + 0x23, 0xcd, 0x14, 0x37, 0x64, 0x29, 0x62, 0x9e, + 0x1d, 0x65, 0x1f, 0x0f, 0xa2, 0xf1, 0xc0, 0x20, + 0xe9, 0x24, 0x9a, 0x02, 0x8c, 0x6a, 0x22, 0x8a, + 0xb5, 0xe7, 0x11, 0xab, 0xc6, 0xc8, 0x1a, 0xd1, + 0x84, 0x73, 0xc8, 0x95, 0x93, 0x4b, 0xae, 0xf7, + 0x28, 0x37, 0x8d, 0x58, 0x3a, 0xd1, 0x85, 0x4d, + 0xa8, 0xd1, 0x94, 0x4a, 0x2f, 0xf0, 0x2e, 0x30, + 0x95, 0x89, 0x48, 0xd9, 0xfd, 0xed, 0x1b, 0xbc, + 0x3f, 0x3d, 0xdc, 0x3d, 0xbf, 0x3e, 0x82, 0x05, + 0x95, 0xf3, 0x18, 0xcd, 0xbe, 0xa3, 0xa3, 0xed, + 0xe5, 0x2d, 0x22, 0x3f, 0x0c, 0xc1, 0xac, 0x07, + 0x58, 0xb5, 0xa3, 0x65, 0x6b, 0x0d, 0x7d, 0xe4, + 0x60, 0x79, 0x37, 0xbb, 0xa0, 0x8d, 0x89, 0xa9, + 0x00, 0x0b, 0x03, 0x8f, 0x4c, 0x30, 0x25, 0xca, + 0x52, 0x61, 0x42, 0x1d, 0x40, 0xe9, 0xcf, 0xd8, + 0x97, 0xc7, 0xe8, 0x3a, 0x03, 0xee, 0x2c, 0xed, + 0x33, 0xbb, 0x61, 0x56, 0xd2, 0xe3, 0x07, 0x6c, + 0xb1, 0x02, 0x87, 0xe8, 0x77, 0x88, 0xc1, 0x70, + 0x3b, 0xb3, 0x03, 0x94, 0x5b, 0x3c, 0x46, 0x76, + 0xef, 0x99, 0x40, 0x73, 0xe6, 0x4d, 0x06, 0x2f, + 0xaa, 0x40, 0x83, 0x4a, 0xd6, 0xae, 0xa6, 0xa6, + 0xec, 0xd2, 0x1d, 0xc8, 0xca, 0xaf, 0x3f, 0x56, + 0xc0, 0xe6, 0x01, 0x5b, 0x50, 0x44, 0xbd, 0xa0, + 0xfd, 0x54, 0x64, 0xde, 0x08, 0xd3, 0x35, 0x91, + 0x34, 0x7f, 0xa2, 0x78, 0xc1, 0x54, 0xd7, 0x82, + 0xbe, 0x5d, 0x94, 0xf3, 0xbb, 0xec, 0xc1, 0x1f, + 0x4d, 0x0a, 0x9a, 0xe6, 0x10, 0x46, 0x4f, 0x11, + 0xfd, 0x0b, 0x45, 0x34, 0xa6, 0x88, 0xce, 0x53, + 0xf4, 0x18, 0x04, 0xe1, 0x0f, 0x8e, 0x31, 0xac, + 0xf6, 0xec, 0x7a, 0x78, 0xae, 0xe1, 0x8e, 0x5d, + 0xb1, 0x45, 0x38, 0x9f, 0x91, 0xbc, 0x0c, 0xe7, + 0x75, 0x5a, 0xfb, 0xdb, 0x7f, 0x7b, 0x3f, 0xaa, + 0x6d, 0x77, 0x06 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill_outline_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x53, 0x4b, 0x6f, 0xdb, 0x30, + 0x0c, 0xbe, 0xfb, 0x57, 0x10, 0xe8, 0xc5, 0x29, + 0xbc, 0x24, 0x35, 0x76, 0x0b, 0x7a, 0x28, 0x9a, + 0x16, 0xeb, 0x61, 0xcd, 0x90, 0xee, 0x71, 0x14, + 0x64, 0x5b, 0x76, 0x04, 0xc8, 0xa2, 0x21, 0xcb, + 0x59, 0xb2, 0x61, 0xff, 0x7d, 0x94, 0xa5, 0xda, + 0xcb, 0xe2, 0xc4, 0x47, 0xf2, 0x7b, 0x91, 0x94, + 0x3b, 0x2d, 0x4b, 0x34, 0x35, 0xec, 0x45, 0x9e, + 0x42, 0xc7, 0x1a, 0x6e, 0xad, 0x30, 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, 0x72, 0x54, 0x68, 0xee, 0x48, 0x9a, 0x70, + 0xb6, 0x33, 0x22, 0x5d, 0xc7, 0xe1, 0x58, 0x89, + 0xf3, 0x24, 0xe8, 0x54, 0x58, 0x96, 0x9d, 0xc4, + 0xcd, 0xa6, 0xe2, 0xa6, 0x53, 0x79, 0xb3, 0x2b, + 0x79, 0xb3, 0x4b, 0x79, 0x59, 0x76, 0x96, 0x38, + 0xbd, 0x98, 0x38, 0x7d, 0x8f, 0xbc, 0x58, 0x40, + 0x29, 0x75, 0x01, 0x85, 0x6c, 0x2d, 0xd7, 0xb9, + 0x00, 0x8b, 0x80, 0x9d, 0x55, 0x52, 0x0b, 0xa0, + 0x07, 0x00, 0x5c, 0x35, 0x3b, 0x0e, 0x52, 0x93, + 0x7d, 0x83, 0x8a, 0x5b, 0x89, 0xda, 0x13, 0xfd, + 0x01, 0x1d, 0x8d, 0x4c, 0x94, 0xd0, 0x95, 0xdd, + 0xf9, 0x39, 0xe1, 0x03, 0x54, 0x8a, 0x3d, 0x1b, + 0x5e, 0x3d, 0xba, 0x58, 0xf3, 0xc3, 0x31, 0xe4, + 0xf2, 0x0c, 0x2f, 0x78, 0xef, 0x56, 0x41, 0xc8, + 0xb6, 0x46, 0xb4, 0xbb, 0xd6, 0x8a, 0x26, 0x5e, + 0xce, 0x97, 0xfd, 0x82, 0x92, 0x5e, 0xd4, 0xe5, + 0xeb, 0x59, 0x83, 0x16, 0xcd, 0x13, 0x76, 0xe5, + 0xaf, 0x91, 0x84, 0x19, 0x13, 0xff, 0x47, 0xcd, + 0xe0, 0x36, 0x68, 0xdf, 0x8e, 0x6f, 0xf9, 0xfd, + 0x31, 0x6e, 0xbe, 0x3f, 0x6d, 0xd7, 0xdb, 0x87, + 0x1f, 0xec, 0xe5, 0xf5, 0xed, 0xcb, 0xd3, 0xe3, + 0xd7, 0xcd, 0x76, 0x4a, 0xdb, 0x2d, 0x2e, 0xf6, + 0x27, 0x0a, 0x6f, 0xf0, 0x4f, 0xf4, 0x17, 0x5b, + 0x20, 0x6a, 0x67 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/fill_pattern.cpp b/src/mbgl/shaders/fill_pattern.cpp index a3817c4426..f556fc876e 100644 --- a/src/mbgl/shaders/fill_pattern.cpp +++ b/src/mbgl/shaders/fill_pattern.cpp @@ -1,96 +1,111 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* fill_pattern::name = "fill_pattern"; -const char* fill_pattern::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_pattern_size_a; -uniform vec2 u_pattern_size_b; -uniform vec2 u_pixel_coord_upper; -uniform vec2 u_pixel_coord_lower; -uniform float u_scale_a; -uniform float u_scale_b; -uniform float u_tile_units_to_pixels; - -attribute vec2 a_pos; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - - gl_Position = u_matrix * vec4(a_pos, 0, 1); - - v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos); - v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos); -} - -)MBGL_SHADER"; -const char* fill_pattern::fragmentSource = R"MBGL_SHADER( -uniform vec2 u_pattern_tl_a; -uniform vec2 u_pattern_br_a; -uniform vec2 u_pattern_tl_b; -uniform vec2 u_pattern_br_b; -uniform vec2 u_texsize; -uniform float u_mix; - -uniform sampler2D u_image; - -varying vec2 v_pos_a; -varying vec2 v_pos_b; - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - vec2 imagecoord = mod(v_pos_a, 1.0); - vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord); - vec4 color1 = texture2D(u_image, pos); - - vec2 imagecoord_b = mod(v_pos_b, 1.0); - vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b); - vec4 color2 = texture2D(u_image, pos2); - - gl_FragColor = mix(color1, color2, u_mix) * opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* fill_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x92, 0xbd, 0x6e, 0x83, 0x30, + 0x14, 0x85, 0x77, 0x3f, 0x85, 0xa5, 0x2c, 0xa4, + 0xf2, 0xd0, 0x56, 0xd9, 0x50, 0x87, 0x2e, 0x55, + 0x3b, 0xf4, 0x47, 0xad, 0x3a, 0x5f, 0x19, 0x30, + 0xe8, 0xaa, 0xc4, 0x46, 0xc6, 0xa6, 0x49, 0xab, + 0xbe, 0x7b, 0xaf, 0x81, 0x10, 0x52, 0x48, 0xb2, + 0x94, 0x05, 0xeb, 0xdc, 0x63, 0xce, 0x67, 0x7c, + 0xbc, 0xc6, 0xdc, 0xd8, 0x35, 0x5f, 0x4b, 0xb7, + 0xe2, 0x1e, 0xe8, 0x65, 0x71, 0x13, 0x33, 0xdf, + 0xcb, 0x8d, 0x4a, 0xaf, 0x49, 0xae, 0xa4, 0x73, + 0xca, 0x6a, 0xa8, 0xf1, 0x4b, 0x81, 0x3c, 0x3d, + 0x4e, 0xa6, 0x63, 0xdc, 0xa8, 0x12, 0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1, 0x87, 0xac, 0xa2, 0xf6, 0x62, 0x04, + 0xbf, 0x14, 0xfc, 0x8a, 0x22, 0xda, 0x0d, 0xfd, + 0xb5, 0x90, 0xb9, 0x50, 0x6e, 0x68, 0x1d, 0x69, + 0xd1, 0x4c, 0xc9, 0xc4, 0x5c, 0xaf, 0xc4, 0xbe, + 0x49, 0x94, 0xf3, 0xb7, 0xd8, 0xe2, 0x48, 0x6b, + 0x44, 0xd7, 0x12, 0xc2, 0xd8, 0x53, 0x24, 0xff, + 0x42, 0x91, 0x4c, 0x29, 0x92, 0xf3, 0x14, 0x3f, + 0xec, 0x17, 0x9c, 0x8b, 0x53, 0x95 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fill_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x92, 0xcd, 0x6e, 0x83, 0x30, + 0x10, 0x84, 0xef, 0x7e, 0x0a, 0x4b, 0xb9, 0x40, + 0x85, 0xda, 0x06, 0xf5, 0x86, 0x7a, 0x88, 0x42, + 0xa2, 0xe6, 0xd0, 0xa4, 0x22, 0xfd, 0x39, 0x5a, + 0x36, 0x18, 0x64, 0xc9, 0x60, 0x64, 0x0c, 0x4d, + 0x5a, 0xf5, 0xdd, 0x6b, 0x07, 0x07, 0x9a, 0xc6, + 0x09, 0xc7, 0x9d, 0xd9, 0x9d, 0x6f, 0xbd, 0xb4, + 0x15, 0xcb, 0x85, 0x2c, 0x61, 0x47, 0xd3, 0x10, + 0xb6, 0xa8, 0xc6, 0x4a, 0x51, 0x59, 0x21, 0xc5, + 0x11, 0x8e, 0x40, 0xeb, 0x16, 0x89, 0xbc, 0x22, + 0xea, 0x4e, 0x72, 0xad, 0xf3, 0x5c, 0x54, 0x74, + 0xd7, 0xb0, 0x2f, 0x3a, 0xd6, 0x73, 0x2e, 0xb0, + 0xd2, 0x42, 0xc9, 0x76, 0x11, 0x18, 0xaa, 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0x87, 0x17, 0x89, 0xc3, 0x23, + 0x72, 0xc1, 0xd1, 0x52, 0xe2, 0x62, 0x6e, 0xec, + 0x16, 0xa5, 0x5f, 0x36, 0xb0, 0x23, 0x82, 0xfe, + 0xe7, 0xf4, 0xe1, 0xcd, 0xf8, 0x8b, 0x1c, 0x6f, + 0xbc, 0x79, 0x5f, 0x24, 0x71, 0x32, 0xfb, 0x40, + 0xab, 0xf5, 0xf6, 0x65, 0x31, 0x7f, 0xdd, 0x24, + 0xae, 0x99, 0x86, 0xc7, 0xeb, 0x37, 0xb7, 0xa7, + 0xfd, 0x01, 0xbf, 0x22, 0xc4, 0x2e, 0x6c + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/heatmap.cpp b/src/mbgl/shaders/heatmap.cpp index 19927cfcc6..7d6f464428 100644 --- a/src/mbgl/shaders/heatmap.cpp +++ b/src/mbgl/shaders/heatmap.cpp @@ -1,128 +1,207 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* heatmap::name = "heatmap"; -const char* heatmap::vertexSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_weight -uniform lowp float a_weight_t; -attribute highp vec2 a_weight; -varying highp float weight; -#else -uniform highp float u_weight; -#endif - - -#ifndef HAS_UNIFORM_u_radius -uniform lowp float a_radius_t; -attribute mediump vec2 a_radius; -#else -uniform mediump float u_radius; -#endif - - -uniform mat4 u_matrix; -uniform float u_extrude_scale; -uniform float u_opacity; -uniform float u_intensity; - -attribute vec2 a_pos; - -varying vec2 v_extrude; - -// Effective "0" in the kernel density texture to adjust the kernel size to; -// this empirically chosen number minimizes artifacts on overlapping kernels -// for typical heatmap cases (assuming clustered source) -const highp float ZERO = 1.0 / 255.0 / 16.0; - -// Gaussian kernel coefficient: 1 / sqrt(2 * PI) -#define GAUSS_COEF 0.3989422804014327 - -void main(void) { - -#ifndef HAS_UNIFORM_u_weight - weight = unpack_mix_vec2(a_weight, a_weight_t); -#else - highp float weight = u_weight; -#endif - - -#ifndef HAS_UNIFORM_u_radius - mediump float radius = unpack_mix_vec2(a_radius, a_radius_t); -#else - mediump float radius = u_radius; -#endif - - - // unencode the extrusion vector that we snuck into the a_pos vector - vec2 unscaled_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); - - // This 'extrude' comes in ranging from [-1, -1], to [1, 1]. We'll use - // it to produce the vertices of a square mesh framing the point feature - // we're adding to the kernel density texture. We'll also pass it as - // a varying, so that the fragment shader can determine the distance of - // each fragment from the point feature. - // Before we do so, we need to scale it up sufficiently so that the - // kernel falls effectively to zero at the edge of the mesh. - // That is, we want to know S such that - // weight * u_intensity * GAUSS_COEF * exp(-0.5 * 3.0^2 * S^2) == ZERO - // Which solves to: - // S = sqrt(-2.0 * log(ZERO / (weight * u_intensity * GAUSS_COEF))) / 3.0 - float S = sqrt(-2.0 * log(ZERO / weight / u_intensity / GAUSS_COEF)) / 3.0; - - // Pass the varying in units of radius - v_extrude = S * unscaled_extrude; - - // Scale by radius and the zoom-based scale factor to produce actual - // mesh position - vec2 extrude = v_extrude * radius * u_extrude_scale; - - // multiply a_pos by 0.5, since we had it * 2 in order to sneak - // in extrusion data - vec4 pos = vec4(floor(a_pos * 0.5) + extrude, 0, 1); - - gl_Position = u_matrix * pos; -} - -)MBGL_SHADER"; -const char* heatmap::fragmentSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_weight -varying highp float weight; -#else -uniform highp float u_weight; -#endif - - -uniform highp float u_intensity; -varying vec2 v_extrude; - -// Gaussian kernel coefficient: 1 / sqrt(2 * PI) -#define GAUSS_COEF 0.3989422804014327 - -void main() { - -#ifdef HAS_UNIFORM_u_weight - highp float weight = u_weight; -#endif - - - // Kernel density estimation with a Gaussian kernel of size 5x5 - float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude); - float val = weight * u_intensity * GAUSS_COEF * exp(d); - - gl_FragColor = vec4(val, 1.0, 1.0, 1.0); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* heatmap::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x85, 0x56, 0xdb, 0x72, 0xdb, 0x36, + 0x14, 0x7c, 0xe7, 0x57, 0x9c, 0x89, 0x1f, 0x2c, + 0xa9, 0xba, 0x5b, 0x6e, 0x93, 0x78, 0xfc, 0x90, + 0x76, 0x9c, 0x34, 0x0f, 0xad, 0x3d, 0x51, 0x33, + 0x99, 0x69, 0x26, 0xd1, 0xc0, 0x04, 0x28, 0xa1, + 0x26, 0x01, 0x06, 0x17, 0xf9, 0xd2, 0xe9, 0xbf, + 0x77, 0x01, 0x12, 0x12, 0x1d, 0xb9, 0x6e, 0x5e, + 0xc4, 0xf0, 0x1c, 0x2c, 0xf6, 0x00, 0xbb, 0x4b, + 0x67, 0x47, 0xb2, 0x50, 0x5c, 0x14, 0xf4, 0xeb, + 0x9b, 0xe5, 0xea, 0xe3, 0xef, 0xef, 0xdf, 0x5e, + 0x7e, 0xf8, 0x6d, 0xe5, 0x57, 0xb7, 0x42, 0xae, + 0x37, 0x2e, 0xf3, 0x4a, 0x16, 0xda, 0x54, 0x54, + 0xea, 0xdb, 0x9a, 0x8a, 0x52, 0x33, 0x47, 0xac, + 0xad, 0xad, 0xdc, 0x59, 0xc6, 0x9c, 0x33, 0xf2, + 0xda, 0x3b, 0x41, 0x1b, 0xbc, 0xaa, 0x69, 0x2b, + 0xf2, 0xf9, 0xae, 0xe1, 0x2c, 0xdb, 0x32, 0x73, + 0x2f, 0xd5, 0xba, 0x2d, 0x36, 0xcb, 0x53, 0xed, + 0x48, 0x94, 0x56, 0xec, 0xf0, 0xbb, 0x1d, 0x7e, + 0xb5, 0xef, 0x51, 0x5c, 0x16, 0x59, 0x96, 0x3d, + 0xcd, 0xd1, 0x30, 0x2e, 0xbd, 0x7d, 0x9a, 0x63, + 0x53, 0x7b, 0xcc, 0xb1, 0x12, 0x78, 0x57, 0xed, + 0x58, 0x36, 0x2d, 0xdf, 0x33, 0x49, 0x4d, 0x89, + 0xcb, 0xbe, 0xab, 0xe5, 0xb2, 0x6b, 0x64, 0x6e, + 0x81, 0x3a, 0x7e, 0x8c, 0xbc, 0x3b, 0xdb, 0xbd, + 0x4e, 0xeb, 0xc4, 0x9d, 0x33, 0x9e, 0x8b, 0x95, + 0xcd, 0x59, 0x29, 0x0e, 0xcb, 0xba, 0x66, 0xb9, + 0x74, 0xf7, 0x87, 0x05, 0xa9, 0x9c, 0x50, 0x36, + 0x96, 0x3a, 0xd4, 0x5b, 0xca, 0xb5, 0x06, 0x93, + 0xdd, 0xb1, 0xc6, 0x97, 0xdb, 0xb4, 0x13, 0x0a, + 0x93, 0x09, 0x5d, 0x14, 0x85, 0xc8, 0x9d, 0xdc, + 0x0a, 0x7a, 0x31, 0x7d, 0x41, 0x52, 0x91, 0xdb, + 0x08, 0xba, 0x11, 0x46, 0x89, 0x92, 0x78, 0x03, + 0x4c, 0x0e, 0x2b, 0xbc, 0x11, 0xe4, 0x34, 0x31, + 0xfe, 0x97, 0xb7, 0xae, 0xdb, 0x64, 0xe5, 0x43, + 0xa8, 0x9c, 0x05, 0x30, 0xb7, 0x91, 0x96, 0x44, + 0x55, 0x4b, 0x23, 0x31, 0x45, 0x79, 0x4f, 0xf9, + 0x46, 0x5b, 0xa1, 0x48, 0xf9, 0xea, 0x5a, 0x18, + 0xaa, 0xa4, 0x92, 0x15, 0xda, 0x2d, 0x31, 0xe3, + 0x64, 0xc1, 0x72, 0x67, 0x49, 0x2b, 0xd2, 0x5b, + 0x61, 0x4a, 0x56, 0xd7, 0x81, 0x62, 0x03, 0x6a, + 0x03, 0x18, 0xa6, 0x24, 0x77, 0x5f, 0x07, 0x24, + 0xda, 0x08, 0xe6, 0x2a, 0x56, 0x53, 0xce, 0x2c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 0x34, 0x86, 0xcd, 0x28, 0x28, 0x72, + 0x80, 0xef, 0xd3, 0xba, 0x17, 0xc3, 0x6b, 0x42, + 0xbd, 0xff, 0xdd, 0xbe, 0xdf, 0xef, 0xa3, 0x0f, + 0xdb, 0x46, 0xb4, 0xc6, 0x70, 0xcf, 0x00, 0xb6, + 0x78, 0x93, 0x47, 0x78, 0x93, 0x47, 0x78, 0x0d, + 0xdc, 0xde, 0x12, 0x57, 0x41, 0x41, 0x51, 0xbd, + 0xed, 0xe7, 0x04, 0x76, 0xc0, 0xc7, 0xc8, 0x45, + 0x15, 0x77, 0xc2, 0x63, 0xdb, 0x71, 0xdc, 0x32, + 0x30, 0xfe, 0xce, 0x88, 0x7b, 0xc4, 0x65, 0xbc, + 0xec, 0xeb, 0xfb, 0x94, 0x0c, 0x4c, 0xf1, 0xb8, + 0xc1, 0x83, 0xd6, 0xd5, 0xe8, 0x1a, 0x51, 0xcf, + 0x5b, 0x3d, 0x84, 0x4f, 0x45, 0xf0, 0xff, 0xde, + 0x45, 0x78, 0xe1, 0x59, 0x99, 0x80, 0xa2, 0x75, + 0x60, 0x69, 0xe9, 0x90, 0x16, 0xfb, 0x08, 0xe8, + 0x38, 0x7f, 0xc7, 0x69, 0x90, 0x36, 0x1b, 0x1c, + 0x7e, 0x73, 0x77, 0x70, 0xbe, 0x74, 0xb2, 0x86, + 0x90, 0x9a, 0x64, 0x01, 0x41, 0x5c, 0x2a, 0x5c, + 0x22, 0x83, 0xe8, 0xa1, 0x15, 0x18, 0x23, 0x48, + 0x14, 0xc9, 0x11, 0xce, 0x40, 0x9b, 0x60, 0x93, + 0xa0, 0x5d, 0x25, 0xd8, 0xcd, 0xce, 0xf4, 0xaa, + 0x93, 0x5f, 0x9c, 0x39, 0x96, 0x68, 0x2d, 0x02, + 0xd1, 0x26, 0x8c, 0x16, 0x3d, 0xdc, 0x93, 0x36, + 0x4d, 0x1c, 0x01, 0x0e, 0xbb, 0xf4, 0xe9, 0x87, + 0x44, 0x7b, 0x48, 0x53, 0x24, 0x4a, 0xca, 0xa4, + 0x75, 0xb9, 0xba, 0x6a, 0x07, 0x8c, 0x09, 0xda, + 0xfc, 0x19, 0x81, 0x45, 0xf1, 0x13, 0xff, 0x4f, + 0xf6, 0x2f, 0x86, 0xd2, 0x1c, 0xf9 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* heatmap::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x75, 0x91, 0x51, 0x4f, 0xc2, 0x30, + 0x14, 0x85, 0xdf, 0xfb, 0x2b, 0x6e, 0xc2, 0xcb, + 0x20, 0x38, 0xc6, 0x18, 0x11, 0x5c, 0x7c, 0x20, + 0x08, 0x48, 0x8c, 0x8c, 0x6c, 0xa2, 0x8f, 0x4b, + 0x43, 0xbb, 0x71, 0xe3, 0x68, 0x71, 0x2b, 0x03, + 0x34, 0xfe, 0x77, 0x3b, 0x86, 0x80, 0x41, 0xfa, + 0x70, 0x93, 0xa6, 0xe7, 0xdc, 0x7b, 0xcf, 0x57, + 0x52, 0xc1, 0x48, 0x30, 0x1e, 0xc1, 0x63, 0x2f, + 0x08, 0x67, 0x93, 0xf1, 0xd0, 0xf3, 0x9f, 0xc3, + 0x75, 0xb8, 0xe1, 0x18, 0x2f, 0x14, 0xc9, 0x69, + 0xba, 0x43, 0x11, 0xc3, 0x42, 0xdf, 0x56, 0x10, + 0x25, 0x92, 0x2a, 0x28, 0x9f, 0x5c, 0x52, 0xe1, + 0x49, 0xc6, 0xc9, 0x5a, 0x60, 0x24, 0xd3, 0xe5, + 0x1f, 0xc5, 0xaf, 0xbd, 0xd0, 0x08, 0x86, 0x11, + 0x21, 0x57, 0x64, 0x28, 0x14, 0x17, 0x19, 0xaa, + 0x9d, 0x7b, 0x9c, 0x94, 0xf3, 0xb9, 0x0d, 0x79, + 0xc8, 0xb7, 0x2a, 0x5d, 0x33, 0xee, 0x12, 0xd2, + 0x68, 0xc0, 0x88, 0xae, 0xb3, 0x0c, 0xa9, 0x80, + 0x77, 0x9e, 0x0a, 0x9e, 0xc0, 0x5c, 0xf2, 0x28, + 0xc2, 0x39, 0x72, 0xa1, 0xee, 0xa0, 0x09, 0x0d, + 0xc8, 0x3e, 0x52, 0x65, 0xd8, 0x50, 0x83, 0xe9, + 0xb8, 0x4a, 0x2a, 0x3a, 0x0d, 0x0a, 0x0e, 0xa3, + 0xde, 0x2c, 0x08, 0xc2, 0xbe, 0x37, 0x18, 0x82, + 0x65, 0xb6, 0xba, 0x9d, 0xae, 0x63, 0xdb, 0x1d, + 0xcb, 0xb1, 0x9a, 0x4e, 0xcb, 0xbe, 0x25, 0x24, + 0x97, 0xc8, 0x60, 0x49, 0x51, 0x18, 0x55, 0xf8, + 0x22, 0xa0, 0x0f, 0xd1, 0x28, 0xae, 0x92, 0x28, + 0x04, 0x97, 0x14, 0xe0, 0xfe, 0xbf, 0xb0, 0x85, + 0x56, 0xaf, 0xfd, 0x54, 0x6e, 0xcb, 0xca, 0x88, + 0xc0, 0x33, 0x85, 0x4b, 0xaa, 0x50, 0x0a, 0xd8, + 0xa0, 0x5a, 0x00, 0xbd, 0xc8, 0x25, 0x23, 0xc8, + 0xf0, 0x93, 0x43, 0x7b, 0xdb, 0xde, 0xf7, 0x28, + 0x27, 0x31, 0x3d, 0xe4, 0xc6, 0x32, 0xdb, 0x3a, + 0x5e, 0xcb, 0xb4, 0x8e, 0x95, 0x49, 0x65, 0x1c, + 0x39, 0xd5, 0x4f, 0xc8, 0xaa, 0xee, 0x99, 0x37, + 0xa7, 0x89, 0x76, 0x1f, 0x76, 0xad, 0x9d, 0x13, + 0xd7, 0xb7, 0x33, 0x40, 0x35, 0xe0, 0xdb, 0x95, + 0xc1, 0xb4, 0x77, 0x6f, 0x8e, 0x93, 0x70, 0x98, + 0xd2, 0xb8, 0x2f, 0x13, 0x99, 0x6a, 0xbf, 0xfe, + 0x13, 0xc7, 0xd0, 0xad, 0xea, 0xd0, 0x34, 0xad, + 0x53, 0x29, 0xd4, 0x07, 0x64, 0xde, 0xeb, 0xc0, + 0x7f, 0xf0, 0x7b, 0x6f, 0xe1, 0x78, 0x12, 0x4c, + 0x07, 0xfd, 0x17, 0xcf, 0xbf, 0xda, 0xa7, 0x34, + 0x1e, 0x58, 0x7d, 0x93, 0x1f, 0x8f, 0x9c, 0xc6, + 0x07 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/heatmap_texture.cpp b/src/mbgl/shaders/heatmap_texture.cpp index c5d35c48ae..da7c8eab32 100644 --- a/src/mbgl/shaders/heatmap_texture.cpp +++ b/src/mbgl/shaders/heatmap_texture.cpp @@ -1,42 +1,71 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* heatmap_texture::name = "heatmap_texture"; -const char* heatmap_texture::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_world; -attribute vec2 a_pos; -varying vec2 v_pos; - -void main() { - gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1); - - v_pos.x = a_pos.x; - v_pos.y = 1.0 - a_pos.y; -} - -)MBGL_SHADER"; -const char* heatmap_texture::fragmentSource = R"MBGL_SHADER( -uniform sampler2D u_image; -uniform sampler2D u_color_ramp; -uniform float u_opacity; -varying vec2 v_pos; - -void main() { - float t = texture2D(u_image, v_pos).r; - vec4 color = texture2D(u_color_ramp, vec2(t, 0.5)); - gl_FragColor = color * u_opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(0.0); -#endif -} - -)MBGL_SHADER"; +const char* heatmap_texture::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x4d, 0x8d, 0x41, 0x0a, 0x83, 0x30, + 0x10, 0x45, 0xf7, 0x73, 0x8a, 0x59, 0x6a, 0xb1, + 0xa2, 0xc5, 0x5d, 0xe8, 0x1d, 0x7a, 0x83, 0x90, + 0x56, 0x2b, 0x03, 0x9a, 0x94, 0x98, 0x44, 0x43, + 0xe9, 0xdd, 0x3b, 0x9a, 0x50, 0x3a, 0x9b, 0x99, + 0x79, 0x9f, 0xff, 0xbf, 0xd7, 0xf4, 0x34, 0x76, + 0xc6, 0x59, 0xb9, 0x0e, 0xbd, 0xe4, 0x65, 0x69, + 0x13, 0xe0, 0x33, 0x0e, 0xc3, 0xe3, 0xc2, 0x78, + 0x35, 0x76, 0xea, 0x05, 0x28, 0xc7, 0xea, 0xdd, + 0xbb, 0x21, 0x71, 0x25, 0x5f, 0x66, 0x11, 0x10, + 0x94, 0x8d, 0xa4, 0xc7, 0xc4, 0x42, 0x62, 0x10, + 0x0c, 0xf5, 0x1c, 0x4a, 0xba, 0x28, 0xf1, 0x0d, + 0xc8, 0x33, 0x4e, 0xf2, 0x66, 0x16, 0x72, 0x64, + 0x34, 0x5e, 0x7f, 0x55, 0x78, 0xda, 0x7d, 0x5d, + 0x71, 0x64, 0xf1, 0x93, 0xbb, 0x2a, 0x6c, 0x2a, + 0x6c, 0x4b, 0x0e, 0xda, 0xad, 0x47, 0x68, 0xbd, + 0xb1, 0x4d, 0xa5, 0x4b, 0xfc, 0xe1, 0xc8, 0xb8, + 0xad, 0x1b, 0x3c, 0x67, 0x31, 0x0a, 0xf8, 0xc0, + 0x17, 0xe6, 0x77, 0x44, 0xb1 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* heatmap_texture::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x6d, 0x8e, 0x41, 0x0b, 0x82, 0x40, + 0x14, 0x84, 0xef, 0xfb, 0x2b, 0x1e, 0x78, 0xd1, + 0x10, 0x11, 0xa9, 0x93, 0x74, 0x08, 0x35, 0xe8, + 0x92, 0x61, 0x51, 0xc7, 0x65, 0xd1, 0xdd, 0x65, + 0x41, 0x5d, 0x59, 0x57, 0x49, 0xa2, 0xff, 0xde, + 0xa6, 0x82, 0x11, 0xbe, 0xe3, 0x9b, 0xf9, 0x66, + 0xa6, 0xab, 0x05, 0x93, 0xaa, 0x82, 0x96, 0x54, + 0x4d, 0x49, 0x55, 0x10, 0x43, 0x87, 0x45, 0x45, + 0x38, 0x0d, 0x51, 0xb7, 0x22, 0xe5, 0xb2, 0x94, + 0x0a, 0x2b, 0xf3, 0x59, 0x74, 0x56, 0x4a, 0xa2, + 0x8d, 0x26, 0x1b, 0x92, 0x0b, 0x3d, 0x84, 0xa8, + 0x27, 0x6a, 0x10, 0x35, 0x87, 0x9e, 0xe6, 0x01, + 0xf4, 0xb8, 0x91, 0x6d, 0x88, 0x50, 0x2f, 0x45, + 0x01, 0x15, 0x11, 0xb5, 0xed, 0xc0, 0x0b, 0x81, + 0xb9, 0x89, 0xd3, 0xb0, 0x07, 0x4d, 0x9f, 0xba, + 0x53, 0x34, 0x88, 0xed, 0xb9, 0xdc, 0x9d, 0x30, + 0xc7, 0x53, 0xe1, 0x68, 0x35, 0x49, 0x5b, 0x18, + 0xbb, 0xff, 0xdc, 0xcb, 0x1e, 0x77, 0xac, 0xb3, + 0xb5, 0x0b, 0xbe, 0xb7, 0x73, 0x9c, 0x89, 0xe3, + 0x25, 0x3e, 0x2a, 0xc2, 0xa3, 0x99, 0x9c, 0x12, + 0x36, 0xbf, 0x5b, 0x91, 0x25, 0x58, 0x41, 0x19, + 0xa4, 0xf7, 0x24, 0x8b, 0xb3, 0xc3, 0x03, 0x9f, + 0xce, 0xd7, 0x4b, 0x12, 0xdd, 0xd2, 0x6c, 0x2d, + 0xe0, 0xbb, 0xc3, 0xf6, 0x3d, 0xdf, 0xc4, 0x5b, + 0xb4, 0x2e, 0x04, 0x43, 0x6f, 0xf4, 0x01, 0x73, + 0x71, 0x68, 0xaa + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/hillshade.cpp b/src/mbgl/shaders/hillshade.cpp index 4083faa4b4..1238cf812d 100644 --- a/src/mbgl/shaders/hillshade.cpp +++ b/src/mbgl/shaders/hillshade.cpp @@ -1,80 +1,193 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* hillshade::name = "hillshade"; -const char* hillshade::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; - -attribute vec2 a_pos; -attribute vec2 a_texture_pos; - -varying vec2 v_pos; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); - v_pos = a_texture_pos / 8192.0; -} - -)MBGL_SHADER"; -const char* hillshade::fragmentSource = R"MBGL_SHADER( -uniform sampler2D u_image; -varying vec2 v_pos; - -uniform vec2 u_latrange; -uniform vec2 u_light; -uniform vec4 u_shadow; -uniform vec4 u_highlight; -uniform vec4 u_accent; - -#define PI 3.141592653589793 - -void main() { - vec4 pixel = texture2D(u_image, v_pos); - - vec2 deriv = ((pixel.rg * 2.0) - 1.0); - - // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude - // to account for mercator projection distortion. see #4807 for details - float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1])); - // We also multiply the slope by an arbitrary z-factor of 1.25 - float slope = atan(1.25 * length(deriv) / scaleFactor); - float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0); - - float intensity = u_light.x; - // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal - // position property to account for 0deg corresponding to north/the top of the viewport in the style spec - // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal. - float azimuth = u_light.y + PI; - - // We scale the slope exponentially based on intensity, using a calculation similar to - // the exponential interpolation function in the style spec: - // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228 - // so that higher intensity values create more opaque hillshading. - float base = 1.875 - intensity * 1.75; - float maxValue = 0.5 * PI; - float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope; - - // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine - // so that the accent color's rate of change eases in while the shade color's eases out. - float accent = cos(scaledSlope); - // We multiply both the accent and shade color by a clamped intensity value - // so that intensities >= 0.5 do not additionally affect the color values - // while intensity values < 0.5 make the overall color more transparent. - vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0); - float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0); - vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0); - gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* hillshade::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x65, 0x8d, 0xc1, 0x0a, 0xc2, 0x30, + 0x10, 0x44, 0xef, 0xfb, 0x15, 0x73, 0x6c, 0xa5, + 0x68, 0x5b, 0x7a, 0x50, 0x82, 0xff, 0xe0, 0x1f, + 0x94, 0xa8, 0xb1, 0x2c, 0xd8, 0x44, 0xd2, 0x4d, + 0xa8, 0x88, 0xff, 0x6e, 0x4c, 0x51, 0x10, 0xf7, + 0xb2, 0xcb, 0xcc, 0xec, 0xbc, 0x60, 0xf9, 0xe2, + 0xfc, 0x88, 0x51, 0x4b, 0x87, 0xd0, 0xa7, 0xe5, + 0x79, 0x56, 0x44, 0x5a, 0xd2, 0x71, 0x0c, 0x62, + 0x10, 0xcd, 0xa9, 0x85, 0xee, 0x6f, 0x6e, 0x52, + 0xff, 0xaa, 0x98, 0x59, 0x82, 0x37, 0x8b, 0x4b, + 0x51, 0xfb, 0x3b, 0xdb, 0x61, 0x31, 0xe3, 0x47, + 0x74, 0x7c, 0x4e, 0xf5, 0x6c, 0x8b, 0x12, 0x0f, + 0x42, 0x9a, 0xe1, 0xda, 0x1f, 0xdc, 0xc4, 0xc2, + 0xce, 0x62, 0xff, 0x85, 0x62, 0xf5, 0xfe, 0xeb, + 0x8a, 0x8c, 0xaa, 0x50, 0x57, 0x68, 0x4a, 0x95, + 0xf3, 0xb9, 0x29, 0x25, 0x7f, 0x70, 0xd8, 0x60, + 0xdb, 0xec, 0xda, 0x75, 0xad, 0xe8, 0x49, 0x2f, + 0x97, 0x4d, 0x40, 0xaf + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* hillshade::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x56, 0xdb, 0x6e, 0xdb, 0x38, + 0x10, 0x7d, 0xf7, 0x57, 0x4c, 0x91, 0x87, 0x95, + 0x1b, 0x5b, 0x8a, 0x95, 0x78, 0x9d, 0xa4, 0x9b, + 0x16, 0x8b, 0xa6, 0x05, 0x02, 0x14, 0x6d, 0x90, + 0x16, 0xed, 0xc3, 0xa2, 0x30, 0x68, 0x89, 0x96, + 0x98, 0xa5, 0x44, 0x95, 0xa4, 0x7c, 0xe9, 0x62, + 0xff, 0xbd, 0x33, 0x24, 0x65, 0xcb, 0x4e, 0xb0, + 0xd8, 0xbc, 0x24, 0x21, 0x67, 0xce, 0x5c, 0xce, + 0x99, 0xa1, 0xda, 0x5a, 0x2c, 0x95, 0xae, 0xc0, + 0xb0, 0xaa, 0x91, 0x5c, 0xa7, 0xb7, 0xd0, 0xce, + 0x45, 0xc5, 0x0a, 0xfe, 0x6a, 0xb0, 0x62, 0x7a, + 0x2b, 0xea, 0x02, 0x56, 0x3c, 0x4b, 0x61, 0x35, + 0x6f, 0x94, 0x79, 0x35, 0x18, 0xb4, 0xc1, 0xde, + 0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, + 0x2a, 0xfd, 0x1a, 0xc6, 0x3d, 0xfe, 0x7d, 0x1c, + 0x51, 0x5b, 0x5e, 0x1b, 0x61, 0xb7, 0x18, 0x2a, + 0x88, 0x3d, 0xde, 0x1c, 0xf4, 0x21, 0xcf, 0x09, + 0x18, 0x69, 0xac, 0xd8, 0xdf, 0x24, 0x14, 0x61, + 0x88, 0xbb, 0x86, 0x6b, 0xf4, 0x41, 0xc6, 0xb3, + 0xd2, 0x35, 0xa7, 0x90, 0x6a, 0xc1, 0x24, 0x38, + 0x00, 0x50, 0x0b, 0xa2, 0x76, 0x04, 0xeb, 0x52, + 0xe0, 0x35, 0x22, 0x18, 0x84, 0x48, 0x52, 0x02, + 0x21, 0x5b, 0x67, 0x44, 0xb2, 0xf9, 0x29, 0xaa, + 0xd6, 0x96, 0x4c, 0x76, 0xe1, 0x90, 0x17, 0xe1, + 0x14, 0xb1, 0x0b, 0x70, 0xa4, 0x9e, 0xb3, 0x9c, + 0x17, 0x48, 0xba, 0xd6, 0xdc, 0x34, 0xaa, 0xce, + 0x69, 0xa8, 0xd1, 0xa2, 0x46, 0xf1, 0x94, 0x09, + 0x21, 0x5b, 0xd5, 0x74, 0xda, 0x5c, 0x09, 0xbe, + 0x6e, 0xf0, 0x02, 0x2b, 0xf4, 0xec, 0xd9, 0x2d, + 0x4a, 0x9a, 0xba, 0xda, 0x45, 0x63, 0x75, 0xee, + 0x6e, 0x94, 0x16, 0x85, 0xa8, 0x31, 0x79, 0x1a, + 0x6a, 0xae, 0x61, 0xcd, 0x0c, 0xac, 0xb5, 0xb0, + 0xd8, 0x98, 0x10, 0x9f, 0x37, 0x16, 0xa2, 0xb1, + 0x90, 0xb2, 0xad, 0xd0, 0x90, 0x32, 0xbc, 0x15, + 0x3a, 0x88, 0x77, 0x0c, 0x57, 0x38, 0x59, 0xe8, + 0x42, 0x50, 0xbb, 0x8a, 0xe2, 0x3e, 0x95, 0xfe, + 0xb0, 0xd7, 0xe0, 0x2d, 0x4a, 0xef, 0xfe, 0xee, + 0x60, 0x0e, 0xfd, 0xc4, 0xed, 0x65, 0xc6, 0x37, + 0x58, 0x20, 0x6e, 0x0c, 0xc1, 0x24, 0xca, 0x6f, + 0x37, 0x82, 0x3b, 0xba, 0x46, 0xd0, 0x1a, 0x2a, + 0x9f, 0x01, 0x3a, 0x66, 0xad, 0x74, 0x59, 0x81, + 0x11, 0x95, 0x90, 0x4c, 0x63, 0xda, 0xbb, 0xf1, + 0x2b, 0x0f, 0xb0, 0x1c, 0x80, 0x6e, 0x54, 0xb0, + 0x5f, 0xb6, 0xb5, 0xaf, 0xe2, 0x49, 0x93, 0xae, + 0x3b, 0x80, 0xd2, 0xda, 0xc6, 0x5c, 0x27, 0x49, + 0x21, 0x6c, 0xd9, 0x2e, 0xe2, 0x4c, 0x55, 0x49, + 0xc5, 0x9a, 0x85, 0xda, 0x84, 0x5f, 0xe3, 0x42, + 0x8e, 0x1f, 0x4d, 0xb2, 0x40, 0xfe, 0xf1, 0xc4, + 0x20, 0x7a, 0x62, 0x74, 0x96, 0x38, 0xa4, 0x31, + 0x21, 0x25, 0x18, 0x1e, 0xf9, 0x32, 0x18, 0x26, + 0x71, 0xbb, 0xcf, 0x51, 0x6c, 0x92, 0x7d, 0x26, + 0x3c, 0x7e, 0x34, 0x27, 0x1f, 0xd2, 0xc9, 0x6c, + 0xfc, 0x21, 0x4d, 0x2f, 0xbb, 0xc0, 0x86, 0xc4, + 0x82, 0xed, 0xa3, 0x9d, 0x8a, 0xac, 0xec, 0x85, + 0xba, 0x62, 0xb2, 0xe5, 0x06, 0x32, 0xcd, 0x69, + 0xdf, 0x54, 0x4a, 0x23, 0x85, 0x0d, 0xfb, 0xd1, + 0x72, 0x34, 0x95, 0x92, 0x48, 0xc4, 0xc6, 0xf4, + 0x09, 0xa0, 0xee, 0x61, 0xf7, 0x27, 0xf1, 0xe5, + 0x6c, 0x8a, 0x7c, 0xed, 0x91, 0x5e, 0xe2, 0xd9, + 0x6c, 0xda, 0x1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x54, 0xec + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/hillshade_prepare.cpp b/src/mbgl/shaders/hillshade_prepare.cpp index 8d0571f6a4..d45942b476 100644 --- a/src/mbgl/shaders/hillshade_prepare.cpp +++ b/src/mbgl/shaders/hillshade_prepare.cpp @@ -1,100 +1,171 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* hillshade_prepare::name = "hillshade_prepare"; -const char* hillshade_prepare::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; - -attribute vec2 a_pos; -attribute vec2 a_texture_pos; - -varying vec2 v_pos; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); - v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25; -} - -)MBGL_SHADER"; -const char* hillshade_prepare::fragmentSource = R"MBGL_SHADER( -#ifdef GL_ES -precision highp float; -#endif - -uniform sampler2D u_image; -varying vec2 v_pos; -uniform vec2 u_dimension; -uniform float u_zoom; -uniform float u_maxzoom; - -float getElevation(vec2 coord, float bias) { - // Convert encoded elevation value to meters - vec4 data = texture2D(u_image, coord) * 255.0; - return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0; -} - -void main() { - vec2 epsilon = 1.0 / u_dimension; - - // queried pixels: - // +-----------+ - // | | | | - // | a | b | c | - // | | | | - // +-----------+ - // | | | | - // | d | e | f | - // | | | | - // +-----------+ - // | | | | - // | g | h | i | - // | | | | - // +-----------+ - - float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0); - float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0); - float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0); - float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0); - float e = getElevation(v_pos, 0.0); - float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0); - float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0); - float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0); - float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0); - - // here we divide the x and y slopes by 8 * pixel size - // where pixel size (aka meters/pixel) is: - // circumference of the world / (pixels per tile * number of tiles) - // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom)) - // which can be reduced to: pow(2, 19.25619978527 - u_zoom) - // we want to vertically exaggerate the hillshading though, because otherwise - // it is barely noticeable at low zooms. to do this, we multiply this by some - // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value - // Here we use a=0.3 which works out to the expression below. see - // nickidlugash's awesome breakdown for more info - // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556 - float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3; - - vec2 deriv = vec2( - (c + f + f + i) - (a + d + d + g), - (g + h + h + i) - (a + b + b + c) - ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom); - - gl_FragColor = clamp(vec4( - deriv.x / 2.0 + 0.5, - deriv.y / 2.0 + 0.5, - 1.0, - 1.0), 0.0, 1.0); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* hillshade_prepare::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x65, 0x4d, 0x51, 0x0a, 0xc2, 0x30, + 0x14, 0xfb, 0xef, 0x29, 0xf2, 0xb9, 0xe9, 0x98, + 0x5b, 0x99, 0xa0, 0x14, 0xef, 0xe0, 0x0d, 0x46, + 0xd5, 0x3a, 0x1e, 0xb8, 0x76, 0x74, 0xed, 0x98, + 0x88, 0x77, 0xf7, 0xd9, 0xa1, 0x20, 0xbe, 0x9f, + 0x84, 0x24, 0x2f, 0x89, 0x96, 0xae, 0xce, 0xf7, + 0xe8, 0x75, 0x68, 0x10, 0x5b, 0x06, 0x4f, 0xb3, + 0x12, 0x42, 0x07, 0x26, 0xa7, 0x18, 0x0c, 0x26, + 0x73, 0x96, 0xd0, 0xed, 0xe0, 0x46, 0xf5, 0xaf, + 0x06, 0x33, 0x87, 0xe8, 0xcd, 0xe2, 0x8a, 0x49, + 0xfb, 0x3b, 0xd9, 0x6e, 0x31, 0xa7, 0x8f, 0xe8, + 0xe8, 0xc2, 0xf5, 0x64, 0xb3, 0x1c, 0x0f, 0x01, + 0xbe, 0xee, 0xd6, 0x1e, 0xdd, 0x48, 0x81, 0x9c, + 0xc5, 0xe1, 0x3b, 0x8a, 0xd5, 0xfb, 0xaf, 0xc9, + 0xd2, 0x54, 0x81, 0xaa, 0x40, 0x9d, 0xab, 0x94, + 0x4f, 0x4d, 0x9c, 0xcc, 0x7e, 0xf6, 0xb0, 0xc1, + 0xae, 0xde, 0xcb, 0xb2, 0xca, 0x99, 0x31, 0x60, + 0x8d, 0xaa, 0x94, 0x5b, 0x25, 0x9e, 0xe2, 0x05, + 0x6f, 0x64, 0x43, 0x2f + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* hillshade_prepare::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x56, 0x6d, 0x6f, 0xdb, 0x36, + 0x10, 0xfe, 0xee, 0x5f, 0x71, 0x40, 0x3e, 0x4c, + 0x5e, 0x1c, 0x59, 0x56, 0xad, 0xbc, 0x2e, 0x18, + 0x86, 0x24, 0xdd, 0x06, 0x0c, 0xeb, 0x90, 0x0e, + 0xdb, 0x47, 0x83, 0x12, 0x4f, 0x12, 0x17, 0x4a, + 0x54, 0x49, 0xc9, 0x2f, 0xdd, 0xfa, 0xdf, 0x77, + 0xa4, 0x28, 0x2b, 0x69, 0xbc, 0x34, 0x05, 0x26, + 0xe0, 0x20, 0xfb, 0x78, 0xf7, 0xdc, 0x2b, 0xef, + 0x74, 0x24, 0x72, 0x8e, 0x39, 0xfc, 0xf8, 0xcb, + 0xea, 0xee, 0xfd, 0xa4, 0xd1, 0x98, 0x09, 0x23, + 0x54, 0x0d, 0xa5, 0x28, 0xca, 0x06, 0x72, 0xa9, + 0x58, 0x7b, 0x35, 0x39, 0xc2, 0x9a, 0x8b, 0x7c, + 0x32, 0xe9, 0x6a, 0x91, 0x2b, 0x5d, 0x81, 0x61, + 0x55, 0x23, 0x51, 0xc7, 0xb7, 0xd0, 0xad, 0x44, + 0xc5, 0x0a, 0xbc, 0x9a, 0xac, 0x99, 0xde, 0x89, + 0xba, 0x80, 0x35, 0x66, 0x31, 0xac, 0x57, 0x8d, + 0x32, 0x57, 0x7b, 0x71, 0xc7, 0xeb, 0x56, 0x5c, + 0x54, 0x58, 0x5b, 0xf0, 0xf1, 0xc4, 0xe1, 0xd3, + 0xd1, 0x47, 0xa5, 0xaa, 0xe7, 0xdc, 0x8a, 0x6d, + 0xfb, 0x83, 0x49, 0xcf, 0x29, 0xb0, 0xbd, 0x93, + 0xb8, 0x66, 0x2d, 0x61, 0x04, 0x0e, 0x34, 0x53, + 0x4a, 0xf3, 0x99, 0x57, 0x48, 0x05, 0x33, 0x53, + 0xf8, 0x7b, 0x02, 0xf4, 0xcc, 0xe7, 0x70, 0xa3, + 0xea, 0x35, 0xea, 0x16, 0xb0, 0xce, 0x14, 0x47, + 0x0e, 0x38, 0xa8, 0xc2, 0x9a, 0xc9, 0x0e, 0xa1, + 0x55, 0x50, 0x61, 0x8b, 0xda, 0x38, 0x05, 0x82, + 0x5b, 0x02, 0x67, 0x2d, 0x83, 0x6b, 0x68, 0x71, + 0xdb, 0x76, 0x1a, 0xe3, 0xdb, 0xc0, 0x87, 0x37, + 0xeb, 0x0d, 0x4d, 0xe1, 0x5b, 0x88, 0x93, 0x24, + 0x8c, 0xae, 0x9c, 0x8a, 0x46, 0x92, 0xaa, 0x21, + 0xb0, 0x5a, 0xa1, 0x86, 0x63, 0xa7, 0x1e, 0x16, + 0x4e, 0xe8, 0x34, 0x8c, 0x06, 0x46, 0xba, 0x67, + 0xf8, 0xf7, 0x14, 0xe6, 0xb0, 0xb4, 0x20, 0x9f, + 0x26, 0x93, 0xb5, 0x12, 0x1c, 0x2a, 0x26, 0xea, + 0x60, 0xf0, 0xdc, 0xc5, 0x85, 0x8d, 0x11, 0x92, + 0x3c, 0xbd, 0x86, 0x05, 0xe9, 0xcd, 0x9f, 0x26, + 0x6f, 0x08, 0xf0, 0x43, 0x87, 0x5a, 0x50, 0x60, + 0x8d, 0xd8, 0xa2, 0x34, 0x97, 0x03, 0xfb, 0xf8, + 0x64, 0x7c, 0x8e, 0x07, 0xe6, 0x3f, 0xf4, 0xda, + 0xd3, 0xc8, 0x64, 0x44, 0x29, 0x51, 0xf6, 0x98, + 0x79, 0x40, 0xf2, 0x6b, 0x30, 0x39, 0x11, 0x12, + 0xe5, 0xff, 0x23, 0x66, 0x41, 0x54, 0x12, 0x89, + 0xaf, 0xc2, 0x74, 0xdc, 0xbe, 0x37, 0x6c, 0x59, + 0x9f, 0xb6, 0x8f, 0x6d, 0x51, 0x2a, 0x91, 0x4d, + 0x77, 0x70, 0xe2, 0xf3, 0x1d, 0x6e, 0x67, 0xb0, + 0xff, 0xbd, 0x9b, 0xce, 0x20, 0xa2, 0x6a, 0x5d, + 0x3d, 0x82, 0x49, 0x5f, 0x84, 0x89, 0xbe, 0xa0, + 0x9d, 0xbd, 0xa8, 0xfd, 0x5a, 0x1f, 0xf8, 0xab, + 0x43, 0x89, 0x0e, 0x68, 0xe3, 0x41, 0xed, 0xe7, + 0x72, 0xf9, 0x6b, 0x7d, 0x3d, 0x64, 0xa4, 0x78, + 0xb5, 0x8b, 0x2f, 0x05, 0x5a, 0x7e, 0x29, 0xd9, + 0x2f, 0x29, 0x8b, 0xd7, 0xfa, 0xff, 0x1c, 0x64, + 0x68, 0xa6, 0x12, 0x35, 0xc2, 0x06, 0x81, 0x8b, + 0xb5, 0xe0, 0x34, 0x2f, 0x4a, 0x84, 0x2d, 0xb0, + 0x9a, 0xc3, 0x0e, 0x8c, 0x54, 0x0d, 0x1a, 0x48, + 0x77, 0x70, 0x4e, 0xb7, 0xda, 0x5d, 0x40, 0x30, + 0xe2, 0x23, 0x0e, 0xaa, 0x1b, 0xa7, 0x3b, 0xf2, + 0x21, 0x60, 0x0f, 0xcc, 0x8f, 0x9b, 0xb9, 0x63, + 0x4f, 0x41, 0x8c, 0x57, 0x36, 0x13, 0x3a, 0xeb, + 0xaa, 0x9c, 0x74, 0xea, 0x0c, 0x41, 0xe5, 0xce, + 0xd6, 0x46, 0x69, 0xc9, 0xe9, 0xee, 0x07, 0xfd, + 0xfd, 0x86, 0x06, 0x35, 0xb4, 0x42, 0x22, 0x19, + 0xac, 0xbb, 0x2a, 0xa5, 0x7f, 0x56, 0x90, 0x18, + 0x66, 0x3a, 0x9a, 0x15, 0x59, 0x49, 0xc0, 0x80, + 0x1f, 0x3a, 0x41, 0x53, 0x0e, 0xeb, 0x96, 0xc6, + 0xdc, 0xa5, 0x73, 0x72, 0x19, 0x45, 0x67, 0x49, + 0xb4, 0x38, 0x0d, 0x4f, 0xcf, 0x93, 0xe4, 0xec, + 0x3c, 0xb1, 0xc8, 0xc9, 0x22, 0xb6, 0xee, 0xab, + 0x4d, 0x10, 0xcf, 0xfc, 0x14, 0x9e, 0x7e, 0x06, + 0x96, 0xb1, 0x1a, 0x52, 0xa4, 0x59, 0xc7, 0xbb, + 0x8c, 0x66, 0x8d, 0x45, 0xf3, 0xf2, 0x8b, 0x8b, + 0x90, 0xc6, 0xd9, 0xe2, 0xe2, 0x82, 0xc0, 0xe2, + 0x33, 0x38, 0x19, 0x00, 0xf6, 0xfa, 0x14, 0x02, + 0x73, 0x0e, 0x80, 0x9d, 0xc3, 0x22, 0x63, 0x52, + 0xee, 0x00, 0xb7, 0xac, 0x28, 0x50, 0xb3, 0xb6, + 0x4f, 0x68, 0x29, 0xa4, 0x34, 0x25, 0xe3, 0x76, + 0x75, 0xb4, 0xa5, 0xea, 0x8a, 0x72, 0x46, 0xe6, + 0x32, 0xd6, 0x19, 0xca, 0x03, 0x09, 0xe8, 0x8d, + 0x30, 0xfb, 0xac, 0x8a, 0xd6, 0xc6, 0x96, 0x32, + 0x8d, 0x04, 0x54, 0x2b, 0x82, 0x44, 0x96, 0x52, + 0x42, 0xa8, 0xdc, 0x52, 0x6d, 0xc0, 0x5a, 0x37, + 0xa1, 0xb5, 0xc7, 0x15, 0x81, 0x09, 0xea, 0x6a, + 0xf2, 0xa1, 0xea, 0x64, 0x2b, 0x1a, 0x52, 0xb0, + 0x1c, 0x5b, 0x31, 0xa3, 0xaa, 0x3d, 0xa2, 0x21, + 0xa7, 0x10, 0x72, 0x96, 0xb5, 0x4a, 0x0f, 0x71, + 0x05, 0x7d, 0x1c, 0x2e, 0x20, 0xbf, 0x81, 0xec, + 0xe0, 0x67, 0x53, 0x5f, 0x55, 0x66, 0x9d, 0xa0, + 0xac, 0x30, 0x9d, 0x8a, 0x56, 0xd3, 0xda, 0xeb, + 0xf7, 0xc9, 0x00, 0xf9, 0x93, 0xef, 0x1a, 0x1b, + 0x01, 0xbb, 0x8e, 0xc2, 0x37, 0x3e, 0x91, 0x54, + 0xce, 0x07, 0x03, 0xaa, 0x73, 0x09, 0xb1, 0xa1, + 0xe3, 0x96, 0xb6, 0xad, 0x71, 0xcb, 0x36, 0x45, + 0xf2, 0x3f, 0x04, 0x83, 0x08, 0x03, 0x4c, 0x2d, + 0xb2, 0x07, 0xc1, 0x65, 0x57, 0x30, 0x53, 0x7e, + 0x43, 0xf6, 0x36, 0x68, 0xfd, 0x86, 0x54, 0x23, + 0x7b, 0xe0, 0x6a, 0x53, 0x03, 0x6d, 0x4a, 0xa8, + 0x14, 0xd9, 0x12, 0x75, 0xae, 0xf6, 0x2d, 0xdb, + 0xb6, 0x8d, 0xb9, 0x9c, 0xcf, 0x0b, 0xd1, 0x96, + 0x5d, 0x1a, 0x66, 0xaa, 0x9a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ca, + 0xde, 0xfd, 0x71, 0x77, 0x7f, 0x7b, 0xff, 0xc3, + 0x9f, 0xab, 0x9f, 0x7f, 0x7d, 0xff, 0xdb, 0xdd, + 0xcd, 0xef, 0xef, 0xee, 0x0f, 0x79, 0xe6, 0x7c, + 0xea, 0x15, 0xfd, 0x97, 0xda, 0xa7, 0xc9, 0xbf, + 0xfe, 0xd0, 0xd7, 0x60 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/line.cpp b/src/mbgl/shaders/line.cpp index a4df33d9b6..5dfce93da4 100644 --- a/src/mbgl/shaders/line.cpp +++ b/src/mbgl/shaders/line.cpp @@ -1,240 +1,276 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* line::name = "line"; -const char* line::vertexSource = R"MBGL_SHADER( - - -// the distance over which the line edge fades out. -// Retina devices need a smaller distance to avoid aliasing. -#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 - -// floor(127 / 2) == 63.0 -// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is -// stored in a byte (-128..127). we scale regular normals up to length 63, but -// there are also "special" normals that have a bigger length (of up to 126 in -// this case). -// #define scale 63.0 -#define scale 0.015873016 - -attribute vec4 a_pos_normal; -attribute vec4 a_data; - -uniform mat4 u_matrix; -uniform mediump float u_ratio; -uniform vec2 u_gl_units_to_pixels; - -varying vec2 v_normal; -varying vec2 v_width2; -varying float v_gamma_scale; -varying highp float v_linesofar; - - -#ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; -attribute highp vec4 a_color; -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; -attribute lowp vec2 a_blur; -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; -attribute mediump vec2 a_gapwidth; -#else -uniform mediump float u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; -attribute lowp vec2 a_offset; -#else -uniform lowp float u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; -attribute mediump vec2 a_width; -#else -uniform mediump float u_width; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_color - color = unpack_mix_vec4(a_color, a_color_t); -#else - highp vec4 color = u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); -#else - lowp float blur = u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); -#else - mediump float gapwidth = u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); -#else - lowp float offset = u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_width - mediump float width = unpack_mix_vec2(a_width, a_width_t); -#else - mediump float width = u_width; -#endif - - - vec2 a_extrude = a_data.xy - 128.0; - float a_direction = mod(a_data.z, 4.0) - 1.0; - - v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0; - - vec2 pos = a_pos_normal.xy; - - // 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; - v_normal = normal; - - // these transformations used to be applied in the JS and native code bases. - // moved them into the shader for clarity and simplicity. - gapwidth = gapwidth / 2.0; - float halfwidth = width / 2.0; - offset = -1.0 * offset; - - float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); - float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); - - // Scale the extrusion vector down to a normal and then up by the line width - // of this vertex. - mediump vec2 dist = outset * a_extrude * scale; - - // Calculate the offset when drawing a line that is to the side of the actual line. - // We do this by creating a vector that points towards the extrude, but rotate - // it when we're drawing round end points (a_direction = -1 or 1) since their - // extrude vector points in another direction. - mediump float u = 0.5 * a_direction; - mediump float t = 1.0 - abs(u); - mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); - - vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); - gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; - - // calculate how much the perspective view squishes or stretches the extrude - float extrude_length_without_perspective = length(dist); - float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); - v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; - - v_width2 = vec2(outset, inset); -} - -)MBGL_SHADER"; -const char* line::fragmentSource = R"MBGL_SHADER( - -#ifndef HAS_UNIFORM_u_color -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -varying vec2 v_width2; -varying vec2 v_normal; -varying float v_gamma_scale; - -void main() { - -#ifdef HAS_UNIFORM_u_color - highp vec4 color = u_color; -#endif - - -#ifdef HAS_UNIFORM_u_blur - lowp float blur = u_blur; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - // Calculate the distance of the pixel from the line in pixels. - float dist = length(v_normal) * v_width2.s; - - // Calculate the antialiasing fade factor. This is either when fading in - // the line in case of an offset line (v_width2.t) or when fading out - // (v_width2.s) - float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; - float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); - - gl_FragColor = color * (alpha * opacity); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* line::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x57, 0x6d, 0x93, 0xd3, 0x36, + 0x10, 0xfe, 0x9e, 0x5f, 0xb1, 0xc3, 0x7d, 0x20, + 0x39, 0x72, 0xce, 0x0b, 0xc7, 0xc1, 0x90, 0xb9, + 0x76, 0x6e, 0x28, 0x6d, 0xd3, 0xa1, 0xc0, 0x70, + 0xf4, 0xe5, 0x9b, 0x47, 0xb1, 0x95, 0x58, 0xad, + 0x6d, 0xb9, 0x96, 0x1c, 0x27, 0x74, 0xfa, 0xdf, + 0xbb, 0xab, 0x17, 0xdb, 0x49, 0x9c, 0x00, 0x03, + 0x13, 0xa3, 0x7d, 0x7b, 0xb4, 0xda, 0x95, 0x9e, + 0x1d, 0x0c, 0x26, 0x13, 0xd0, 0x09, 0x87, 0x58, + 0x28, 0xcd, 0xf2, 0x88, 0x83, 0xdc, 0xf2, 0x12, + 0xea, 0x44, 0x44, 0x89, 0x59, 0x4f, 0x45, 0xce, + 0x81, 0xc7, 0x1b, 0x0e, 0x6b, 0x16, 0x73, 0x05, + 0xb2, 0xd2, 0x01, 0xd9, 0x7c, 0xe2, 0x5a, 0xe4, + 0x0c, 0x62, 0xbe, 0x15, 0x11, 0x2e, 0xe7, 0x9c, + 0xc7, 0xc0, 0x40, 0x65, 0x2c, 0x4d, 0xd1, 0xbe, + 0xf1, 0xa6, 0x25, 0xb0, 0xad, 0x14, 0x28, 0x4b, + 0x05, 0x53, 0x22, 0xdf, 0x04, 0x83, 0xab, 0x98, + 0xaf, 0xc9, 0xe9,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d0, 0x62, 0xf1, 0x78, 0x6b, 0x66, 0x45, 0xa1, + 0xee, 0x66, 0xc6, 0xba, 0x77, 0xf9, 0x31, 0xf2, + 0xe3, 0xd0, 0x46, 0xe6, 0x24, 0x57, 0xb8, 0x4d, + 0xde, 0xf8, 0xee, 0xc8, 0xab, 0xb0, 0xd1, 0xc8, + 0x63, 0xb1, 0x3e, 0x0b, 0x6e, 0x95, 0x56, 0x67, + 0xb0, 0x91, 0xe4, 0x10, 0x9a, 0x11, 0x9b, 0x94, + 0x59, 0x69, 0x0b, 0xac, 0x63, 0x68, 0x05, 0x87, + 0xb8, 0x3a, 0xe2, 0x2a, 0xf4, 0x0a, 0x17, 0x61, + 0xc9, 0x82, 0x45, 0x42, 0xef, 0xfb, 0x91, 0x39, + 0xe1, 0x79, 0x70, 0x4e, 0xa1, 0x17, 0x5f, 0x23, + 0xbb, 0x00, 0xb1, 0xa3, 0x73, 0x11, 0xe5, 0x86, + 0x15, 0xa6, 0x74, 0xfa, 0x61, 0x7a, 0xe9, 0x21, + 0x4e, 0x5f, 0xcc, 0x0e, 0xaa, 0x57, 0x3a, 0xc6, + 0x73, 0x5c, 0xf3, 0x5d, 0xbd, 0xcb, 0x99, 0x5b, + 0xaf, 0x15, 0xd7, 0x67, 0x12, 0x67, 0x64, 0x17, + 0xf2, 0x66, 0xe4, 0x97, 0x53, 0xd3, 0xa8, 0x5c, + 0x44, 0x71, 0x21, 0x2d, 0x5f, 0xcf, 0xc9, 0x37, + 0x25, 0xe4, 0x38, 0x1b, 0xe6, 0x0d, 0xc8, 0x98, + 0xc8, 0x87, 0x23, 0xf8, 0x77, 0x00, 0xf8, 0xe7, + 0x62, 0x3b, 0x92, 0x82, 0xf9, 0x82, 0x7b, 0xa8, + 0x72, 0x3c, 0xef, 0xbf, 0xc3, 0x4c, 0xec, 0x42, + 0xea, 0x9d, 0xa1, 0xeb, 0xbb, 0x71, 0xdb, 0xa0, + 0x23, 0x8f, 0x86, 0xcc, 0x8e, 0xb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99, 0xa5, 0x6b, 0xa2, 0x5c, 0x8b, 0x0e, 0x3c, + 0x64, 0x1a, 0x06, 0x58, 0xcb, 0x38, 0x10, 0x9e, + 0x53, 0x40, 0x1e, 0xb3, 0x23, 0x96, 0x36, 0x03, + 0xb1, 0x06, 0xa1, 0x9f, 0x2a, 0x64, 0x42, 0xa5, + 0xac, 0xf2, 0x18, 0x89, 0x4e, 0x31, 0x86, 0x29, + 0x48, 0x22, 0x51, 0xb5, 0x70, 0xa9, 0x41, 0xf5, + 0x7d, 0xa3, 0x4e, 0x34, 0xce, 0xd1, 0xb7, 0x42, + 0x8a, 0x5c, 0x13, 0x11, 0xc3, 0x9c, 0xa2, 0xed, + 0x8d, 0x73, 0xe7, 0xd7, 0x63, 0x59, 0xe7, 0x07, + 0xa9, 0x35, 0xb8, 0x9c, 0xed, 0x11, 0xb4, 0x2f, + 0xf5, 0xc2, 0x6d, 0xbf, 0x91, 0x7b, 0x76, 0xe2, + 0x21, 0x60, 0x60, 0x85, 0x04, 0xb7, 0x64, 0xb9, + 0xa2, 0x2b, 0x90, 0x58, 0x4f, 0x8e, 0xc1, 0x15, + 0x52, 0x47, 0x24, 0x6c, 0x2b, 0x64, 0x73, 0x45, + 0x91, 0x0a, 0x4b, 0x24, 0x09, 0xe4, 0x2f, 0x8f, + 0x06, 0x55, 0x8e, 0x8a, 0x48, 0xf5, 0x22, 0x89, + 0x07, 0xb5, 0x42, 0x1a, 0xa7, 0x02, 0xef, 0x30, + 0x43, 0xea, 0x1d, 0x93, 0x6a, 0x86, 0x26, 0xe8, + 0x82, 0x8c, 0x54, 0x82, 0xac, 0xbb, 0x04, 0x0c, + 0x00, 0x11, 0x92, 0x4d, 0xea, 0x65, 0x72, 0xa2, + 0x44, 0x86, 0xbe, 0xa9, 0x9d, 0xad, 0x75, 0xa7, + 0x8d, 0x9a, 0xcf, 0x89, 0x3d, 0x81, 0xf6, 0xdc, + 0x13, 0x96, 0xae, 0xbd, 0xd6, 0x89, 0x4a, 0x53, + 0xf3, 0x37, 0x44, 0xc5, 0xaf, 0xc1, 0x17, 0x7e, + 0xc7, 0x5e, 0xe4, 0x56, 0xa3, 0x89, 0xf0, 0x0c, + 0x86, 0xcd, 0xf7, 0x77, 0x44, 0x34, 0xe1, 0xfb, + 0x43, 0x56, 0xff, 0x9a, 0x16, 0x47, 0x5d, 0x0c, + 0x38, 0x3e, 0x9c, 0x38, 0x69, 0x71, 0x5d, 0xf7, + 0x38, 0x24, 0xe6, 0xfe, 0x9a, 0x0a, 0x92, 0xca, + 0x6c, 0xd8, 0xd9, 0xc3, 0xbd, 0x53, 0x98, 0x1a, + 0x85, 0x6e, 0xdc, 0x51, 0x7b, 0x48, 0x8f, 0x86, + 0x03, 0x37, 0x54, 0x5f, 0x51, 0xcd, 0xe3, 0xb1, + 0x23, 0xc3, 0x37, 0xe5, 0x60, 0xe6, 0x13, 0x5f, + 0x02, 0x94, 0x58, 0xd4, 0xcc, 0x89, 0x72, 0xaf, + 0xf6, 0xed, 0xf4, 0xd3, 0x36, 0x36, 0x3a, 0x94, + 0x6b, 0xcb, 0xc0, 0x71, 0x4a, 0xd2, 0x7c, 0x17, + 0x9c, 0xd6, 0x13, 0x8d, 0x3e, 0xb8, 0x3f, 0xb7, + 0xd1, 0xeb, 0x4e, 0x5b, 0x5e, 0x83, 0xe3, 0xaa, + 0xde, 0xd7, 0x1b, 0x96, 0x46, 0x38, 0x42, 0x68, + 0x0b, 0xd0, 0x9d, 0x40, 0x4d, 0x08, 0xe2, 0x92, + 0xd5, 0xc4, 0x8c, 0x98, 0x45, 0x60, 0x26, 0x04, + 0x0c, 0xea, 0x8b, 0x42, 0xc4, 0xdc, 0x02, 0xc1, + 0x22, 0x8b, 0x74, 0x85, 0xd8, 0x49, 0xad, 0x29, + 0xa4, 0x3f, 0x70, 0x9c, 0x93, 0x16, 0x26, 0xee, + 0x23, 0x2a, 0x39, 0x96, 0x9c, 0x71, 0xe6, 0x76, + 0x6e, 0xdc, 0xb9, 0xa6,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xe5, 0x26, + 0xfd, 0x82, 0x97, 0x34, 0x9a, 0x9a, 0xdb, 0x69, + 0x2b, 0x78, 0x0d, 0xea, 0x9f, 0x4a, 0xa8, 0x84, + 0x66, 0xfe, 0x12, 0x67, 0xe2, 0x92, 0xeb, 0x88, + 0xfe, 0xd3, 0x29, 0x94, 0x4e, 0x5f, 0xbb, 0x95, + 0xd0, 0x0e, 0xae, 0xf8, 0x48, 0xe9, 0x04, 0x3b, + 0x20, 0xec, 0xfa, 0xbc, 0x77, 0x53, 0xad, 0xd9, + 0xfc, 0xc1, 0xa5, 0xd0, 0x63, 0xdc, 0x6f, 0x79, + 0xb2, 0x29, 0x7a, 0xe1, 0x26, 0xdd, 0x74, 0x99, + 0x17, 0xa8, 0x6f, 0xda, 0x1c, 0xf9, 0xfb, 0xbc, + 0x33, 0x35, 0xa2, 0xe3, 0x6f, 0xc0, 0x3d, 0xf9, + 0x1a, 0xbe, 0xe6, 0xa5, 0xb4, 0x83, 0x2a, 0x7a, + 0x35, 0xef, 0xbb, 0xbd, 0x01, 0xc6, 0xf6, 0xda, + 0xc4, 0xf0, 0xff, 0x0d, 0xfe, 0x07, 0x19, 0xfc, + 0xc0, 0x02 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* line::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x85, 0x92, 0x51, 0x6f, 0x9b, 0x30, + 0x10, 0xc7, 0xdf, 0xf9, 0x14, 0x27, 0xf5, 0x05, + 0xb2, 0x8c, 0x64, 0xd1, 0xde, 0xa2, 0x3d, 0x44, + 0x29, 0xd5, 0x90, 0xb6, 0xa6, 0xa2, 0x59, 0xb7, + 0x37, 0xeb, 0x06, 0x06, 0x2c, 0x19, 0x1b, 0x61, + 0x93, 0xac, 0x9a, 0xf6, 0xdd, 0x67, 0x1b, 0x68, + 0x08, 0x4d, 0xda, 0x28, 0x42, 0xf2, 0xdd, 0xf9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x05, 0x6c, 0x91, 0xa7, 0x2d, + 0x47, 0x4d, 0x41, 0x97, 0x14, 0x32, 0xa6, 0x34, + 0x8a, 0x94, 0x82, 0xcc, 0xdd, 0xb9, 0x66, 0x7f, + 0x28, 0x87, 0xbc, 0x91, 0x95, 0x3b, 0x72, 0x26, + 0x28, 0x30, 0xd1, 0x85, 0x55, 0xe8, 0x18, 0x9d, + 0x96, 0xbd, 0x68, 0x84, 0x38, 0x15, 0x85, 0x2e, + 0xfd, 0xc1, 0xed, 0x00, 0x66, 0x2f, 0x0f, 0x12, + 0xaa, 0xf5, 0x15, 0x51, 0x14, 0x9a, 0x21, 0x67, + 0xa8, 0xdc, 0xb3, 0x60, 0x46, 0xcd, 0x27, 0xd5, + 0xb2, 0x09, 0x61, 0x5f, 0x32, 0x05, 0xe6, 0x4f, + 0x99, 0xa9, 0x6b, 0xe0, 0x58, 0x52, 0x61, 0x0b, + 0x6c, 0x1d, 0x13, 0x03, 0x6c, 0xdc, 0x58, 0x8a, + 0xca, 0xf5, 0x8e, 0xc2, 0x7c, 0x73, 0x45, 0x75, + 0x97, 0xf1, 0x5f, 0x9a, 0xd0, 0x01, 0xc8, 0x73, + 0x90, 0x6c, 0xf5, 0x40, 0x3a, 0x95, 0xa9, 0x60, + 0x34, 0x9b, 0x7d, 0x86, 0x95, 0x19, 0xce, 0x77, + 0x0f, 0xf3, 0x01, 0x3e, 0x85, 0x4b, 0x58, 0xc0, + 0x6d, 0xf4, 0x14, 0x6f, 0x23, 0xf2, 0x10, 0xff, + 0x8a, 0xbe, 0x91, 0x64, 0xb3, 0x8f, 0x77, 0xdd, + 0xb4, 0x67, 0xfb, 0x74, 0x82, 0x20, 0xaf, 0x4b, + 0x34, 0x90, 0x94, 0x63, 0x55, 0xfb, 0x95, 0x59, + 0x30, 0x67, 0xd9, 0xc7, 0x71, 0x6f, 0xe6, 0xe4, + 0xb4, 0x82, 0xf9, 0xc8, 0x35, 0x13, 0xb4, 0x95, + 0x81, 0x91, 0x74, 0xc9, 0x39, 0x2c, 0xc3, 0xe5, + 0xdc, 0x36, 0x11, 0xf4, 0x86, 0x16, 0x9c, 0xdc, + 0x35, 0x58, 0x6c, 0xfb, 0xed, 0xeb, 0xb6, 0x70, + 0x06, 0x7e, 0x27, 0x39, 0x1b, 0xf6, 0xc0, 0x96, + 0xf7, 0xeb, 0xb3, 0x7b, 0x8a, 0x92, 0xdb, 0x64, + 0xf3, 0x93, 0xc4, 0xf7, 0x8f, 0x0f, 0xd1, 0x76, + 0xbf, 0x4b, 0x2e, 0x81, 0xec, 0x4e, 0xfb, 0x9d, + 0x4e, 0xbf, 0x35, 0xff, 0xbc, 0xff, 0x74, 0x55, + 0x77, 0xc9 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/line_pattern.cpp b/src/mbgl/shaders/line_pattern.cpp index 374fc0a995..775285e05d 100644 --- a/src/mbgl/shaders/line_pattern.cpp +++ b/src/mbgl/shaders/line_pattern.cpp @@ -1,241 +1,325 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* line_pattern::name = "line_pattern"; -const char* line_pattern::vertexSource = R"MBGL_SHADER( -// floor(127 / 2) == 63.0 -// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is -// stored in a byte (-128..127). we scale regular normals up to length 63, but -// there are also "special" normals that have a bigger length (of up to 126 in -// this case). -// #define scale 63.0 -#define scale 0.015873016 - -// We scale the distance before adding it to the buffers so that we can store -// long distances for long segments. Use this value to unscale the distance. -#define LINE_DISTANCE_SCALE 2.0 - -// the distance over which the line edge fades out. -// Retina devices need a smaller distance to avoid aliasing. -#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 - -attribute vec4 a_pos_normal; -attribute vec4 a_data; - -uniform mat4 u_matrix; -uniform mediump float u_ratio; -uniform vec2 u_gl_units_to_pixels; - -varying vec2 v_normal; -varying vec2 v_width2; -varying float v_linesofar; -varying float v_gamma_scale; - - -#ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; -attribute lowp vec2 a_blur; -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; -attribute lowp vec2 a_offset; -#else -uniform lowp float u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; -attribute mediump vec2 a_gapwidth; -#else -uniform mediump float u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; -attribute mediump vec2 a_width; -#else -uniform mediump float u_width; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); -#else - lowp float blur = u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); -#else - lowp float offset = u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); -#else - mediump float gapwidth = u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_width - mediump float width = unpack_mix_vec2(a_width, a_width_t); -#else - mediump float width = u_width; -#endif - - - vec2 a_extrude = a_data.xy - 128.0; - 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; - - // 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; - v_normal = normal; - - // these transformations used to be applied in the JS and native code bases. - // moved them into the shader for clarity and simplicity. - gapwidth = gapwidth / 2.0; - float halfwidth = width / 2.0; - offset = -1.0 * offset; - - float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); - float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); - - // Scale the extrusion vector down to a normal and then up by the line width - // of this vertex. - mediump vec2 dist = outset * a_extrude * scale; - - // Calculate the offset when drawing a line that is to the side of the actual line. - // We do this by creating a vector that points towards the extrude, but rotate - // it when we're drawing round end points (a_direction = -1 or 1) since their - // extrude vector points in another direction. - mediump float u = 0.5 * a_direction; - mediump float t = 1.0 - abs(u); - mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); - - vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); - gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; - - // calculate how much the perspective view squishes or stretches the extrude - float extrude_length_without_perspective = length(dist); - float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); - v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; - - v_linesofar = a_linesofar; - v_width2 = vec2(outset, inset); -} - -)MBGL_SHADER"; -const char* line_pattern::fragmentSource = R"MBGL_SHADER( -uniform vec2 u_pattern_size_a; -uniform vec2 u_pattern_size_b; -uniform vec2 u_pattern_tl_a; -uniform vec2 u_pattern_br_a; -uniform vec2 u_pattern_tl_b; -uniform vec2 u_pattern_br_b; -uniform vec2 u_texsize; -uniform float u_fade; - -uniform sampler2D u_image; - -varying vec2 v_normal; -varying vec2 v_width2; -varying float v_linesofar; -varying float v_gamma_scale; - - -#ifndef HAS_UNIFORM_u_blur -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_blur - lowp float blur = u_blur; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - // Calculate the distance of the pixel from the line in pixels. - float dist = length(v_normal) * v_width2.s; - - // Calculate the antialiasing fade factor. This is either when fading in - // the line in case of an offset line (v_width2.t) or when fading out - // (v_width2.s) - float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; - float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); - - float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0); - float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0); - - // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge - // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0) - // to ensure we don't sample outside the designated symbol on the sprite sheet. - // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of - // the texture coordinate - float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y); - float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y); - vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a)); - vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b)); - - vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade); - - gl_FragColor = color * alpha * opacity; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* line_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x57, 0x5b, 0x6f, 0xdb, 0x36, + 0x14, 0x7e, 0xf7, 0xaf, 0x38, 0x68, 0x1e, 0x6a, + 0xa7, 0x8e, 0x7c, 0x69, 0x9a, 0x16, 0x35, 0xb2, + 0x21, 0x68, 0xb3, 0xcd, 0x43, 0x96, 0x16, 0x4d, + 0xbb, 0xed, 0x4d, 0xa0, 0x25, 0xca, 0xe6, 0x26, + 0x89, 0x9a, 0x48, 0x59, 0x76, 0x87, 0xfd, 0xf7, + 0x9d, 0xc3, 0x8b, 0x2c, 0xdb, 0xb2, 0xdb, 0x22, + 0x45, 0x14, 0x9e, 0x0b, 0x3f, 0x9e, 0x0b, 0xf9, + 0x9d, 0xd1, 0x08, 0x92, 0x54, 0xca, 0xb2, 0x3f, + 0x99, 0xbe, 0x86, 0x11, 0x4c, 0x07, 0x70, 0x7b, + 0x0b, 0x37, 0x2f, 0x83, 0x71, 0x6f, 0x34, 0x02, + 0xbd, 0xe2, 0x90, 0xb1, 0x8d, 0xc8, 0xaa, 0x0c, + 0x58, 0x9a, 0xca, 0x9a, 0xc7, 0x90, 0x09, 0xcd, + 0x4b, 0x48, 0x05, 0xfe, 0x06, 0xa1, 0x60, 0x1a, + 0x8c, 0x81, 0x69, 0xab, 0x29, 0x33, 0x9e, 0xeb, + 0xc0, 0x7c, 0xf3, 0x8d, 0x2e, 0xab, 0x98, 0x43, + 0x2e, 0xcb, 0x8c, 0xa5, 0xa8, 0x48, 0xee, 0x94, + 0x96, 0x25, 0x7a, 0x10, 0x39, 0x30, 0x58, 0x6c, + 0x35, 0x87, 0xfe, 0xd5, 0x64, 0xfa, 0x26, 0x08, + 0x70, 0xeb, 0x41, 0x00, 0x35, 0x07, 0x15, 0xb1, + 0x94, 0x43, 0xc9, 0x97, 0x55, 0xca, 0x4a, 0x67, + 0xab, 0xa0, 0x2a, 0x40, 0x4b, 0x48, 0x79, 0xbe, + 0xd4, 0x2b, 0x84, 0x36, 0x84, 0x45, 0xa5, 0x1d, + 0xba, 0x92, 0x03, 0xa3, 0xff, 0xa9, 0x92, 0xf0, + 0x4c, 0x15, 0x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, 0x48, 0x60, 0x8a, 0x21, 0x8c, 0x41, + 0x12, 0x31, 0xab, 0x85, 0x8b, 0x17, 0xaa, 0x6f, + 0x1b, 0x75, 0xe2, 0x13, 0x8e, 0x12, 0x16, 0x52, + 0x20, 0x8d, 0x41, 0x16, 0x86, 0x81, 0x46, 0xdb, + 0x2b, 0xe7, 0xce, 0xaf, 0xc7, 0xb2, 0xce, 0xf7, + 0xe2, 0x6d, 0x70, 0x39, 0xdb, 0x03, 0x68, 0x5f, + 0x6b, 0x1b, 0x14, 0xff, 0x0c, 0xa3, 0xdc, 0xbf, + 0xc7, 0x1e, 0x02, 0x6e, 0x4c, 0x74, 0xa9, 0x64, + 0xb9, 0xa2, 0x7b, 0x89, 0xde, 0xf9, 0x1c, 0x37, + 0x57, 0xc8, 0x59, 0x90, 0xa0, 0x2c, 0x90, 0xa0, + 0x15, 0x45, 0x2a, 0x2c, 0x39, 0x25, 0x90, 0xbf, + 0x3e, 0x19, 0x54, 0x39, 0x2a, 0x22, 0x7d, 0x8c, + 0x24, 0x66, 0x6f, 0x81, 0xd4, 0x50, 0x05, 0xde, + 0x61, 0x86, 0x2c, 0x29, 0x26, 0xd5, 0x0c, 0x4d, + 0x1c, 0xa7, 0x53, 0x2b, 0x24, 0x48, 0xa5, 0xe1, + 0x6a, 0x11, 0x12, 0x58, 0x6a, 0x70, 0x72, 0xa2, + 0x44, 0x86, 0xbe, 0xa9, 0xc7, 0xad, 0x75, 0xab, + 0x94, 0x9b, 0x4f, 0x43, 0x72, 0xda, 0xa9, 0x5d, + 0xb1, 0x34, 0xf1, 0x5a, 0x47, 0x2a, 0x4d, 0xaf, + 0x5e, 0x11, 0x6b, 0xba, 0x04, 0xdf, 0xb0, 0x2d, + 0x7b, 0x91, 0x5b, 0x8d, 0x66, 0x87, 0x17, 0xd0, + 0x6f, 0xbe, 0x7f, 0x20, 0xf2, 0x0a, 0x3f, 0xee, + 0x13, 0xb0, 0xb7, 0xb4, 0x38, 0x68, 0x63, 0x40, + 0xa6, 0x77, 0xe4, 0x64, 0x87, 0xeb, 0xb2, 0xc3, + 0x21, 0x4d, 0x03, 0x6f, 0xa9, 0x4a, 0xa9, 0xec, + 0xfa, 0xad, 0x33, 0xdc, 0x3a, 0x85, 0xb1, 0x51, + 0x68, 0xef, 0x3b, 0xd8, 0x25, 0xe9, 0xa9, 0x61, + 0xaf, 0xa6, 0x63, 0x14, 0x35, 0x02, 0xa6, 0x1d, + 0x29, 0xb1, 0x29, 0x07, 0x43, 0x25, 0x7d, 0x09, + 0x50, 0x60, 0x51, 0x33, 0x27, 0x1a, 0xbf, 0xd8, + 0xee, 0x88, 0xea, 0xae, 0xdb, 0xd1, 0xa1, 0x4c, + 0x1c, 0x43, 0xe6, 0xa5, 0xe6, 0x9b, 0xe0, 0xb8, + 0x9e, 0x88, 0xa5, 0xe2, 0xf9, 0xdc, 0x41, 0x2f, + 0x5b, 0xbd, 0x7a, 0x09, 0x9e, 0x82, 0x39, 0x5f, + 0xef, 0x58, 0x1a, 0xe1, 0x58, 0xa2, 0x2d, 0x40, + 0x97, 0x81, 0x9a, 0x10, 0xc4, 0x25, 0xab, 0x89, + 0xae, 0x30, 0x8b, 0xc0, 0xd0, 0x79, 0xdc, 0xd4, + 0x17, 0x85, 0x88, 0xb9, 0x05, 0x82, 0x45, 0x16, + 0xe9, 0x0a, 0xb1, 0x93, 0x5a, 0x53, 0x48, 0x38, + 0x36, 0xc4, 0xd2, 0xc2, 0xc4, 0x73, 0x44, 0x25, + 0xc7, 0x92, 0x33, 0xce, 0xdc, 0xc9, 0x8d, 0x3b, + 0xd7, 0x14, 0x5a, 0xd6, 0xac, 0x8c, 0x55, 0x7b, + 0xc2, 0x32, 0xd3, 0x10, 0xf6, 0x9f, 0x46, 0x64, + 0xde, 0xa5, 0x70, 0xc0, 0x6a, 0xfe, 0x1c, 0x47, + 0x0f, 0x0f, 0xcf, 0xf6, 0x28, 0x5e, 0x4f, 0xde, + 0x5b, 0x7f, 0xff, 0xc2, 0x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da, + 0x61, 0x18, 0x5f, 0x2e, 0xbd, 0xc2, 0x0e, 0x08, + 0xdb, 0x3e, 0x6f, 0xdd, 0xa4, 0x6c, 0x0e, 0xbf, + 0x77, 0x29, 0x74, 0x18, 0x77, 0x5b, 0x1e, 0x1d, + 0x8a, 0x9e, 0xbd, 0x51, 0x3b, 0x5c, 0xe6, 0x45, + 0xea, 0x9a, 0xaf, 0x06, 0xfe, 0x3e, 0x6f, 0x0d, + 0x43, 0xe8, 0xf8, 0x3b, 0x70, 0x8f, 0xbe, 0x85, + 0xcf, 0x27, 0x7f, 0xef, 0xe5, 0x64, 0xed, 0x81, + 0xcc, 0x8a, 0xed, 0xe4, 0x86, 0x32, 0xc3, 0x09, + 0xec, 0x05, 0x31, 0xb4, 0xb7, 0x2a, 0xa2, 0xfb, + 0xaf, 0xf7, 0x3f, 0x47, 0x21, 0xaf, 0x4b + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* line_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xa5, 0x55, 0x5d, 0x6f, 0x9b, 0x30, + 0x14, 0x7d, 0xcf, 0xaf, 0xb8, 0xd2, 0x1e, 0x06, + 0x29, 0xa5, 0x69, 0xb4, 0x3d, 0x55, 0x7b, 0xa8, + 0xda, 0x54, 0x8b, 0xb4, 0x35, 0x55, 0xda, 0x75, + 0x7b, 0x43, 0x06, 0x0c, 0x58, 0x32, 0x36, 0xc2, + 0x26, 0x1f, 0x9b, 0xf6, 0xdf, 0x77, 0x6d, 0x0c, + 0x21, 0x49, 0x93, 0x4d, 0x5a, 0x84, 0x88, 0xb8, + 0x1f, 0xe7, 0xdc, 0xeb, 0x7b, 0x6c, 0x37, 0x82, + 0x65, 0xb2, 0x2e, 0x61, 0x45, 0x93, 0x29, 0x34, + 0x51, 0x45, 0xb4, 0xa6, 0xb5, 0x88, 0x14, 0xfb, + 0x49, 0x23, 0x72, 0x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, + 0x6c, 0xa1, 0x8e, 0x2b, 0x34, 0xc1, 0x57, 0x57, + 0x70, 0x47, 0x78, 0xd2, 0x70, 0xa2, 0x29, 0xe8, + 0x82, 0x42, 0xca, 0x94, 0x26, 0x22, 0xa1, 0x20, + 0x33, 0xfb, 0x5d, 0xb1, 0x0d, 0xe5, 0x90, 0xd5, + 0xb2, 0xb4, 0x9f, 0x66, 0x88, 0xc0, 0x44, 0x6b, + 0x56, 0xa1, 0xc5, 0x68, 0xb9, 0x4c, 0x22, 0x12, + 0x71, 0x2a, 0x72, 0x5d, 0x78, 0x9d, 0x3a, 0x7c, + 0x18, 0xf7, 0x92, 0x08, 0xd5, 0xcd, 0x09, 0x52, + 0x22, 0x34, 0x23, 0x9c, 0x11, 0x65, 0x45, 0x81, + 0x42, 0xc4, 0x57, 0xa2, 0x65, 0x1d, 0xc2, 0x4b, + 0xc1, 0x14, 0xe0, 0x43, 0x19, 0xc6, 0xd5, 0xb0, + 0x2e, 0xa8, 0x30, 0x01, 0x26, 0x8e, 0x89, 0x0e, + 0x6c, 0x58, 0x58, 0x42, 0x94, 0xad, 0x9d, 0x08, + 0x7c, 0x67, 0x8a, 0xea, 0xd6, 0xe3, 0xf5, 0x45, + 0x68, 0x1f, 0xe4, 0x3e, 0x90, 0x6c, 0x74, 0x87, + 0xb4, 0x0b, 0x53, 0xfe, 0xa0, 0x37, 0x33, 0x86, + 0x29, 0x36, 0xe7, 0xd9, 0xc1, 0x5c, 0xc0, 0x75, + 0x38, 0x81, 0x2b, 0xb8, 0x9f, 0xbd, 0xce, 0xef, + 0x66, 0xd1, 0xd3, 0xfc, 0xc7, 0xec, 0x4b, 0xb4, + 0xbc, 0x7d, 0x99, 0x2f, 0xda, 0x6e, 0xf7, 0xd4, + 0xbc, 0x03, 0x21, 0xbc, 0x2a, 0x08, 0x82, 0x24, + 0x1c, 0xb7, 0x96, 0x57, 0xa2, 0x30, 0xec, 0x92, + 0x5d, 0x0e, 0x6b, 0xc3, 0x2f, 0xcb, 0xe5, 0x07, + 0x83, 0x55, 0x43, 0xa3, 0x89, 0xf4, 0x91, 0xd2, + 0x3a, 0x03, 0x98, 0x84, 0x93, 0xc0, 0x14, 0xe1, + 0xbb, 0x05, 0x6d, 0x09, 0x36, 0x91, 0x81, 0x2f, + 0x65, 0xea, 0x0d, 0x36, 0x1b, 0x26, 0x1d, 0x1e, + 0x53, 0xe1, 0xa6, 0x4b, 0x1e, 0xe6, 0xc6, 0xff, + 0x92, 0x1b, 0xef, 0x72, 0xbb, 0x25, 0xeb, 0x26, + 0x1d, 0x6e, 0xcd, 0x9c, 0x26, 0x80, 0x60, 0x66, + 0x1e, 0x25, 0x4b, 0x2b, 0xc9, 0x84, 0xee, 0x74, + 0x64, 0x40, 0x03, 0xb8, 0xbc, 0xee, 0xfc, 0xa8, + 0x52, 0x9c, 0x27, 0x4d, 0x73, 0xb4, 0xf6, 0xc6, + 0xa6, 0xaa, 0x9c, 0xb1, 0x43, 0x5f, 0xd3, 0x76, + 0xbd, 0x76, 0x33, 0xb6, 0xab, 0x62, 0x66, 0x66, + 0x66, 0xab, 0x25, 0xc4, 0x14, 0x1f, 0xbd, 0xa6, + 0x38, 0x4f, 0x24, 0x17, 0x29, 0x14, 0x84, 0x3b, + 0xe9, 0xb6, 0x95, 0x43, 0x41, 0x59, 0x5e, 0x68, + 0xa8, 0x78, 0xa3, 0xd0, 0x96, 0xda, 0x99, 0x7b, + 0x53, 0x6c, 0xa2, 0xd7, 0x8f, 0x04, 0x2a, 0x54, + 0x53, 0x53, 0x43, 0x97, 0x4a, 0xf1, 0x5e, 0xbb, + 0xe3, 0xcf, 0xd2, 0xb0, 0xd4, 0xed, 0x0c, 0xaa, + 0x58, 0x2e, 0x50, 0xb2, 0x29, 0xa8, 0x6d, 0x19, + 0x4b, 0x0e, 0x52, 0x58, 0x87, 0xaa, 0x6a, 0x86, + 0x42, 0x56, 0x05, 0xa5, 0x3a, 0xec, 0x30, 0x27, + 0xe1, 0x47, 0xb3, 0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 0x6d, 0xe1, 0xc7, + 0xee, 0xdc, 0x19, 0xef, 0xae, 0xb1, 0xee, 0x0a, + 0x59, 0xbc, 0xce, 0x96, 0xf7, 0xcb, 0xdb, 0xef, + 0xd1, 0xfc, 0xf1, 0xf9, 0x69, 0x76, 0xf7, 0xb2, + 0x58, 0xbe, 0x05, 0x63, 0x4a, 0xf5, 0xda, 0x2d, + 0xef, 0x6e, 0x8e, 0xdf, 0xa3, 0x3f, 0xfb, 0x5c, + 0xf6, 0x33 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/line_sdf.cpp b/src/mbgl/shaders/line_sdf.cpp index 9b6bf47301..bb50859c8d 100644 --- a/src/mbgl/shaders/line_sdf.cpp +++ b/src/mbgl/shaders/line_sdf.cpp @@ -1,302 +1,324 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* line_sdf::name = "line_sdf"; -const char* line_sdf::vertexSource = R"MBGL_SHADER( -// floor(127 / 2) == 63.0 -// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is -// stored in a byte (-128..127). we scale regular normals up to length 63, but -// there are also "special" normals that have a bigger length (of up to 126 in -// this case). -// #define scale 63.0 -#define scale 0.015873016 - -// We scale the distance before adding it to the buffers so that we can store -// long distances for long segments. Use this value to unscale the distance. -#define LINE_DISTANCE_SCALE 2.0 - -// the distance over which the line edge fades out. -// Retina devices need a smaller distance to avoid aliasing. -#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 - -attribute vec4 a_pos_normal; -attribute vec4 a_data; - -uniform mat4 u_matrix; -uniform mediump float u_ratio; -uniform vec2 u_patternscale_a; -uniform float u_tex_y_a; -uniform vec2 u_patternscale_b; -uniform float u_tex_y_b; -uniform vec2 u_gl_units_to_pixels; - -varying vec2 v_normal; -varying vec2 v_width2; -varying vec2 v_tex_a; -varying vec2 v_tex_b; -varying float v_gamma_scale; - - -#ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; -attribute highp vec4 a_color; -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; -attribute lowp vec2 a_blur; -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; -attribute mediump vec2 a_gapwidth; -#else -uniform mediump float u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; -attribute lowp vec2 a_offset; -#else -uniform lowp float u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; -attribute mediump vec2 a_width; -varying mediump float width; -#else -uniform mediump float u_width; -#endif - - -#ifndef HAS_UNIFORM_u_floorwidth -uniform lowp float a_floorwidth_t; -attribute lowp vec2 a_floorwidth; -varying lowp float floorwidth; -#else -uniform lowp float u_floorwidth; -#endif - - -void main() { - -#ifndef HAS_UNIFORM_u_color - color = unpack_mix_vec4(a_color, a_color_t); -#else - highp vec4 color = u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); -#else - lowp float blur = u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); -#else - mediump float gapwidth = u_gapwidth; -#endif - - -#ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); -#else - lowp float offset = u_offset; -#endif - - -#ifndef HAS_UNIFORM_u_width - width = unpack_mix_vec2(a_width, a_width_t); -#else - mediump float width = u_width; -#endif - - -#ifndef HAS_UNIFORM_u_floorwidth - floorwidth = unpack_mix_vec2(a_floorwidth, a_floorwidth_t); -#else - lowp float floorwidth = u_floorwidth; -#endif - - - vec2 a_extrude = a_data.xy - 128.0; - 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; - - // 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; - v_normal = normal; - - // these transformations used to be applied in the JS and native code bases. - // moved them into the shader for clarity and simplicity. - gapwidth = gapwidth / 2.0; - float halfwidth = width / 2.0; - offset = -1.0 * offset; - - float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); - float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); - - // Scale the extrusion vector down to a normal and then up by the line width - // of this vertex. - mediump vec2 dist =outset * a_extrude * scale; - - // Calculate the offset when drawing a line that is to the side of the actual line. - // We do this by creating a vector that points towards the extrude, but rotate - // it when we're drawing round end points (a_direction = -1 or 1) since their - // extrude vector points in another direction. - mediump float u = 0.5 * a_direction; - mediump float t = 1.0 - abs(u); - mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); - - vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); - gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; - - // calculate how much the perspective view squishes or stretches the extrude - float extrude_length_without_perspective = length(dist); - float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); - v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; - - v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a); - v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b); - - v_width2 = vec2(outset, inset); -} - -)MBGL_SHADER"; -const char* line_sdf::fragmentSource = R"MBGL_SHADER( - -uniform sampler2D u_image; -uniform float u_sdfgamma; -uniform float u_mix; - -varying vec2 v_normal; -varying vec2 v_width2; -varying vec2 v_tex_a; -varying vec2 v_tex_b; -varying float v_gamma_scale; - - -#ifndef HAS_UNIFORM_u_color -varying highp vec4 color; -#else -uniform highp vec4 u_color; -#endif - - -#ifndef HAS_UNIFORM_u_blur -varying lowp float blur; -#else -uniform lowp float u_blur; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_width -varying mediump float width; -#else -uniform mediump float u_width; -#endif - - -#ifndef HAS_UNIFORM_u_floorwidth -varying lowp float floorwidth; -#else -uniform lowp float u_floorwidth; -#endif - - -void main() { - -#ifdef HAS_UNIFORM_u_color - highp vec4 color = u_color; -#endif - - -#ifdef HAS_UNIFORM_u_blur - lowp float blur = u_blur; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - -#ifdef HAS_UNIFORM_u_width - mediump float width = u_width; -#endif - - -#ifdef HAS_UNIFORM_u_floorwidth - lowp float floorwidth = u_floorwidth; -#endif - - - // Calculate the distance of the pixel from the line in pixels. - float dist = length(v_normal) * v_width2.s; - - // Calculate the antialiasing fade factor. This is either when fading in - // the line in case of an offset line (v_width2.t) or when fading out - // (v_width2.s) - float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; - float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); - - float sdfdist_a = texture2D(u_image, v_tex_a).a; - float sdfdist_b = texture2D(u_image, v_tex_b).a; - float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix); - alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist); - - gl_FragColor = color * (alpha * opacity); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* line_sdf::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x95, 0x58, 0x6d, 0x6f, 0xdb, 0x36, + 0x10, 0xfe, 0xee, 0x5f, 0x71, 0x68, 0x3f, 0xd4, + 0x76, 0x1d, 0xf9, 0xa5, 0x69, 0x5a, 0x34, 0xc8, + 0x86, 0xa0, 0xcb, 0x36, 0x0f, 0x59, 0x5a, 0x34, + 0xed, 0xb6, 0x6f, 0x02, 0x2d, 0xd1, 0x36, 0x37, + 0x49, 0xf4, 0x44, 0xca, 0x2f, 0x1d, 0xf6, 0xdf, + 0x77, 0x47, 0x91, 0x12, 0x65, 0xcb, 0x6a, 0x16, + 0x38, 0xb0, 0xcc, 0x7b, 0x7b, 0x78, 0xbc, 0x3b, + 0xdd, 0x71, 0x3c, 0x86, 0x65, 0x22, 0x65, 0xde, + 0x9f, 0xce, 0xde, 0xc0, 0x18, 0x66, 0x03, 0xb8, + 0xb9, 0x81, 0xab, 0x57, 0xc1, 0xa4, 0x37, 0x1e, + 0x83, 0x5e, 0x73, 0x48, 0xd9, 0x5e, 0xa4, 0x45, + 0x0a, 0x2c, 0x49, 0xe4, 0x8e, 0xc7, 0x90, 0x0a, + 0xcd, 0x73, 0x48, 0x04, 0x7e, 0x83, 0x50, 0x30, + 0x0b, 0x26, 0xc0, 0x74, 0xc9, 0x29, 0x53, 0x9e, + 0xe9, 0xc0, 0x3c, 0xf3, 0xbd, 0xce, 0x8b, 0x98, + 0x43, 0x26, 0xf3, 0x94, 0x25, 0xc8, 0x48, 0xea, + 0x94, 0x96, 0x39, 0x6a, 0x10, 0x19, 0x30, 0x58, + 0x1c, 0x34, 0x87, 0xfe, 0xc5, 0x74, 0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, 0x9e, 0x97, + 0xbe, 0x0d, 0x59, 0x4d, 0x76, 0x52, 0x9a, 0xef, + 0xc3, 0x83, 0x4f, 0x68, 0x93, 0x5b, 0x9c, 0x93, + 0x5b, 0x9c, 0xc8, 0xad, 0x92, 0x10, 0x57, 0xb4, + 0x0a, 0xb5, 0x0c, 0x37, 0x62, 0xcf, 0x13, 0x85, + 0x3b, 0xd9, 0xb2, 0xfc, 0x40, 0x11, 0x64, 0x78, + 0xb6, 0xd5, 0xc6, 0x8f, 0x96, 0x77, 0x22, 0xd6, + 0xeb, 0xd9, 0xc9, 0x32, 0x59, 0x62, 0xad, 0xab, + 0x8b, 0x7a, 0xb5, 0x84, 0xb5, 0x0d, 0x57, 0x2c, + 0x4d, 0x59, 0x68, 0x50, 0xa3, 0xdd, 0xde, 0x73, + 0xb1, 0xcc, 0xf0, 0xbc, 0xe0, 0xe7, 0xdb, 0xc7, + 0xf0, 0xcb, 0xc3, 0xfc, 0xc7, 0x0f, 0x9f, 0x7e, + 0x0d, 0x8b, 0x30, 0x92, 0x89, 0xcc, 0x2b, 0xe0, + 0x58, 0x19, 0x9c, 0x13, 0x59, 0x49, 0x0a, 0xb5, + 0x7f, 0x28, 0x6b, 0xb1, 0x5a, 0x6f, 0xdc, 0xd1, + 0x18, 0x7a, 0x6d, 0xd6, 0xa3, 0x59, 0xca, 0x73, + 0xdc, 0x31, 0xaf, 0x74, 0x7b, 0xf4, 0x22, 0xac, + 0x38, 0xb2, 0x58, 0x2c, 0xcf, 0x82, 0x5b, 0x24, + 0xc5, 0x19, 0x6c, 0x44, 0x69, 0x42, 0x33, 0x64, + 0xe3, 0x90, 0x92, 0x5a, 0x03, 0xf3, 0x04, 0x4b, + 0x42, 0x13, 0x97, 0x47, 0x2e, 0x42, 0xc7, 0xd0, + 0x09, 0x4b, 0x6e, 0x58, 0x24, 0xf4, 0xa1, 0x1d, + 0x99, 0x25, 0x9e, 0x07, 0x67, 0x19, 0x5a, 0xf1, + 0x55, 0xb4, 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x08, 0x3a, 0xb0, + 0x54, 0xc5, 0x80, 0x78, 0x9a, 0x01, 0xe9, 0x48, + 0xad, 0xd8, 0x1c, 0x71, 0xd4, 0x28, 0x19, 0x0d, + 0x74, 0xe7, 0xb5, 0xb5, 0xd4, 0x85, 0x2e, 0x77, + 0x95, 0xb5, 0xe1, 0x78, 0xc3, 0x66, 0xb5, 0xdd, + 0x6f, 0x86, 0x34, 0xf2, 0x4a, 0xc7, 0x59, 0xaf, + 0x55, 0x4a, 0x4e, 0x4a, 0x44, 0x07, 0xa0, 0xda, + 0x61, 0xe7, 0xfd, 0x53, 0x39, 0xe7, 0xdb, 0x9e, + 0xa9, 0xdd, 0xf2, 0x74, 0x9f, 0x78, 0x45, 0x80, + 0xb8, 0xea, 0x9f, 0xad, 0x60, 0x6a, 0xf2, 0xe8, + 0xa8, 0x40, 0x9c, 0x73, 0x4c, 0x53, 0x61, 0x7b, + 0xa6, 0x93, 0x88, 0xad, 0x27, 0x6e, 0x18, 0xb8, + 0xb1, 0x8d, 0x59, 0xb0, 0x3f, 0xc0, 0x05, 0x50, + 0xeb, 0x3f, 0xb9, 0x76, 0x00, 0x4d, 0x71, 0x8a, + 0x45, 0xce, 0x23, 0x6c, 0xc1, 0x32, 0x64, 0x4d, + 0x65, 0xdc, 0xb7, 0xec, 0x5f, 0x47, 0x70, 0x19, + 0x4c, 0x06, 0x24, 0x73, 0x2c, 0x41, 0xcd, 0xa9, + 0x92, 0x4b, 0x46, 0x39, 0xd6, 0x2f, 0x07, 0x19, + 0x27, 0x84, 0x8d, 0xa3, 0x91, 0x7a, 0xe9, 0xac, + 0xee, 0x60, 0x08, 0x57, 0x66, 0x69, 0xd8, 0xd6, + 0x0c, 0x5f, 0x7b, 0x98, 0xb1, 0xb7, 0x34, 0x68, + 0xeb, 0x1e, 0x13, 0x31, 0x5b, 0x06, 0x6c, 0x7d, + 0xf7, 0x34, 0xf9, 0x4c, 0x41, 0x2c, 0xb1, 0xa1, + 0x7f, 0xa1, 0xb0, 0xeb, 0xcd, 0x65, 0x91, 0xc5, + 0xd8, 0xc0, 0x6f, 0x46, 0x30, 0x01, 0x49, 0x83, + 0xc9, 0x4e, 0x58, 0xb7, 0x21, 0xfb, 0xa1, 0x62, + 0xa7, 0x7e, 0xda, 0x8e, 0x44, 0x1b, 0x29, 0xb0, + 0x8d, 0xc7, 0x29, 0x04, 0x9d, 0x8e, 0xb2, 0x17, + 0x56, 0x9d, 0x5b, 0x8f, 0xe5, 0x2e, 0x6b, 0x44, + 0x83, 0xc1, 0x65, 0x65, 0x8f, 0xa0, 0x7d, 0xdd, + 0x95, 0x4e, 0x71, 0x6d, 0x21, 0xd2, 0x5d, 0x7f, + 0xe8, 0x20, 0xa0, 0x61, 0x1a, 0x17, 0x72, 0x96, + 0x29, 0xaa, 0xd4, 0xd4, 0xe7, 0x66, 0x68, 0x5c, + 0x61, 0xcf, 0x8e, 0x0d, 0xfa, 0x02, 0x07, 0x94, + 0xcd, 0x26, 0x11, 0xe5, 0x70, 0x46, 0x20, 0x7f, + 0x79, 0x34, 0xa8, 0x32, 0x64, 0xc4, 0xf1, 0x29, + 0x92, 0x78, 0x7a, 0x0b, 0x1c, 0x8d, 0x54, 0xe0, + 0x14, 0xa6, 0x38, 0x25, 0xc4, 0xc4, 0x9a, 0xa2, + 0x88, 0x9d, 0x69, 0xd4, 0x1a, 0x07, 0x84, 0xdc, + 0xcc, 0x2a, 0x11, 0x0e, 0x70, 0x54, 0x70, 0x48, + 0x89, 0x12, 0x29, 0xea, 0xa6, 0x9a, 0x53, 0x4a, + 0x7b, 0xb9, 0x5e, 0x3d, 0x9a, 0x26, 0xdf, 0x3f, + 0xda, 0x35, 0x4b, 0x96, 0x8e, 0xeb, 0x84, 0xa5, + 0x4a, 0xcc, 0x0b, 0x9a, 0x1a, 0x86, 0xe0, 0xb2, + 0xd3, 0x93, 0x17, 0x59, 0xc9, 0x51, 0x59, 0x78, + 0x09, 0xfd, 0xea, 0xf9, 0x3b, 0x1a, 0xde, 0xe0, + 0xfb, 0xe6, 0x00, 0xf2, 0x8e, 0x16, 0x07, 0x3e, + 0x06, 0x9c, 0x74, 0x4e, 0x94, 0xd4, 0xb8, 0x86, + 0x2d, 0x0a, 0x69, 0x1a, 0x7e, 0x47, 0x51, 0x4a, + 0x61, 0xd7, 0xf7, 0xf6, 0x70, 0x63, 0x19, 0x26, + 0x86, 0xc1, 0xb7, 0x3b, 0xa8, 0x0f, 0xe9, 0xb1, + 0x9a, 0xde, 0x4c, 0xc6, 0x28, 0x4a, 0x04, 0x3c, + 0x76, 0x1c, 0x09, 0x4d, 0x38, 0x98, 0x51, 0xca, + 0x85, 0x00, 0x39, 0x16, 0x39, 0x33, 0x1a, 0x63, + 0x17, 0x87, 0x7a, 0x50, 0xab, 0xb3, 0x1e, 0x15, + 0xca, 0xa5, 0x9d, 0x10, 0x79, 0x8e, 0xcd, 0x7e, + 0x70, 0x1a, 0x4f, 0x34, 0xa5, 0xc1, 0x8d, 0xdd, + 0xe7, 0xd0, 0x4b, 0xd5, 0x21, 0xb8, 0x01, 0xc0, + 0xaa, 0x7a, 0xcf, 0x92, 0x08, 0xa7, 0x72, 0x5d, + 0xe2, 0xb3, 0x07, 0xb0, 0x23, 0x00, 0x71, 0xce, + 0x76, 0xd4, 0x21, 0xb0, 0x12, 0x80, 0x99, 0x66, + 0xd1, 0xa6, 0x8b, 0x09, 0x11, 0xf3, 0x12, 0x07, + 0xc6, 0x58, 0xa4, 0x0b, 0x84, 0x4e, 0x6c, 0x55, + 0x1c, 0xe1, 0xd4, 0x1c, 0xcb, 0x12, 0x25, 0x6e, + 0x23, 0xca, 0x39, 0x46, 0x9c, 0x51, 0x66, 0x37, + 0x6e, 0xd4, 0xd9, 0x9c, 0xd0, 0x72, 0xc7, 0xf2, + 0x58, 0xf9, 0x17, 0x0c, 0xe6, 0x32, 0x00, 0xd3, + 0x4f, 0x23, 0x32, 0xa7, 0x52, 0x58, 0x60, 0x3b, + 0xfe, 0x02, 0x27, 0x6f, 0x07, 0xaf, 0x4c, 0x51, + 0xac, 0x4e, 0x4e, 0x5b, 0xbf, 0x59, 0x6f, 0x30, + 0x01, 0xd1, 0xdc, 0x74, 0x80, 0x88, 0xcd, 0xd8, + 0xba, 0xe6, 0x22, 0x77, 0x1a, 0x9d, 0x57, 0x2c, + 0x26, 0xab, 0x80, 0xee, 0x31, 0x32, 0x93, 0xec, + 0x50, 0x29, 0x0a, 0x5a, 0x2a, 0x78, 0x01, 0x74, + 0xfa, 0xaf, 0x8d, 0x7f, 0x2b, 0xc6, 0xeb, 0x16, + 0x46, 0x0a, 0x35, 0x0a, 0xe8, 0x0b, 0x60, 0x0b, + 0xd5, 0x2f, 0x06, 0xd7, 0xa7, 0x07, 0x56, 0x3a, + 0x7e, 0x86, 0x8c, 0xf6, 0x08, 0x5a, 0x0e, 0x0d, + 0xbf, 0x6d, 0x61, 0x38, 0xe0, 0x23, 0xe6, 0xfa, + 0xac, 0x8f, 0xaf, 0xbb, 0x8b, 0x62, 0x04, 0xf8, + 0xd1, 0x83, 0xba, 0xce, 0x5d, 0xc2, 0x26, 0x97, + 0x7f, 0x22, 0x1e, 0x1e, 0x7b, 0x35, 0xda, 0x8d, + 0xc9, 0x28, 0x6b, 0xfa, 0x2c, 0x13, 0x23, 0x63, + 0x37, 0x1d, 0x8f, 0x28, 0x84, 0x47, 0x5e, 0xaa, + 0xe0, 0xb4, 0xfa, 0x51, 0x2a, 0x61, 0xbd, 0x78, + 0x2c, 0x4c, 0x85, 0xf4, 0x65, 0x85, 0xfa, 0x58, + 0x8b, 0x4d, 0x94, 0x13, 0x14, 0x75, 0xd8, 0x45, + 0x55, 0xd8, 0xad, 0xe5, 0x0e, 0xd2, 0xc2, 0xde, + 0x49, 0x6c, 0x78, 0x4e, 0xb7, 0x3d, 0xa6, 0x38, + 0x6d, 0x05, 0xdf, 0x81, 0xfa, 0xbb, 0x10, 0x6a, + 0x4d, 0xb7, 0x13, 0x39, 0x28, 0x9d, 0x73, 0x1d, + 0xd1, 0x0f, 0x2f, 0x50, 0xbc, 0xb4, 0xb6, 0x2b, + 0x61, 0x79, 0x17, 0x84, 0xaf, 0x55, 0xbd, 0xc6, + 0x0c, 0x08, 0x7d, 0x9d, 0x37, 0xf6, 0xa2, 0xc8, + 0x6c, 0xbe, 0x51, 0x13, 0x5a, 0x84, 0xdb, 0x25, + 0x4f, 0x36, 0x45, 0x6f, 0xbd, 0xb1, 0xef, 0x2e, + 0xf3, 0x42, 0x6a, 0x1b, 0xf7, 0x07, 0xae, 0x9c, + 0x7b, 0xa3, 0x38, 0x2a, 0x7e, 0x02, 0xee, 0xf1, + 0xb7, 0xf0, 0xb9, 0xc3, 0x2f, 0xaf, 0x04, 0x50, + 0xa9, 0xed, 0x01, 0xea, 0xf7, 0xe8, 0xf0, 0xe4, + 0xc6, 0x23, 0xd8, 0xc3, 0x18, 0xfc, 0x26, 0xc1, + 0x8b, 0xae, 0x13, 0xde, 0x03, 0x9e, 0x67, 0x75, + 0x25, 0x52, 0x6d, 0xc4, 0x5c, 0x35, 0x3c, 0xc9, + 0xda, 0xe2, 0x7f, 0x58, 0x5b, 0x34, 0xac, 0x2d, + 0xaa, 0xc8, 0xb6, 0xd7, 0x20, 0xce, 0x5e, 0x59, + 0xde, 0x46, 0xe5, 0x2b, 0x01, 0x99, 0xfe, 0xed, + 0xfd, 0x07, 0xb4, 0x2b, 0xfd, 0x49 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* line_sdf::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x85, 0x55, 0x5d, 0x6f, 0x9b, 0x30, + 0x14, 0x7d, 0xe7, 0x57, 0x5c, 0xa9, 0x2f, 0xd0, + 0x65, 0x34, 0x8b, 0xd6, 0xa7, 0xa8, 0x0f, 0x55, + 0x92, 0x6a, 0x91, 0xb6, 0xa6, 0x4a, 0xd3, 0x6e, + 0x6f, 0x96, 0x03, 0x06, 0x2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2e, 0x6a, 0x74, 0x7c, 0x2e, 0xca, 0xd8, 0x71, + 0x1c, 0x45, 0x72, 0x12, 0xd3, 0x2a, 0x6f, 0x58, + 0x2c, 0xd6, 0x57, 0x39, 0x75, 0xa9, 0x09, 0x3e, + 0x95, 0xd1, 0xde, 0xa2, 0x3c, 0xd5, 0xea, 0xa4, + 0xdb, 0xa2, 0x17, 0x6b, 0x3a, 0x75, 0xab, 0xf5, + 0x0e, 0x82, 0xc6, 0x90, 0x63, 0xca, 0xfd, 0x00, + 0xfe, 0x7a, 0xa0, 0x7f, 0x26, 0x85, 0xb1, 0xe3, + 0x60, 0xf0, 0xfe, 0x51, 0x80, 0xbb, 0xf3, 0x91, + 0x8f, 0xf3, 0xd8, 0xa9, 0x1b, 0xb8, 0x37, 0x71, + 0xcb, 0x72, 0x3a, 0xd9, 0x71, 0x92, 0x66, 0xb8, + 0x3d, 0x9e, 0xda, 0x6c, 0xa9, 0xce, 0x06, 0x38, + 0xce, 0xe6, 0xfa, 0x6a, 0xf0, 0x81, 0xf9, 0x59, + 0xb2, 0x5e, 0xd3, 0xc6, 0xa9, 0x3a, 0x73, 0xea, + 0xe5, 0xd6, 0x22, 0x96, 0x71, 0x70, 0x16, 0x26, + 0xe4, 0xe6, 0x06, 0x16, 0x98, 0x45, 0x15, 0xc3, + 0x8a, 0x80, 0xca, 0x08, 0xc4, 0x54, 0x2a, 0xcc, + 0x23, 0x02, 0x22, 0xb1, 0xef, 0x05, 0x7d, 0x27, + 0x0c, 0x92, 0x52, 0xe4, 0xf6, 0x95, 0x51, 0x4e, + 0x80, 0x72, 0x67, 0x96, 0xa1, 0xe5, 0x70, 0x8a, + 0x26, 0x50, 0x6b, 0x31, 0xc2, 0x53, 0x95, 0xf9, + 0xcd, 0x42, 0x09, 0xe0, 0xfa, 0xb8, 0x45, 0x42, + 0x39, 0x1f, 0x11, 0xc5, 0x5c, 0x51, 0xcc, 0x28, + 0x96, 0x76, 0x6d, 0xe0, 0x98, 0xe8, 0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d7, 0x77, 0x20, 0x73, 0x21, 0x54, 0x26, + 0x15, 0x29, 0xfc, 0x69, 0x78, 0xab, 0x0b, 0x6b, + 0xbf, 0x53, 0xba, 0xba, 0xf6, 0x94, 0x9a, 0x12, + 0x6f, 0x75, 0xa3, 0x47, 0xe1, 0x5a, 0xa8, 0x69, + 0x40, 0xca, 0xd0, 0x43, 0x89, 0xd3, 0x45, 0xbd, + 0x20, 0xdc, 0xa2, 0xb8, 0x06, 0xbf, 0x16, 0x6e, + 0xae, 0xaa, 0x71, 0xaf, 0x2f, 0xd2, 0xe6, 0x75, + 0xb5, 0x5d, 0x6e, 0xef, 0x7f, 0xa3, 0xf5, 0xe3, + 0xf3, 0xd3, 0x6a, 0xb1, 0xdb, 0x6c, 0x87, 0x88, + 0xcc, 0xda, 0xf1, 0x5d, 0xa3, 0xeb, 0x6b, 0xf3, + 0xcf, 0xfb, 0x0f, 0x29, 0x1c, 0x77, 0x3b + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/preludes.cpp b/src/mbgl/shaders/preludes.cpp index 6baa488a10..6a3586f8fd 100644 --- a/src/mbgl/shaders/preludes.cpp +++ b/src/mbgl/shaders/preludes.cpp @@ -1,106 +1,158 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { -const char* vertexPrelude = R"MBGL_SHADER( -#ifdef GL_ES -precision highp float; -#else - -#if !defined(lowp) -#define lowp -#endif - -#if !defined(mediump) -#define mediump -#endif - -#if !defined(highp) -#define highp -#endif - -#endif - -// Unpack a pair of values that have been packed into a single float. -// The packed values are assumed to be 8-bit unsigned integers, and are -// packed like so: -// packedValue = floor(input[0]) * 256 + input[1], -vec2 unpack_float(const float packedValue) { - int packedIntValue = int(packedValue); - int v0 = packedIntValue / 256; - return vec2(v0, packedIntValue - v0 * 256); -} - -vec2 unpack_opacity(const float packedOpacity) { - int intOpacity = int(packedOpacity) / 2; - return vec2(float(intOpacity) / 127.0, mod(packedOpacity, 2.0)); -} - -// To minimize the number of attributes needed, we encode a 4-component -// color into a pair of floats (i.e. a vec2) as follows: -// [ floor(color.r * 255) * 256 + color.g * 255, -// floor(color.b * 255) * 256 + color.g * 255 ] -vec4 decode_color(const vec2 encodedColor) { - return vec4( - unpack_float(encodedColor[0]) / 255.0, - unpack_float(encodedColor[1]) / 255.0 - ); -} - -// Unpack a pair of paint values and interpolate between them. -float unpack_mix_vec2(const vec2 packedValue, const float t) { - return mix(packedValue[0], packedValue[1], t); -} - -// Unpack a pair of paint values and interpolate between them. -vec4 unpack_mix_vec4(const vec4 packedColors, const float t) { - vec4 minColor = decode_color(vec2(packedColors[0], packedColors[1])); - vec4 maxColor = decode_color(vec2(packedColors[2], packedColors[3])); - return mix(minColor, maxColor, t); -} - -// The offset depends on how many pixels are between the world origin and the edge of the tile: -// vec2 offset = mod(pixel_coord, size) -// -// At high zoom levels there are a ton of pixels between the world origin and the edge of the tile. -// The glsl spec only guarantees 16 bits of precision for highp floats. We need more than that. -// -// The pixel_coord is passed in as two 16 bit values: -// pixel_coord_upper = floor(pixel_coord / 2^16) -// pixel_coord_lower = mod(pixel_coord, 2^16) -// -// The offset is calculated in a series of steps that should preserve this precision: -vec2 get_pattern_pos(const vec2 pixel_coord_upper, const vec2 pixel_coord_lower, - const vec2 pattern_size, const float tile_units_to_pixels, const vec2 pos) { - - vec2 offset = mod(mod(mod(pixel_coord_upper, pattern_size) * 256.0, pattern_size) * 256.0 + pixel_coord_lower, pattern_size); - return (tile_units_to_pixels * pos + offset) / pattern_size; -} - -)MBGL_SHADER"; -const char* fragmentPrelude = R"MBGL_SHADER( -#ifdef GL_ES -precision mediump float; -#else - -#if !defined(lowp) -#define lowp -#endif - -#if !defined(mediump) -#define mediump -#endif - -#if !defined(highp) -#define highp -#endif - -#endif - -)MBGL_SHADER"; +const char* vertexPrelude = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x55, 0xdf, 0x8f, 0xdb, 0x44, + 0x10, 0x7e, 0xf7, 0x5f, 0x31, 0xe8, 0x5e, 0x12, + 0xf0, 0xf9, 0x92, 0x34, 0x77, 0xa0, 0x56, 0x7d, + 0x40, 0x08, 0x21, 0x24, 0x24, 0x1e, 0xa0, 0xf0, + 0x50, 0x1d, 0x96, 0x63, 0x8f, 0x9d, 0x55, 0xed, + 0x5d, 0x6b, 0x77, 0x9d, 0xdc, 0xb5, 0xe2, 0x7f, + 0x67, 0x66, 0x77, 0x1d, 0xaf, 0x9d, 0x2b, 0x2a, + 0x12, 0x91, 0x7c, 0xb9, 0x8c, 0xbf, 0x99, 0xf9, + 0xe6, 0xf7, 0x8d, 0xa8, 0x2b, 0xac, 0xe1, 0xa7, + 0x5f, 0xf2, 0x1f, 0x7f, 0x4b, 0x7a, 0x8d, 0xa5, + 0x30, 0x42, 0x49, 0x38, 0x8a, 0xe6, 0xd8, 0x43, + 0xdd, 0xaa, 0xc2, 0xbe, 0x49, 0x6e, 0xb0, 0x35, + 0x98, 0x24, 0x37, 0xa2, 0x86, 0xaf, 0x08, 0x2c, + 0x24, 0x56, 0xab, 0x56, 0x9d, 0xfb, 0x75, 0x72, + 0xe3, 0x7f, 0x02, 0xff, 0x22, 0x98, 0xac, 0x44, + 0xbd, 0xc0, 0x75, 0x58, 0x89, 0xa1, 0x8b, 0xa0, + 0x41, 0xf0, 0x32, 0xda, 0xb9, 0x9d, 0xb0, 0xee, + 0xe7, 0x84, 0x0c, 0xdf, 0x77, 0x77, 0xf0, 0x4e, + 0xf6, 0x45, 0xf9, 0x01, 0x0a, 0xe8, 0x0b, 0xa1, + 0x41, 0xd5, 0x70, 0x2a, 0xda, 0x01, 0x0d, 0xd8, + 0x63, 0x61, 0xe1, 0x58, 0x9c, 0x10, 0x0e, 0x88, + 0x12, 0x18, 0x84, 0x15, 0x08, 0x69, 0x15, 0x61, + 0x8d,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e2, 0x7b, 0x2a, 0x38, 0xed, 0xc4, 0x53, 0xee, + 0xba, 0x22, 0x8a, 0x33, 0x6a, 0xf9, 0x14, 0xe2, + 0x3e, 0xb4, 0x8b, 0xa8, 0x49, 0x39, 0x9e, 0x0f, + 0x8a, 0x2e, 0x8d, 0x95, 0x79, 0x12, 0x49, 0xe7, + 0xff, 0xe0, 0xec, 0xea, 0x32, 0xa7, 0xbc, 0x9f, + 0x28, 0xef, 0x83, 0x57, 0x97, 0x34, 0xf3, 0x19, + 0xce, 0x0e, 0x47, 0xdd, 0xeb, 0x40, 0x34, 0x2e, + 0xb3, 0x2a, 0xbb, 0x14, 0xc4, 0x46, 0xa2, 0x58, + 0x82, 0x80, 0x6a, 0x11, 0x16, 0x80, 0xb7, 0x54, + 0x3c, 0x7d, 0xa1, 0xa5, 0xdd, 0xd2, 0xd2, 0xab, + 0x8b, 0xa5, 0x28, 0x8f, 0x23, 0xb3, 0xf4, 0x62, + 0x39, 0xce, 0x1d, 0xaf, 0x56, 0x55, 0xd7, 0x06, + 0x2d, 0x79, 0xeb, 0x69, 0x71, 0x1b, 0xe0, 0xab, + 0xa2, 0xce, 0x84, 0x96, 0xcf, 0xd0, 0x8b, 0x27, + 0xba, 0x29, 0x6e, 0xdd, 0x46, 0x79, 0x83, 0xb3, + 0xd2, 0x6d, 0x05, 0x4a, 0x8b, 0x46, 0x48, 0x97, + 0x60, 0x16, 0x62, 0xd5, 0xb0, 0x2d, 0xf7, 0xbf, + 0x15, 0x2d, 0xba, 0xb9, 0x72, 0x75, 0x0f, 0x0e, + 0xde, 0xfa, 0x35, 0xc0, 0x26, 0x29, 0x26, 0xa5, + 0x69, 0x94, 0x0d, 0x0d, 0xfc, 0x9a, 0x70, 0x0c, + 0xfd, 0xde, 0xba, 0x3b, 0x02, 0x1f, 0x95, 0xea, + 0xa0, 0xc5, 0x13, 0x3b, 0x26, 0x5b, 0xbc, 0xe9, + 0xf9, 0xa1, 0x3d, 0x2f, 0x5d, 0x71, 0x3d, 0xa5, + 0xff, 0x4c, 0xe7, 0x72, 0x49, 0x9a, 0xd6, 0xb4, + 0x60, 0x7a, 0x2c, 0x29, 0xd2, 0xf6, 0x19, 0x9a, + 0xa1, 0xd0, 0x05, 0xf5, 0x07, 0xb5, 0xca, 0xf6, + 0x01, 0xe8, 0x88, 0x18, 0xe7, 0xe5, 0x72, 0x61, + 0x6b, 0x2a, 0x45, 0x74, 0x65, 0x4d, 0x06, 0x7f, + 0xa2, 0x5b, 0x45, 0x14, 0x8d, 0xe6, 0x6d, 0x55, + 0x48, 0x77, 0xce, 0xb2, 0x10, 0x86, 0x3b, 0x56, + 0x53, 0x8c, 0x20, 0x0c, 0x15, 0xc9, 0x18, 0x77, + 0x93, 0x78, 0xeb, 0xd8, 0xb3, 0x0a, 0x8e, 0x42, + 0x87, 0xfa, 0x3b, 0x34, 0x69, 0xe4, 0x43, 0xdf, + 0xa3, 0xbe, 0x5c, 0xa3, 0xd8, 0x16, 0x8d, 0xec, + 0x5f, 0xdb, 0x87, 0xf5, 0x52, 0x81, 0xb6, 0x98, + 0x53, 0xb8, 0x4a, 0xef, 0x88, 0x5e, 0x54, 0x9a, + 0x28, 0x95, 0x45, 0x5b, 0x0e, 0x3c, 0x0f, 0x9e, + 0x16, 0x18, 0xd4, 0x02, 0x5d, 0xe4, 0xc6, 0x62, + 0x1f, 0x0e, 0xb4, 0x39, 0xaa, 0x81, 0x12, 0x4b, + 0xb9, 0xa0, 0xd7, 0x27, 0x8e, 0x95, 0x83, 0x19, + 0x33, 0xf3, 0xda, 0x9f, 0x97, 0x06, 0x6d, 0xde, + 0xd3, 0x96, 0x46, 0x2d, 0xf3, 0x5e, 0x99, 0xd9, + 0xbc, 0x2f, 0x83, 0x1a, 0x27, 0xe8, 0xea, 0xad, + 0x8b, 0xc0, 0x2f, 0xae, 0xd9, 0xbe, 0xf0, 0x66, + 0xb9, 0x4b, 0x16, 0xc3, 0x47, 0x05, 0xcd, 0x07, + 0x49, 0xc5, 0xca, 0xad, 0xca, 0x7d, 0x4b, 0xcc, + 0x8d, 0x2b, 0xc3, 0xf3, 0x39, 0x8e, 0xd5, 0xa2, + 0x07, 0xc7, 0xe7, 0x05, 0x82, 0xb1, 0xcf, 0xb0, + 0xce, 0xb3, 0xcd, 0x67, 0xc4, 0xb4, 0xe7, 0xaf, + 0x83, 0x98, 0x43, 0x67, 0xe3, 0xb8, 0x7a, 0x89, + 0x36, 0x19, 0x23, 0xb2, 0x64, 0xca, 0x33, 0xe4, + 0xbd, 0x1c, 0x5b, 0xe0, 0x41, 0xfd, 0x07, 0x79, + 0x3f, 0x51, 0xf4 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* fragmentPrelude = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x53, 0xce, 0x4c, 0x4b, 0x49, 0x4d, + 0x53, 0x70, 0xf7, 0x89, 0x77, 0x0d, 0xe6, 0x2a, + 0x28, 0x4a, 0x4d, 0xce, 0x2c, 0xce, 0xcc, 0xcf, + 0x53, 0xc8, 0x4d, 0x4d, 0xc9, 0x2c, 0xcd, 0x2d, + 0x50, 0x48, 0xcb, 0xc9, 0x4f, 0x2c, 0xb1, 0xe6, + 0x52, 0x4e, 0xcd, 0x29, 0x4e, 0xe5, 0xe2, 0x52, + 0xce, 0x4c, 0x53, 0x50, 0x04, 0x2a, 0xcf, 0xcc, + 0x4b, 0x4d, 0xd1, 0xc8, 0xc9, 0x2f, 0x2f, 0xd0, + 0xe4, 0x52, 0x86, 0x70, 0x15, 0x40, 0x3c, 0xa0, + 0xb2, 0xbc, 0x94, 0xcc, 0x34, 0x34, 0x75, 0x50, + 0xa3, 0x10, 0x4a, 0xa1, 0x02, 0xd8, 0x55, 0x67, + 0x64, 0xa6, 0x67, 0x20, 0xa9, 0x05, 0x73, 0x11, + 0x2a, 0x21, 0x34, 0x00, 0x05, 0x35, 0x3a, 0xbd + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/raster.cpp b/src/mbgl/shaders/raster.cpp index 98291bfec6..e28cb5b726 100644 --- a/src/mbgl/shaders/raster.cpp +++ b/src/mbgl/shaders/raster.cpp @@ -1,90 +1,143 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* raster::name = "raster"; -const char* raster::vertexSource = R"MBGL_SHADER( -uniform mat4 u_matrix; -uniform vec2 u_tl_parent; -uniform float u_scale_parent; -uniform float u_buffer_scale; - -attribute vec2 a_pos; -attribute vec2 a_texture_pos; - -varying vec2 v_pos0; -varying vec2 v_pos1; - -void main() { - gl_Position = u_matrix * vec4(a_pos, 0, 1); - // We are using Int16 for texture position coordinates to give us enough precision for - // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer - // as an arbitrarily high number to preserve adequate precision when rendering. - // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates, - // so math for modifying either is consistent. - v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5; - v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent; -} - -)MBGL_SHADER"; -const char* raster::fragmentSource = R"MBGL_SHADER( -uniform float u_fade_t; -uniform float u_opacity; -uniform sampler2D u_image0; -uniform sampler2D u_image1; -varying vec2 v_pos0; -varying vec2 v_pos1; - -uniform float u_brightness_low; -uniform float u_brightness_high; - -uniform float u_saturation_factor; -uniform float u_contrast_factor; -uniform vec3 u_spin_weights; - -void main() { - - // read and cross-fade colors from the main and parent tiles - vec4 color0 = texture2D(u_image0, v_pos0); - vec4 color1 = texture2D(u_image1, v_pos1); - if (color0.a > 0.0) { - color0.rgb = color0.rgb / color0.a; - } - if (color1.a > 0.0) { - color1.rgb = color1.rgb / color1.a; - } - vec4 color = mix(color0, color1, u_fade_t); - color.a *= u_opacity; - vec3 rgb = color.rgb; - - // spin - rgb = vec3( - dot(rgb, u_spin_weights.xyz), - dot(rgb, u_spin_weights.zxy), - dot(rgb, u_spin_weights.yzx)); - - // saturation - float average = (color.r + color.g + color.b) / 3.0; - rgb += (average - rgb) * u_saturation_factor; - - // contrast - rgb = (rgb - 0.5) * u_contrast_factor + 0.5; - - // brightness - vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low); - vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high); - - gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* raster::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x75, 0x92, 0xcb, 0x4e, 0xc3, 0x40, + 0x0c, 0x45, 0xf7, 0xf9, 0x0a, 0x2f, 0x13, 0x28, + 0x6d, 0x83, 0x00, 0x81, 0x22, 0x96, 0x5d, 0xb0, + 0x41, 0x2c, 0x2a, 0xc1, 0xae, 0x9a, 0x26, 0x4e, + 0x63, 0x69, 0x32, 0x53, 0xe6, 0x51, 0x40, 0x88, + 0x7f, 0xc7, 0x4e, 0x9a, 0x36, 0xe5, 0x91, 0x4d, + 0x24, 0x3f, 0xce, 0xbd, 0xb6, 0x27, 0x1a, 0xaa, + 0xad, 0x6b, 0xa1, 0x55, 0xe1, 0x0a, 0xe2, 0x8a, + 0x7f, 0x8e, 0xde, 0x8b, 0x24, 0xee, 0xc3, 0x3b, + 0x2c, 0x2f, 0x39, 0x1c, 0xf4, 0x6a, 0xab, 0x1c, + 0x9a, 0x70, 0xcc, 0xd4, 0xda, 0xaa, 0xc0, 0x29, + 0x5f, 0x2a, 0x8d, 0xff, 0x66, 0xd7, 0xb1, 0xae, + 0xd1, 0xf5, 0x45, 0x45, 0x92, 0xa8, 0xc0, 0xf8, + 0x75, 0x0c, 0xd8, 0x83, 0xd5, 0x6a, 0x6b, 0x7d, + 0xf1, 0x3b, 0x1a, 0xf0, 0x3d, 0x44, 0x87, 0x7d, + 0x36, 0xd9, 0x29, 0xf7, 0x41, 0x66, 0xd3, 0x27, + 0x77, 0x12, 0x9c, 0x17, 0x7f, 0x04, 0x73, 0x29, + 0xb5, 0x54, 0xf1, 0x28, 0x64, 0xd2, 0x0c, 0x3e, + 0x13, 0xe0, 0x6f, 0xa3, 0x57, 0x4f, 0xd6, 0x53, + 0x20, 0x6b, 0xe0, 0xfe, 0x30, 0x20, 0x9c, 0x49, + 0xe3, 0x55, 0xda, 0x19, 0x98, 0xc0, 0x7c, 0x02, + 0x79, 0x56, 0x74, 0xf5, 0xb3, 0x19, 0x3c, 0x23, + 0xf0, 0x34, 0x10, 0xbd, 0xf0, 0x1f, 0x4c, 0xc8, + 0x6f, 0x80, 0x67, 0x82, 0xbd, 0x29, 0xd8, 0x0e, + 0xb8, 0xd2, 0x5a, 0x57, 0x91, 0x51, 0x01, 0x3d, + 0x04, 0x0b, 0x1b, 0xda, 0x49, 0x13, 0xa0, 0xb1, + 0x71, 0xd3, 0xc0, 0xd6, 0x61, 0x49, 0x5e, 0xea, + 0xb8, 0x79, 0x40, 0xd7, 0x4e, 0x95, 0xd2, 0xab, + 0xf4, 0xb8, 0x7b, 0x2a, 0x92, 0xd1, 0x23, 0xdc, + 0xe6, 0x77, 0x97, 0x82, 0xea, 0xd6, 0x05, 0xa1, + 0xc1, 0x83, 0xe8, 0x58, 0x8b, 0x4c, 0x97, 0xea, + 0x57, 0x3b, 0x90, 0x95, 0x07, 0x65, 0xd8, 0xf7, + 0x9a, 0x82, 0x53, 0x8e, 0xf4, 0x07, 0x34, 0xc4, + 0x2e, 0x4c, 0x6c, 0xd7, 0xe8, 0x84, 0xc9, 0x7e, + 0x3c, 0x3a, 0xb6, 0xa8, 0x2a, 0x7c, 0x8d, 0x0c, + 0x1a, 0x39, 0x7c, 0x6b, 0xd0, 0x00, 0x1f, 0xb0, + 0x42, 0xc7, 0x33, 0x4f, 0x07, 0xe6, 0xb2, 0x21, + 0x56, 0x63, 0xb0, 0xf6, 0xb6, 0x93, 0xf4, 0xaa, + 0xe5, 0x1b, 0x29, 0x1d, 0x51, 0xf4, 0x24, 0xb2, + 0x78, 0x59, 0x2e, 0x1e, 0x97, 0xf0, 0x36, 0x5e, + 0x99, 0x2c, 0xcb, 0x46, 0x16, 0x25, 0x3d, 0xb8, + 0x94, 0xa5, 0x8d, 0x67, 0x98, 0x0c, 0x12, 0x0c, + 0xe6, 0x8b, 0x34, 0x5d, 0x4f, 0x6b, 0x2b, 0xaa, + 0xbb, 0xa3, 0x22, 0x31, 0xdb, 0x89, 0x74, 0x69, + 0x8d, 0x27, 0x1f, 0xf8, 0x6d, 0xf5, 0xae, 0xfa, + 0xf3, 0xf3, 0x25, 0xd3, 0x34, 0x3d, 0x79, 0x27, + 0x30, 0xeb, 0xb6, 0x37, 0x9d, 0x67, 0x70, 0x01, + 0xf3, 0xe9, 0x75, 0xc6, 0x81, 0xd3, 0xe7, 0x07, + 0x19, 0x9c, 0x4b, 0xa6, 0x38, 0x82, 0x72, 0x01, + 0xed, 0x91, 0x67, 0x3f, 0xde, 0xb2, 0x54, 0x9f, + 0x3c, 0xfc, 0xaf, 0xe4, 0x1b, 0x93, 0x50, 0x12, + 0x27 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* raster::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x53, 0x4d, 0x6f, 0x9c, 0x30, + 0x10, 0xbd, 0xf3, 0x2b, 0x46, 0xca, 0x05, 0x12, + 0x87, 0x85, 0xdd, 0xf6, 0x84, 0x52, 0x29, 0xca, + 0x26, 0x52, 0x2f, 0x4d, 0xb5, 0xad, 0xda, 0x23, + 0xf2, 0x82, 0x61, 0x2d, 0x01, 0x5e, 0xd9, 0x86, + 0xec, 0x6e, 0x95, 0xff, 0xde, 0x31, 0x98, 0x8f, + 0xec, 0x47, 0x12, 0x4e, 0xc3, 0xcc, 0xf3, 0x7b, + 0x33, 0xcf, 0xe3, 0xba, 0xe2, 0x99, 0x90, 0x25, + 0x64, 0x85, 0xa0, 0x1a, 0xea, 0x38, 0xa3, 0x29, + 0x8b, 0x75, 0xe4, 0xd4, 0x47, 0x79, 0xb1, 0xa5, + 0x09, 0xd7, 0xfb, 0xb1, 0xa0, 0x68, 0xb9, 0x2d, + 0x98, 0x9c, 0x2f, 0xb1, 0xc8, 0x4b, 0x9a, 0xb3, + 0xe0, 0x9d, 0x5a, 0x18, 0x39, 0x0d, 0x95, 0x7b, + 0x5e, 0xe5, 0xd0, 0xb0, 0x64, 0x0e, 0x4d, 0xbc, + 0x15, 0x2a, 0x38, 0x97, 0x44, 0xe4, 0x89, 0xf6, + 0x5a, 0xf2, 0x7c, 0xa3, 0x2b, 0xa6, 0x54, 0x5c, + 0x88, 0x97, 0xe8, 0xbd, 0xfa, 0x06, 0xa3, 0x33, + 0x0c, 0x8a, 0xea, 0x5a, 0x52, 0xcd, 0x45, 0x85, + 0x03, 0x26, 0x5a, 0xc8, 0x53, 0x92, 0x44, 0x54, + 0x5a, 0x52, 0xa5, 0x4f, 0x00, 0xd8, 0xdb, 0xc2, + 0x50, 0x6c, 0x79, 0x15, 0xbf, 0x30, 0xa3, 0xa4, + 0x50, 0xa1, 0x11, 0x3c, 0x85, 0x92, 0xf2, 0xca, + 0xf5, 0xe0, 0x9f, 0xe3, 0x00, 0x7e, 0xb3, 0x19, + 0x48, 0x46, 0x53, 0xa0, 0x55, 0x0a, 0x89, 0x14, + 0x4a, 0xdd, 0x1a, 0x33, 0x21, 0x11, 0x85, 0x90, + 0x0a, 0x32, 0x29, 0x4a, 0xd0, 0x1b, 0xd6, 0x1e, + 0x6a, 0x31, 0x5b, 0x2a, 0x59, 0xa5, 0x41, 0xf3, + 0x82, 0xa9, 0x96, 0x00, 0x95, 0xbe, 0x74, 0xf0, + 0x00, 0xee, 0x40, 0x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1d, 0xf8, 0x5f, + 0xbb, 0xd3, 0x47, 0x2f, 0x02, 0xe5, 0xb1, 0x34, + 0x32, 0x8c, 0xaf, 0x6e, 0x34, 0xbf, 0x6e, 0x1f, + 0x60, 0x8c, 0x71, 0xef, 0xf0, 0xf1, 0xeb, 0x25, + 0xf0, 0x71, 0xc6, 0x8b, 0xa6, 0x8c, 0x98, 0xb8, + 0x48, 0x68, 0xd4, 0x08, 0x7c, 0x26, 0xd5, 0x1b, + 0x9f, 0x17, 0xf1, 0x13, 0xda, 0xf4, 0x60, 0xf7, + 0xcd, 0x2c, 0x9f, 0x6b, 0x96, 0x6e, 0xec, 0x9c, + 0x8c, 0x9a, 0xa4, 0xb7, 0xd2, 0xee, 0x1c, 0xe9, + 0x03, 0xc3, 0x76, 0xc5, 0xb3, 0x94, 0x65, 0xf0, + 0xfc, 0xe7, 0x71, 0xb5, 0x5c, 0xdd, 0xff, 0x8d, + 0xbf, 0xff, 0xf8, 0xf5, 0xf3, 0xf1, 0xe1, 0xf7, + 0xf3, 0xea, 0xa2, 0x4e, 0xe8, 0x9b, 0xa7, 0x7b, + 0xc5, 0xaa, 0x94, 0x67, 0xce, 0xab, 0xf3, 0x1f, + 0x04, 0xbd, 0xc0, 0x04 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/symbol_icon.cpp b/src/mbgl/shaders/symbol_icon.cpp index c037c81005..bfbb150951 100644 --- a/src/mbgl/shaders/symbol_icon.cpp +++ b/src/mbgl/shaders/symbol_icon.cpp @@ -1,149 +1,194 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* symbol_icon::name = "symbol_icon"; -const char* symbol_icon::vertexSource = R"MBGL_SHADER( -const float PI = 3.141592653589793; - -attribute vec4 a_pos_offset; -attribute vec4 a_data; -attribute vec3 a_projected_pos; -attribute float a_fade_opacity; - -uniform bool u_is_size_zoom_constant; -uniform bool u_is_size_feature_constant; -uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function -uniform highp float u_size; // used when size is both zoom and feature constant -uniform highp float u_camera_to_center_distance; -uniform highp float u_pitch; -uniform bool u_rotate_symbol; -uniform highp float u_aspect_ratio; -uniform float u_fade_change; - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -uniform mat4 u_matrix; -uniform mat4 u_label_plane_matrix; -uniform mat4 u_gl_coord_matrix; - -uniform bool u_is_text; -uniform bool u_pitch_with_map; - -uniform vec2 u_texsize; - -varying vec2 v_tex; -varying float v_fade_opacity; - -void main() { - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - - vec2 a_pos = a_pos_offset.xy; - vec2 a_offset = a_pos_offset.zw; - - vec2 a_tex = a_data.xy; - vec2 a_size = a_data.zw; - - highp float segment_angle = -a_projected_pos[2]; - - float size; - if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = mix(a_size[0], a_size[1], u_size_t) / 10.0; - } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = a_size[0] / 10.0; - } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { - size = u_size; - } else { - size = u_size; - } - - vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1); - highp float camera_to_anchor_distance = projectedPoint.w; - // See comments in symbol_sdf.vertex - highp float distance_ratio = u_pitch_with_map ? - camera_to_anchor_distance / u_camera_to_center_distance : - u_camera_to_center_distance / camera_to_anchor_distance; - highp float perspective_ratio = clamp( - 0.5 + 0.5 * distance_ratio, - 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles - 4.0); - - size *= perspective_ratio; - - float fontScale = u_is_text ? size / 24.0 : size; - - highp float symbol_rotation = 0.0; - if (u_rotate_symbol) { - // See comments in symbol_sdf.vertex - vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1); - - vec2 a = projectedPoint.xy / projectedPoint.w; - vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w; - - symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x); - } - - highp float angle_sin = sin(segment_angle + symbol_rotation); - highp float angle_cos = cos(segment_angle + symbol_rotation); - mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos); - - vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0); - gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0); - - v_tex = a_tex / u_texsize; - vec2 fade_opacity = unpack_opacity(a_fade_opacity); - float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change; - v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change)); -} - -)MBGL_SHADER"; -const char* symbol_icon::fragmentSource = R"MBGL_SHADER( -uniform sampler2D u_texture; - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -varying vec2 v_tex; -varying float v_fade_opacity; - -void main() { - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - - lowp float alpha = opacity * v_fade_opacity; - gl_FragColor = texture2D(u_texture, v_tex) * alpha; - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* symbol_icon::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x57, 0x4b, 0x8f, 0xdb, 0x36, + 0x10, 0xbe, 0xfb, 0x57, 0x4c, 0x10, 0x20, 0x90, + 0xbc, 0x7e, 0xdb, 0x9b, 0x76, 0x63, 0x6c, 0x17, + 0xbd, 0x14, 0xcd, 0x21, 0xad, 0xd1, 0x45, 0x4f, + 0x8b, 0x80, 0xa0, 0x25, 0xca, 0x66, 0x2b, 0x89, + 0x82, 0x44, 0xf9, 0xb1, 0x45, 0xfe, 0x7b, 0x87, + 0xa4, 0x4c, 0x51, 0x92, 0xe5, 0x6c, 0x81, 0xfa, + 0x20, 0xcb, 0xe4, 0xbc, 0xe7, 0x9b, 0x8f, 0x74, + 0x20, 0xd2, 0x42, 0x42, 0x14, 0x0b, 0x2a, 0x61, + 0xf3, 0x19, 0x1e, 0x61, 0x39, 0x99, 0xaf, 0xe6, + 0xf7, 0x0f, 0x8b, 0x8f, 0xf7, 0xcb, 0xfb, 0x1f, + 0x1f, 0x7e, 0x78, 0x58, 0xae, 0x07, 0x03, 0x2a, + 0x65, 0xce, 0xb7, 0xa5, 0x64, 0x70, 0x60, 0xc1, + 0x0a, 0x28, 0xc9, 0x44, 0x41, 0x44, 0x14, 0x15, + 0x4c, 0xae, 0xbb, 0x9b, 0x21, 0x95, 0xb4, 0xb5, + 0xbc, 0x54, 0x3a, 0xb9, 0xf8, 0x8b, 0x05, 0x92, + 0x85, 0x4a, 0xdb, 0xdd, 0x37, 0xce, 0x29, 0x89, + 0x68, 0xc8, 0x88, 0xc8, 0x68, 0xc0, 0xe5, 0x19, + 0x9d, 0x96, 0x29, 0x8f, 0x44, 0x9e, 0xc0, 0x56, + 0x88, 0x18, 0x4a, 0xc2, 0x0b, 0x52, 0xf0, 0x57, + 0x46, 0x5e, 0x85, 0x48, 0x48, 0xa0, 0xa2, 0xa6, + 0x29, 0x7a, 0xef, 0x91, 0x8a, 0x18, 0x95, 0x65, + 0xce, 0xae, 0x08, 0xee, 0xf9, 0x6e, 0x9f, 0x55, + 0x3e, 0x4b, 0x23, 0x2c, 0xd7, 0x30, 0x9d, 0x42, + 0x59, 0xb0, 0x10, 0xa4, 0x00, 0x9e, 0x4a, 0x96, + 0x67, 0x22, 0xa6, 0x18, 0xda, 0x96, 0xc9, 0x23, + 0x63, 0x29, 0x28, 0xa7, 0x50, 0x48, 0x91, 0x15, + 0x70, 0xdc, 0xe3, 0x6f, 0xa5, 0x06, 0xbc, 0x00, + 0x0a, 0x81, 0x48, 0x30, 0x1d, 0xae, 0xd2, 0x28, + 0xd3, 0x40, 0x72, 0x91, 0xde, 0xf0, 0x54, 0xfb, + 0x69, 0x58, 0xd9, 0x0a, 0xb9, 0x37, 0x2e, 0x68, + 0x1a, 0x42, 0x15, 0x3a, 0x5c, 0x42, 0xef, 0xb1, + 0x17, 0xd0, 0x84, 0xe5, 0x94, 0x48, 0x41, 0x02, + 0xa6, 0x22, 0x26, 0x21, 0x57, 0xe2, 0x01, 0xeb, + 0x4b, 0x35, 0xe3, 0x32, 0xd8, 0x77, 0x0a, 0x96, + 0x0b, 0x89, 0x89, 0x92, 0xe2, 0x9c, 0x6c, 0x45, + 0xdc, 0xa7, 0x4a, 0x8b, 0x0c, 0x3b, 0x47, 0x72, + 0x8a, 0xf9, 0xd5, 0x32, 0x97, 0x5d, 0xdd, 0xb7, + 0x60, 0x4f, 0xd3, 0x1d, 0xfa, 0x1e, 0x0c, 0xde, + 0xf3, 0x28, 0x0d, 0x59, 0x04, 0xbf, 0xfe, 0xfc, + 0x4c, 0xfe, 0xfc, 0xed, 0xf3, 0x2f, 0xbf, 0xff, + 0xf1, 0x85, 0x94, 0x97, 0xbe, 0x5a, 0xe5, 0x58, + 0x1c, 0x33, 0xdb, 0xf9, 0x6a, 0x93, 0x34, 0xd0, + 0xa4, 0x25, 0x10, 0x3b, 0x8b, 0x5a, 0x60, 0x3d, + 0x38, 0xd0, 0xfc, 0xcc, 0xd3, 0x9d, 0xab, 0x6e, + 0xf7, 0xde, 0xb3, 0xb8, 0x60, 0xd7, 0x1c, 0x94, + 0xc4, 0x91, 0x49, 0x43, 0x1e, 0x0d, 0x6a, 0x74, + 0x25, 0x54, 0xae, 0x50, 0x00, 0xbf, 0x72, 0x7e, + 0x5a, 0xb7, 0x97, 0x63, 0xba, 0x65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 0x35, 0x84, 0x94, + 0xd1, 0x7c, 0x1c, 0x71, 0x16, 0x87, 0x55, 0x35, + 0x75, 0x61, 0x75, 0x8d, 0x58, 0x38, 0x55, 0x72, + 0x0a, 0x62, 0xea, 0x58, 0xe6, 0x31, 0x2b, 0x1a, + 0x56, 0x57, 0x93, 0x99, 0x5f, 0x0d, 0xa5, 0xc6, + 0xca, 0xf0, 0xb1, 0x1b, 0x77, 0x63, 0x68, 0x23, + 0x91, 0xca, 0xe7, 0x80, 0xc6, 0x06, 0x56, 0x15, + 0x29, 0xc3, 0x93, 0xd1, 0x9e, 0xc2, 0x02, 0x0d, + 0xc2, 0xa7, 0x6a, 0xb4, 0xbb, 0x0c, 0x61, 0x7a, + 0xad, 0x0f, 0x4b, 0x3c, 0xe2, 0xd1, 0x84, 0x1d, + 0x0d, 0x33, 0x7d, 0x8d, 0x63, 0xd4, 0x05, 0xfb, + 0x9b, 0x81, 0x63, 0xb1, 0x6d, 0x38, 0x6e, 0xf3, + 0x26, 0x84, 0x63, 0x03, 0x34, 0x3f, 0xcf, 0x11, + 0xea, 0xbe, 0x85, 0xbb, 0x6b, 0x0f, 0x29, 0xb0, + 0x0b, 0xea, 0xd3, 0x19, 0x33, 0xbe, 0x0e, 0x74, + 0xab, 0xb6, 0x45, 0xb5, 0x6b, 0xa1, 0x18, 0xe5, + 0xab, 0x3b, 0x47, 0xc7, 0x75, 0xb7, 0x62, 0x48, + 0xbf, 0xa9, 0xe7, 0x6d, 0x27, 0x67, 0x18, 0x03, + 0x9d, 0x9c, 0x7d, 0x0d, 0x6c, 0xf7, 0x66, 0x31, + 0x82, 0xed, 0xe4, 0xa4, 0x37, 0x4f, 0x7e, 0x63, + 0xe4, 0xdd, 0x4e, 0x68, 0x8e, 0x46, 0x56, 0x50, + 0x16, 0xf1, 0xe9, 0x35, 0xb9, 0xfb, 0xae, 0xed, + 0xf7, 0xca, 0xf0, 0x1b, 0x0b, 0x81, 0x3e, 0x7a, + 0xf0, 0xf9, 0x46, 0x0b, 0x58, 0xfc, 0x05, 0x5c, + 0xd6, 0x2e, 0xad, 0x78, 0xd4, 0xcb, 0x9e, 0xb5, + 0x38, 0x82, 0xf1, 0x1c, 0x61, 0x34, 0xac, 0xa3, + 0x1c, 0x75, 0x5f, 0x51, 0xce, 0x5f, 0x5f, 0xe3, + 0xb2, 0xea, 0x38, 0xbc, 0x76, 0xeb, 0x70, 0x9a, + 0xee, 0x4a, 0x63, 0x2f, 0x46, 0x66, 0xbe, 0xe6, + 0x7a, 0x1c, 0x94, 0x4d, 0xbc, 0x8f, 0x6c, 0xd4, + 0x85, 0xd4, 0x14, 0xbd, 0x73, 0x3f, 0xb9, 0x58, + 0x6a, 0xdb, 0x71, 0x01, 0xa1, 0x97, 0x8e, 0x58, + 0x8a, 0x76, 0xbe, 0x43, 0xf0, 0xec, 0x91, 0x3c, + 0x85, 0xe5, 0x42, 0xe7, 0x6a, 0x07, 0xcb, 0x6f, + 0xc4, 0x62, 0x12, 0xb4, 0x47, 0xb3, 0xfa, 0x9e, + 0xba, 0xb7, 0x1a, 0x0b, 0x34, 0xf7, 0xe6, 0x52, + 0x5f, 0x3d, 0xaa, 0x05, 0xaf, 0xf9, 0xb7, 0xa0, + 0xca, 0xb1, 0x9a, 0xe8, 0xfa, 0xde, 0x89, 0x7a, + 0xae, 0x18, 0x9e, 0x99, 0xf0, 0x93, 0xa6, 0xa6, + 0xa7, 0xe6, 0xfd, 0x14, 0x27, 0x7c, 0xdc, 0xba, + 0xb0, 0x9a, 0x30, 0x5b, 0x41, 0x24, 0xf4, 0xe4, + 0xe9, 0x5c, 0x12, 0x84, 0xd8, 0x5c, 0xbd, 0x34, + 0xcc, 0xe3, 0xe9, 0x78, 0xe7, 0xba, 0xf7, 0x31, + 0xae, 0x6f, 0x83, 0x7f, 0x01, 0xca, 0xcb, 0x70, + 0xe8 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* symbol_icon::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x75, 0x90, 0xcb, 0x6e, 0xc2, 0x30, + 0x10, 0x45, 0xf7, 0xf3, 0x15, 0x23, 0xb1, 0x49, + 0xaa, 0xaa, 0xa2, 0x51, 0x77, 0x51, 0x17, 0x88, + 0x80, 0x60, 0x51, 0x82, 0x42, 0x1f, 0x4b, 0xcb, + 0x22, 0x76, 0x6a, 0xc9, 0xb1, 0x23, 0x13, 0x9b, + 0xa2, 0xaa, 0xff, 0x5e, 0xbb, 0x24, 0x29, 0xe2, + 0xe1, 0xa5, 0x7d, 0xee, 0xf5, 0x99, 0xb1, 0x4a, + 0x70, 0x6d, 0x6a, 0xdc, 0xd1, 0xba, 0x91, 0xcc, + 0x24, 0x19, 0x5a, 0xd2, 0xb2, 0xaf, 0xd6, 0x1a, + 0x96, 0x02, 0xc0, 0x48, 0x70, 0x55, 0x32, 0x8e, + 0x8b, 0xc9, 0x86, 0xbc, 0xad, 0x96, 0xf3, 0xbc, + 0x78, 0x21, 0x96, 0xe8, 0x86, 0x6e, 0x45, 0x7b, + 0x00, 0x47, 0xcd, 0x41, 0xa8, 0x0a, 0xa5, 0xde, + 0x37, 0xc8, 0xa5, 0xa6, 0x2d, 0x76, 0x4f, 0x29, + 0x8c, 0x98, 0xdc, 0x31, 0xb0, 0x5d, 0xfd, 0x09, + 0x31, 0xc4, 0x03, 0xa3, 0x4a, 0xc1, 0xfd, 0x37, + 0x7d, 0x91, 0x63, 0xdb, 0x04, 0x5d, 0x10, 0x48, + 0x87, 0xbb, 0x63, 0xca, 0x11, 0x4e, 0x4b, 0xf6, + 0x1f, 0x05, 0xa7, 0x45, 0x89, 0x35, 0x15, 0x2a, + 0x8a, 0xf1, 0x1b, 0xd0, 0x9f, 0x20, 0x7b, 0xdb, + 0x35, 0x10, 0x97, 0x9e, 0xf8, 0x7c, 0xd5, 0xe7, + 0x0c, 0xa6, 0xb2, 0xf9, 0xa4, 0x1e, 0xed, 0x43, + 0x77, 0x17, 0x3a, 0x21, 0x50, 0x49, 0x32, 0x37, + 0xb4, 0x9a, 0x6a, 0xa9, 0x8d, 0x87, 0xbb, 0x2d, + 0x26, 0x59, 0x34, 0x6c, 0xf4, 0xfe, 0x38, 0x5b, + 0xec, 0x0b, 0xfe, 0x2a, 0x53, 0xe8, 0x9d, 0xf3, + 0xf7, 0x59, 0x91, 0x15, 0x93, 0x0f, 0xb2, 0x5c, + 0x6d, 0xd6, 0xb3, 0xe9, 0x6b, 0x5e, 0x5c, 0xab, + 0xf4, 0xeb, 0x79, 0x8a, 0x1e, 0x1f, 0xc6, 0xf1, + 0xa0, 0xfa, 0x03, 0xbf, 0x04, 0x34, 0x94, 0x99 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl diff --git a/src/mbgl/shaders/symbol_sdf.cpp b/src/mbgl/shaders/symbol_sdf.cpp index b584c00315..b58f6ef2ba 100644 --- a/src/mbgl/shaders/symbol_sdf.cpp +++ b/src/mbgl/shaders/symbol_sdf.cpp @@ -1,304 +1,328 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* symbol_sdf::name = "symbol_sdf"; -const char* symbol_sdf::vertexSource = R"MBGL_SHADER( -const float PI = 3.141592653589793; - -attribute vec4 a_pos_offset; -attribute vec4 a_data; -attribute vec3 a_projected_pos; -attribute float a_fade_opacity; - -// contents of a_size vary based on the type of property value -// used for {text,icon}-size. -// For constants, a_size is disabled. -// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature. -// For composite functions: -// [ text-size(lowerZoomStop, feature), -// text-size(upperZoomStop, feature) ] -uniform bool u_is_size_zoom_constant; -uniform bool u_is_size_feature_constant; -uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function -uniform highp float u_size; // used when size is both zoom and feature constant - - -#ifndef HAS_UNIFORM_u_fill_color -uniform lowp float a_fill_color_t; -attribute highp vec4 a_fill_color; -varying highp vec4 fill_color; -#else -uniform highp vec4 u_fill_color; -#endif - - -#ifndef HAS_UNIFORM_u_halo_color -uniform lowp float a_halo_color_t; -attribute highp vec4 a_halo_color; -varying highp vec4 halo_color; -#else -uniform highp vec4 u_halo_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; -attribute lowp vec2 a_opacity; -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_halo_width -uniform lowp float a_halo_width_t; -attribute lowp vec2 a_halo_width; -varying lowp float halo_width; -#else -uniform lowp float u_halo_width; -#endif - - -#ifndef HAS_UNIFORM_u_halo_blur -uniform lowp float a_halo_blur_t; -attribute lowp vec2 a_halo_blur; -varying lowp float halo_blur; -#else -uniform lowp float u_halo_blur; -#endif - - -uniform mat4 u_matrix; -uniform mat4 u_label_plane_matrix; -uniform mat4 u_gl_coord_matrix; - -uniform bool u_is_text; -uniform bool u_pitch_with_map; -uniform highp float u_pitch; -uniform bool u_rotate_symbol; -uniform highp float u_aspect_ratio; -uniform highp float u_camera_to_center_distance; -uniform float u_fade_change; - -uniform vec2 u_texsize; - -varying vec2 v_data0; -varying vec3 v_data1; - -void main() { - -#ifndef HAS_UNIFORM_u_fill_color - fill_color = unpack_mix_vec4(a_fill_color, a_fill_color_t); -#else - highp vec4 fill_color = u_fill_color; -#endif - - -#ifndef HAS_UNIFORM_u_halo_color - halo_color = unpack_mix_vec4(a_halo_color, a_halo_color_t); -#else - highp vec4 halo_color = u_halo_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); -#else - lowp float opacity = u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_halo_width - halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t); -#else - lowp float halo_width = u_halo_width; -#endif - - -#ifndef HAS_UNIFORM_u_halo_blur - halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t); -#else - lowp float halo_blur = u_halo_blur; -#endif - - - vec2 a_pos = a_pos_offset.xy; - vec2 a_offset = a_pos_offset.zw; - - vec2 a_tex = a_data.xy; - vec2 a_size = a_data.zw; - - highp float segment_angle = -a_projected_pos[2]; - float size; - - if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = mix(a_size[0], a_size[1], u_size_t) / 10.0; - } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = a_size[0] / 10.0; - } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { - size = u_size; - } else { - size = u_size; - } - - vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1); - highp float camera_to_anchor_distance = projectedPoint.w; - // If the label is pitched with the map, layout is done in pitched space, - // which makes labels in the distance smaller relative to viewport space. - // We counteract part of that effect by multiplying by the perspective ratio. - // If the label isn't pitched with the map, we do layout in viewport space, - // which makes labels in the distance larger relative to the features around - // them. We counteract part of that effect by dividing by the perspective ratio. - highp float distance_ratio = u_pitch_with_map ? - camera_to_anchor_distance / u_camera_to_center_distance : - u_camera_to_center_distance / camera_to_anchor_distance; - highp float perspective_ratio = clamp( - 0.5 + 0.5 * distance_ratio, - 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles - 4.0); - - size *= perspective_ratio; - - float fontScale = u_is_text ? size / 24.0 : size; - - highp float symbol_rotation = 0.0; - if (u_rotate_symbol) { - // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units - // To figure out that angle in projected space, we draw a short horizontal line in tile - // space, project it, and measure its angle in projected space. - vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1); - - vec2 a = projectedPoint.xy / projectedPoint.w; - vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w; - - symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x); - } - - highp float angle_sin = sin(segment_angle + symbol_rotation); - highp float angle_cos = cos(segment_angle + symbol_rotation); - mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos); - - vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0); - gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0); - float gamma_scale = gl_Position.w; - - vec2 tex = a_tex / u_texsize; - vec2 fade_opacity = unpack_opacity(a_fade_opacity); - float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change; - float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change)); - - v_data0 = vec2(tex.x, tex.y); - v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity); -} - -)MBGL_SHADER"; -const char* symbol_sdf::fragmentSource = R"MBGL_SHADER( -#define SDF_PX 8.0 -#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO - -uniform bool u_is_halo; - -#ifndef HAS_UNIFORM_u_fill_color -varying highp vec4 fill_color; -#else -uniform highp vec4 u_fill_color; -#endif - - -#ifndef HAS_UNIFORM_u_halo_color -varying highp vec4 halo_color; -#else -uniform highp vec4 u_halo_color; -#endif - - -#ifndef HAS_UNIFORM_u_opacity -varying lowp float opacity; -#else -uniform lowp float u_opacity; -#endif - - -#ifndef HAS_UNIFORM_u_halo_width -varying lowp float halo_width; -#else -uniform lowp float u_halo_width; -#endif - - -#ifndef HAS_UNIFORM_u_halo_blur -varying lowp float halo_blur; -#else -uniform lowp float u_halo_blur; -#endif - - -uniform sampler2D u_texture; -uniform highp float u_gamma_scale; -uniform bool u_is_text; - -varying vec2 v_data0; -varying vec3 v_data1; - -void main() { - -#ifdef HAS_UNIFORM_u_fill_color - highp vec4 fill_color = u_fill_color; -#endif - - -#ifdef HAS_UNIFORM_u_halo_color - highp vec4 halo_color = u_halo_color; -#endif - - -#ifdef HAS_UNIFORM_u_opacity - lowp float opacity = u_opacity; -#endif - - -#ifdef HAS_UNIFORM_u_halo_width - lowp float halo_width = u_halo_width; -#endif - - -#ifdef HAS_UNIFORM_u_halo_blur - lowp float halo_blur = u_halo_blur; -#endif - - - vec2 tex = v_data0.xy; - float gamma_scale = v_data1.x; - float size = v_data1.y; - float fade_opacity = v_data1[2]; - - float fontScale = u_is_text ? size / 24.0 : size; - - lowp vec4 color = fill_color; - highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale); - lowp float buff = (256.0 - 64.0) / 256.0; - if (u_is_halo) { - color = halo_color; - gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale); - buff = (6.0 - halo_width / fontScale) / SDF_PX; - } - - lowp float dist = texture2D(u_texture, tex).a; - highp float gamma_scaled = gamma * gamma_scale; - highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist); - - gl_FragColor = color * (alpha * opacity * fade_opacity); - -#ifdef OVERDRAW_INSPECTOR - gl_FragColor = vec4(1.0); -#endif -} - -)MBGL_SHADER"; +const char* symbol_sdf::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x58, 0x4d, 0x8f, 0xdb, 0x36, + 0x10, 0xbd, 0xfb, 0x57, 0x4c, 0x10, 0x20, 0xb1, + 0x37, 0x5a, 0x79, 0xbd, 0x1f, 0x6d, 0xb3, 0x46, + 0x1a, 0xf4, 0x52, 0x34, 0x87, 0xb6, 0x8b, 0xa6, + 0x45, 0x81, 0x06, 0x81, 0x40, 0x4b, 0x94, 0xcd, + 0x46, 0x12, 0x05, 0x89, 0x5a, 0xdb, 0x1b, 0xe4, + 0xbf, 0x77, 0x86, 0x94, 0x28, 0x4a, 0x96, 0xe4, + 0x04, 0xe8, 0x1e, 0xbc, 0x96, 0xe6, 0x71, 0xf8, + 0x86, 0x1c, 0xbe, 0x19, 0x3a, 0x94, 0x59, 0xa9, + 0x20, 0x4e, 0x24, 0x53, 0xf0, 0xf0, 0x0e, 0xde, + 0xc0, 0x8d, 0xbf, 0xba, 0x5d, 0xdd, 0xbd, 0xbe, + 0xfe, 0xee, 0xee, 0xe6, 0xee, 0x87, 0xd7, 0xdf, + 0xbf, 0xbe, 0x59, 0xcf, 0x66, 0x4c, 0xa9, 0x42, + 0x6c, 0x2a, 0xc5, 0xe1, 0x91, 0x87, 0xb7, 0xc0, + 0x82, 0x5c, 0x96, 0x81, 0x8c, 0xe3, 0x92, 0xab, + 0xf5, 0xa9, 0x31, 0x62, 0x8a, 0xf5, 0x5e, 0xdf, + 0xd0, 0x98, 0x42, 0xfe, 0xcb, 0x43, 0xc5, 0x23, + 0x1a, 0xed, 0xda, 0xcd, 0xe4, 0x2c, 0x88, 0x59, + 0xc4, 0x03, 0x99, 0xb3, 0x50, 0xa8, 0x23, 0x4e, + 0xba, 0x5c, 0x42, 0x28, 0x33, 0xc5, 0x33, 0x55, + 0x82, 0x8c, 0xd1, 0x5e, 0x8a, 0x27, 0x74, 0xc6, + 0x8a, 0x23, 0x6c, 0x58, 0xc9, 0x23, 0x90, 0x19, + 0xa8, 0x1d, 0x07, 0x75, 0xcc, 0x39, 0x01, 0xd0, + 0x7f, 0xce, 0x0b, 0x75, 0x44, 0x48, 0x52, 0x71, + 0x1a, 0x5e, 0x11, 0x2a, 0x96, 0x05, 0x7c, 0x56, + 0xfc, 0xa0, 0x3c, 0x81, 0xee, 0xbe, 0x5c, 0x92, + 0x17, 0x9f, 0xac, 0x3f, 0xa3, 0x21, 0xa4, 0xe8, + 0x19, 0xce, 0xe0, 0x35, 0xfe, 0x45, 0x09, 0x91, + 0x28, 0xd9, 0x26, 0xe1, 0x91, 0x45, 0x95, 0xb2, + 0x2a, 0x42, 0xe4, 0x59, 0x65, 0xa1, 0x12, 0x38, + 0xc2, 0x83, 0x3d, 0x87, 0x8d, 0xc8, 0x88, 0x42, + 0x72, 0xc4, 0x0f, 0x6e, 0xe6, 0x04, 0x9c, 0x1f, + 0xa3, 0x2d, 0x70, 0xb6, 0x7b, 0x4d, 0xcd, 0xbc, + 0x45, 0x6e, 0x7d, 0x02, 0xc0, 0xc9, 0xc4, 0x54, + 0xcd, 0x8f, 0xb0, 0x61, 0x55, 0x14, 0x18, 0x2b, + 0xc4, 0x9c, 0xa9, 0xaa, 0x70, 0x29, 0xa6, 0xb8, + 0x5e, 0x42, 0x39, 0xf3, 0xdf, 0x93, 0xed, 0x03, + 0x90, 0x4f, 0xed, 0x6d, 0x9e, 0xc8, 0x3d, 0x2f, + 0xfe, 0x91, 0x32, 0x7d, 0xaf, 0x64, 0xee, 0x35, + 0x2e, 0x16, 0x1e, 0xe1, 0xc0, 0xc1, 0x55, 0x79, + 0x3e, 0x84, 0x83, 0x8f, 0xb3, 0x2a, 0x13, 0x48, + 0x24, 0x85, 0x8d, 0x94, 0x09, 0x54, 0x81, 0x28, + 0xf5, 0x6a, 0x04, 0x4f, 0x88, 0x0d, 0x9a, 0x45, + 0x5a, 0x8f, 0xa1, 0x6a, 0x3f, 0x03, 0xc0, 0x9d, + 0xd8, 0xee, 0xf2, 0x7a, 0x83, 0x2b, 0x03, 0x56, + 0x6b, 0x68, 0xb6, 0x46, 0x49, 0x10, 0xb8, 0xc1, + 0x45, 0x2e, 0x13, 0x5c, 0x0a, 0xd8, 0x70, 0xb5, + 0xe7, 0x3c, 0x03, 0x9a, 0x14, 0x4a, 0x64, 0x58, + 0xc2, 0x7e, 0x87, 0xcf, 0xcd, 0xbe, 0xb0, 0x81, + 0xb5, 0x98, 0x98, 0xa9, 0x9d, 0xa7, 0xe3, 0x65, + 0x23, 0xd5, 0xce, 0x4c, 0xc1, 0x70, 0x03, 0x6b, + 0xea, 0x36, 0x11, 0x66, 0xb3, 0xd9, 0x73, 0x11, + 0x67, 0x11, 0x8f, 0xe1, 0x97, 0x9f, 0xde, 0x07, + 0x7f, 0xfd, 0xf6, 0xee, 0xe7, 0xdf, 0xff, 0xf8, + 0x35, 0xa8, 0x82, 0x58, 0x24, 0x09, 0x06, 0x98, + 0xc8, 0xc2, 0x4e, 0x89, 0xab, 0x9e, 0xb7, 0xc9, + 0x6b, 0xed, 0x41, 0xe7, 0x4c, 0x18, 0x5e, 0xf5, + 0xc9, 0x68, 0x41, 0xeb, 0x19, 0x25, 0xb2, 0xc8, + 0xb6, 0x2e, 0xc0, 0x35, 0x3f, 0xe7, 0x49, 0xc9, + 0x7b, 0xd1, 0x69, 0x50, 0x15, 0x74, 0x61, 0x59, + 0x24, 0xe2, 0x51, 0xd6, 0x3b, 0x96, 0xc8, 0x29, + 0xd6, 0xad, 0x7d, 0x82, 0x75, 0x0b, 0x1a, 0x64, + 0xed, 0x9a, 0x27, 0x58, 0x77, 0x61, 0x93, 0xac, + 0x6b, 0x0d, 0x18, 0xa6, 0x5c, 0x1b, 0xbb, 0x7c, + 0x35, 0x02, 0x27, 0xba, 0x6e, 0x01, 0x2d, 0x57, + 0x67, 0xb8, 0xb5, 0x75, 0x89, 0x3a, 0x88, 0x2a, + 0x70, 0x30, 0xe7, 0xd7, 0x76, 0x2f, 0x22, 0xb5, + 0x9b, 0x58, 0x5b, 0x6d, 0x1f, 0xe7, 0xda, 0x62, + 0x06, 0xe9, 0xba, 0xe6, 0x09, 0xc6, 0x5d, 0xd8, + 0x79, 0xd2, 0x9b, 0xa4, 0x9a, 0xca, 0x07, 0x32, + 0x9f, 0xa1, 0x4c, 0x90, 0x71, 0xc6, 0xc6, 0x7a, + 0x8e, 0x70, 0x83, 0xaa, 0xf9, 0x36, 0xc0, 0x94, + 0x29, 0x4a, 0x17, 0xfc, 0x57, 0x88, 0xc3, 0xba, + 0xff, 0x3a, 0x61, 0x1b, 0x9e, 0x04, 0x79, 0xc2, + 0x32, 0x3e, 0x06, 0xd9, 0xd2, 0xe1, 0x90, 0x45, + 0x64, 0xed, 0x03, 0xb2, 0x45, 0x92, 0x78, 0x22, + 0x67, 0xb9, 0x50, 0xe1, 0x0e, 0xd7, 0x11, 0x37, + 0x2c, 0x65, 0xf9, 0x98, 0x88, 0x69, 0xd4, 0xc9, + 0xd8, 0x42, 0x2a, 0x94, 0xb0, 0xa0, 0x3c, 0xa6, + 0x1b, 0x99, 0x8c, 0x0d, 0x65, 0x65, 0x8e, 0x05, + 0x30, 0x28, 0x18, 0x2a, 0xd7, 0x18, 0x26, 0x64, + 0x29, 0x2f, 0x58, 0xa0, 0xf0, 0xac, 0x70, 0xd2, + 0xc6, 0x00, 0xab, 0x11, 0x0a, 0x53, 0xc8, 0xdb, + 0x01, 0x0d, 0x54, 0xd7, 0xcb, 0x70, 0xc7, 0xb2, + 0x2d, 0x77, 0x82, 0xd4, 0xdb, 0x54, 0x51, 0x84, + 0x5a, 0x04, 0x67, 0x76, 0x97, 0xb4, 0xe1, 0x51, + 0x57, 0xe7, 0xab, 0xb5, 0xfb, 0xf6, 0xa6, 0x7e, + 0xbb, 0x22, 0xb0, 0x14, 0x11, 0x2e, 0xa4, 0xc8, + 0xe6, 0x0b, 0xf8, 0x3c, 0xc3, 0xe2, 0x01, 0xe7, + 0xf5, 0x90, 0x50, 0xed, 0x23, 0xb6, 0x10, 0x55, + 0x86, 0x47, 0xe8, 0x53, 0x90, 0x8a, 0x43, 0x40, + 0x87, 0x7f, 0xee, 0x0a, 0x9f, 0xd7, 0xd3, 0xca, + 0x45, 0x93, 0x28, 0xe4, 0x65, 0x50, 0x0b, 0xc9, + 0xe1, 0xa0, 0xe6, 0x4d, 0xb0, 0x73, 0x74, 0x4f, + 0xfb, 0xb5, 0x8f, 0x83, 0xec, 0x5a, 0xb3, 0xd7, + 0xd3, 0xc4, 0x31, 0x76, 0x5d, 0x87, 0x83, 0xda, + 0x36, 0xc1, 0xae, 0xd1, 0x37, 0x82, 0xd4, 0xdf, + 0x4f, 0x78, 0x5d, 0xcf, 0xad, 0x92, 0x79, 0xae, + 0xea, 0x75, 0x18, 0x9d, 0x2a, 0x9b, 0xa6, 0x73, + 0xa2, 0x60, 0xe7, 0x56, 0xca, 0xa8, 0x98, 0x5d, + 0x29, 0xfd, 0x38, 0xc8, 0xa8, 0x35, 0x7b, 0x3d, + 0x85, 0x1b, 0xe3, 0xd5, 0x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x60, 0xb5, + 0x58, 0x9f, 0x6c, 0x78, 0x5b, 0x0e, 0xb0, 0x06, + 0xec, 0x64, 0x5b, 0x0e, 0xd0, 0x53, 0xd7, 0xb5, + 0xbf, 0x37, 0xa3, 0xb1, 0xe9, 0x7d, 0x17, 0xeb, + 0x1b, 0x85, 0xae, 0x95, 0xd4, 0xf2, 0xea, 0x92, + 0x45, 0x7d, 0x30, 0x96, 0x36, 0x6d, 0xc1, 0xf2, + 0xe6, 0xa1, 0xf9, 0x28, 0x2b, 0xa5, 0x2f, 0x3c, + 0x74, 0x83, 0x11, 0x99, 0xc5, 0x95, 0x78, 0xb4, + 0xb8, 0xd7, 0x78, 0xdb, 0xef, 0x44, 0xb8, 0xc3, + 0x21, 0x9f, 0x78, 0x69, 0x5c, 0x96, 0x84, 0x25, + 0x37, 0x96, 0x4b, 0x99, 0xb2, 0x24, 0xc1, 0xbb, + 0x4f, 0xc1, 0xb1, 0x91, 0x17, 0x8f, 0x9c, 0x3a, + 0xfb, 0x47, 0xc1, 0xf7, 0xb9, 0x2c, 0x94, 0xf1, + 0xe6, 0x37, 0xde, 0xfe, 0xa6, 0x5e, 0xbb, 0xa2, + 0xca, 0xc6, 0x42, 0x05, 0x39, 0x43, 0x80, 0x24, + 0xba, 0x18, 0x2b, 0x8f, 0x63, 0x0c, 0x07, 0x36, + 0x47, 0x48, 0xab, 0x44, 0x89, 0x3c, 0xd1, 0x05, + 0x0a, 0x1f, 0x69, 0x2e, 0xbc, 0xb8, 0xe8, 0xea, + 0x49, 0xde, 0x75, 0x01, 0xf5, 0x47, 0xa2, 0xcd, + 0x5e, 0xaa, 0x91, 0x80, 0xf1, 0xd2, 0x16, 0x49, + 0x1b, 0x76, 0xd6, 0x63, 0xf8, 0x2d, 0xf1, 0x26, + 0xac, 0xd8, 0xf6, 0xc2, 0x25, 0x7b, 0x9d, 0x4a, + 0x78, 0x53, 0x29, 0x30, 0xc4, 0xa8, 0x71, 0x88, + 0xa6, 0xd4, 0xff, 0xba, 0xc0, 0x23, 0xf1, 0x28, + 0xa2, 0xf3, 0x51, 0xbb, 0x19, 0xd2, 0x90, 0x32, + 0x6d, 0x85, 0x4e, 0xb0, 0x6e, 0x23, 0x03, 0x6f, + 0x6d, 0xae, 0x8e, 0x67, 0xd3, 0x72, 0xaa, 0xf5, + 0x80, 0x7b, 0xeb, 0x61, 0x0a, 0xb5, 0x1c, 0xf7, + 0x7f, 0x9a, 0xd8, 0x4e, 0x64, 0x96, 0x79, 0x98, + 0xb0, 0x34, 0x9f, 0xdb, 0xb9, 0xae, 0xfc, 0x3b, + 0x78, 0xa5, 0x3f, 0x2f, 0x7a, 0x51, 0x7a, 0x0e, + 0x06, 0x0f, 0x0e, 0xae, 0xf1, 0x43, 0xc1, 0x1f, + 0xcd, 0x2f, 0x05, 0x78, 0xff, 0xa6, 0x93, 0x18, + 0x41, 0xc6, 0x59, 0x71, 0x19, 0x0b, 0x9e, 0x60, + 0x42, 0xeb, 0xb6, 0xac, 0x74, 0x72, 0x7c, 0x49, + 0x38, 0x52, 0x05, 0xba, 0x86, 0x8a, 0x84, 0x97, + 0xd6, 0xe3, 0xad, 0x7f, 0xb5, 0xa8, 0x35, 0x53, + 0x1f, 0xed, 0x8b, 0x37, 0xa7, 0x5c, 0x6b, 0xbb, + 0x89, 0x24, 0x96, 0x99, 0x7a, 0x1f, 0xb2, 0xc4, + 0xa8, 0x40, 0xdd, 0x5c, 0xc2, 0x5b, 0x33, 0x7a, + 0x09, 0xd7, 0xe8, 0x10, 0xee, 0x5d, 0x29, 0xee, + 0x08, 0xba, 0x66, 0x66, 0xda, 0x47, 0xbc, 0xce, + 0xa2, 0x0b, 0xab, 0x64, 0x46, 0x2c, 0x3b, 0x8d, + 0xa5, 0xab, 0x4d, 0x14, 0xb4, 0x96, 0x94, 0x3a, + 0x47, 0x75, 0xae, 0xbf, 0x6c, 0x1c, 0x5d, 0xb2, + 0x44, 0x6c, 0x33, 0xaa, 0x15, 0xf7, 0x94, 0xfc, + 0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a, 0xf3, 0x61, 0x8f, 0xf7, 0xca, + 0xe5, 0xb3, 0xb0, 0xb9, 0x60, 0xae, 0xb3, 0xe8, + 0x41, 0x9f, 0x68, 0x8c, 0xde, 0x3f, 0x78, 0xb4, + 0x28, 0x7e, 0x13, 0x4b, 0x7d, 0xb5, 0x35, 0x88, + 0x9b, 0xb9, 0xb3, 0xac, 0x9e, 0xd6, 0x64, 0x6f, + 0x9c, 0x17, 0x7a, 0xf8, 0x32, 0xfb, 0x0f, 0x8f, + 0x42, 0xd8, 0x87 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* symbol_sdf::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x8d, 0x55, 0x6b, 0x6f, 0xda, 0x30, + 0x14, 0xfd, 0x9e, 0x5f, 0x71, 0x25, 0xbe, 0x24, + 0x69, 0x1b, 0x1e, 0x6b, 0xab, 0x6d, 0xd1, 0x34, + 0x21, 0x08, 0x1d, 0x52, 0x29, 0x08, 0xba, 0xae, + 0xd2, 0x34, 0x59, 0x86, 0x24, 0x60, 0xc9, 0xc4, + 0x28, 0x0f, 0x4a, 0x37, 0xf5, 0xbf, 0xcf, 0xce, + 0xcb, 0x4e, 0x4a, 0xa0, 0xf9, 0x86, 0xef, 0xb9, + 0xe7, 0xdc, 0xc7, 0xb1, 0x69, 0xb9, 0x9e, 0x4f, + 0x02, 0x0f, 0x16, 0xc3, 0x11, 0x9a, 0x3d, 0xc3, + 0x67, 0xab, 0xa3, 0xb5, 0xf2, 0x23, 0x67, 0x78, + 0xe7, 0xa0, 0xbb, 0xfe, 0x64, 0xd2, 0x87, 0x8e, + 0xd5, 0xed, 0xdc, 0xb4, 0x87, 0xce, 0xd3, 0x78, + 0xe0, 0xa0, 0xd9, 0xf8, 0xd9, 0xb9, 0x47, 0xf3, + 0xfe, 0xe3, 0x78, 0xaa, 0x69, 0x49, 0x40, 0x7c, + 0x16, 0x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, 0x29, 0x3f, + 0xed, 0x0a, 0x30, 0x23, 0x2e, 0x6c, 0x31, 0x09, + 0x74, 0x03, 0xfe, 0x69, 0xc0, 0x3f, 0x31, 0x85, + 0x93, 0xde, 0x15, 0xa0, 0xa3, 0xbe, 0x85, 0x6f, + 0x0d, 0xfe, 0x6c, 0xa6, 0x55, 0x2c, 0x5a, 0xa3, + 0x95, 0x91, 0x94, 0xf6, 0x98, 0x0d, 0x9b, 0x69, + 0x0b, 0x27, 0x0a, 0xc4, 0x7b, 0x17, 0xa6, 0x84, + 0xef, 0xdc, 0x76, 0xa6, 0xc8, 0xcc, 0x70, 0x35, + 0x42, 0x19, 0x91, 0x45, 0xd6, 0x4c, 0x75, 0x86, + 0x36, 0xf5, 0xd5, 0x31, 0x56, 0x11, 0x90, 0xa4, + 0x35, 0xef, 0x88, 0x84, 0x74, 0xbd, 0x7c, 0xe5, + 0x1c, 0x94, 0x2f, 0xd9, 0x3a, 0xf0, 0x76, 0x44, + 0x28, 0xa3, 0x51, 0xdc, 0x52, 0x62, 0xba, 0xd6, + 0x41, 0x85, 0x44, 0xe4, 0xaf, 0x1a, 0xab, 0xa4, + 0xfb, 0xd8, 0xf5, 0x90, 0x9c, 0x58, 0x8e, 0xf9, + 0xdd, 0xfb, 0x63, 0x6b, 0x2a, 0x8a, 0x05, 0xf1, + 0x22, 0x97, 0x28, 0x4d, 0x08, 0xdf, 0x33, 0xe6, + 0x36, 0xf4, 0xae, 0xad, 0x0e, 0x7c, 0x4d, 0x7f, + 0xe5, 0x69, 0x69, 0x9f, 0xe9, 0x86, 0x8b, 0xe5, + 0xaa, 0x8e, 0x91, 0x26, 0x50, 0x7a, 0xe0, 0x18, + 0xe5, 0x39, 0x6e, 0x83, 0x2e, 0x45, 0xcd, 0xea, + 0xad, 0x30, 0xec, 0xfa, 0x2c, 0x97, 0x89, 0xef, + 0xf3, 0x7c, 0xbd, 0x77, 0x73, 0xcb, 0x2b, 0xb9, + 0x82, 0x5b, 0x5e, 0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, 0x61 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl -- cgit v1.2.1