@mapgis/mapbox-gl 16.0.1 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mapbox-gl.js +3 -3
- package/dist/mapbox-gl.js.map +1 -1
- package/package.json +1 -1
- package/.flowconfig +0 -61
- package/LICENSE.txt +0 -84
- package/README.md +0 -34
- package/build/banner.js +0 -4
- package/build/check-bundle-size.js +0 -140
- package/build/generate-access-token-script.js +0 -11
- package/build/generate-flow-typed-style-spec.js +0 -188
- package/build/generate-release-list.js +0 -21
- package/build/generate-struct-arrays.js +0 -237
- package/build/generate-style-code.js +0 -159
- package/build/mapbox-gl.js.flow +0 -3
- package/build/print-release-url.js +0 -6
- package/build/rollup_plugin_minify_style_spec.js +0 -20
- package/build/rollup_plugins.js +0 -80
- package/build/run-node +0 -3
- package/build/run-tap +0 -8
- package/build/test/build-tape.js +0 -19
- package/flow-typed/gl.js +0 -5
- package/flow-typed/jsdom.js +0 -18
- package/flow-typed/mapbox-gl-supported.js +0 -9
- package/flow-typed/mapbox-unitbezier.js +0 -14
- package/flow-typed/offscreen-canvas.js +0 -9
- package/flow-typed/pbf.js +0 -25
- package/flow-typed/point-geometry.js +0 -44
- package/flow-typed/potpack.js +0 -12
- package/flow-typed/sinon.js +0 -28
- package/flow-typed/vector-tile.js +0 -41
- package/src/css/mapbox-gl.css +0 -798
- package/src/css/svg/mapboxgl-ctrl-attrib.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-compass.svg +0 -4
- package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-geolocate.svg +0 -5
- package/src/css/svg/mapboxgl-ctrl-logo.svg +0 -20
- package/src/css/svg/mapboxgl-ctrl-shrink.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +0 -3
- package/src/data/array_types.js +0 -1095
- package/src/data/bucket/circle_attributes.js +0 -9
- package/src/data/bucket/circle_bucket.js +0 -204
- package/src/data/bucket/fill_attributes.js +0 -9
- package/src/data/bucket/fill_bucket.js +0 -233
- package/src/data/bucket/fill_extrusion_attributes.js +0 -10
- package/src/data/bucket/fill_extrusion_bucket.js +0 -289
- package/src/data/bucket/heatmap_bucket.js +0 -17
- package/src/data/bucket/line_attributes.js +0 -10
- package/src/data/bucket/line_bucket.js +0 -556
- package/src/data/bucket/pattern_attributes.js +0 -10
- package/src/data/bucket/pattern_bucket_features.js +0 -60
- package/src/data/bucket/symbol_attributes.js +0 -117
- package/src/data/bucket/symbol_bucket.js +0 -972
- package/src/data/bucket.js +0 -123
- package/src/data/dem_data.js +0 -125
- package/src/data/extent.js +0 -18
- package/src/data/feature_index.js +0 -321
- package/src/data/feature_position_map.js +0 -125
- package/src/data/index_array_type.js +0 -16
- package/src/data/load_geometry.js +0 -48
- package/src/data/pos_attributes.js +0 -6
- package/src/data/program_configuration.js +0 -687
- package/src/data/raster_bounds_attributes.js +0 -7
- package/src/data/segment.js +0 -76
- package/src/geo/edge_insets.js +0 -102
- package/src/geo/lng_lat.js +0 -165
- package/src/geo/lng_lat_bounds.js +0 -267
- package/src/geo/mercator_coordinate.js +0 -153
- package/src/geo/transform.js +0 -864
- package/src/gl/color_mode.js +0 -34
- package/src/gl/context.js +0 -298
- package/src/gl/cull_face_mode.js +0 -26
- package/src/gl/depth_mode.js +0 -29
- package/src/gl/framebuffer.js +0 -44
- package/src/gl/index_buffer.js +0 -55
- package/src/gl/stencil_mode.js +0 -30
- package/src/gl/types.js +0 -84
- package/src/gl/value.js +0 -520
- package/src/gl/vertex_buffer.js +0 -119
- package/src/index.js +0 -201
- package/src/render/draw_background.js +0 -57
- package/src/render/draw_circle.js +0 -113
- package/src/render/draw_collision_debug.js +0 -49
- package/src/render/draw_custom.js +0 -49
- package/src/render/draw_debug.js +0 -127
- package/src/render/draw_fill.js +0 -126
- package/src/render/draw_fill_extrusion.js +0 -96
- package/src/render/draw_heatmap.js +0 -140
- package/src/render/draw_hillshade.js +0 -108
- package/src/render/draw_line.js +0 -98
- package/src/render/draw_raster.js +0 -125
- package/src/render/draw_symbol.js +0 -394
- package/src/render/glyph_atlas.js +0 -71
- package/src/render/glyph_manager.js +0 -182
- package/src/render/image_atlas.js +0 -149
- package/src/render/image_manager.js +0 -306
- package/src/render/line_atlas.js +0 -210
- package/src/render/painter.js +0 -653
- package/src/render/program/background_program.js +0 -103
- package/src/render/program/circle_program.js +0 -69
- package/src/render/program/clipping_mask_program.js +0 -20
- package/src/render/program/collision_program.js +0 -49
- package/src/render/program/debug_program.js +0 -35
- package/src/render/program/fill_extrusion_program.js +0 -122
- package/src/render/program/fill_program.js +0 -126
- package/src/render/program/heatmap_program.js +0 -83
- package/src/render/program/hillshade_program.js +0 -122
- package/src/render/program/line_program.js +0 -207
- package/src/render/program/pattern.js +0 -102
- package/src/render/program/program_uniforms.js +0 -42
- package/src/render/program/raster_program.js +0 -92
- package/src/render/program/symbol_program.js +0 -224
- package/src/render/program.js +0 -168
- package/src/render/texture.js +0 -122
- package/src/render/uniform_binding.js +0 -147
- package/src/render/vertex_array_object.js +0 -163
- package/src/shaders/README.md +0 -42
- package/src/shaders/_prelude.fragment.glsl +0 -17
- package/src/shaders/_prelude.vertex.glsl +0 -73
- package/src/shaders/background.fragment.glsl +0 -10
- package/src/shaders/background.vertex.glsl +0 -7
- package/src/shaders/background_pattern.fragment.glsl +0 -28
- package/src/shaders/background_pattern.vertex.glsl +0 -20
- package/src/shaders/circle.fragment.glsl +0 -39
- package/src/shaders/circle.vertex.glsl +0 -64
- package/src/shaders/clipping_mask.fragment.glsl +0 -3
- package/src/shaders/clipping_mask.vertex.glsl +0 -7
- package/src/shaders/collision_box.fragment.glsl +0 -21
- package/src/shaders/collision_box.vertex.glsl +0 -27
- package/src/shaders/collision_circle.fragment.glsl +0 -34
- package/src/shaders/collision_circle.vertex.glsl +0 -36
- package/src/shaders/debug.fragment.glsl +0 -9
- package/src/shaders/debug.vertex.glsl +0 -12
- package/src/shaders/encode_attribute.js +0 -17
- package/src/shaders/fill.fragment.glsl +0 -13
- package/src/shaders/fill.vertex.glsl +0 -13
- package/src/shaders/fill_extrusion.fragment.glsl +0 -9
- package/src/shaders/fill_extrusion.vertex.glsl +0 -66
- package/src/shaders/fill_extrusion_pattern.fragment.glsl +0 -45
- package/src/shaders/fill_extrusion_pattern.vertex.glsl +0 -79
- package/src/shaders/fill_outline.fragment.glsl +0 -17
- package/src/shaders/fill_outline.vertex.glsl +0 -17
- package/src/shaders/fill_outline_pattern.fragment.glsl +0 -43
- package/src/shaders/fill_outline_pattern.vertex.glsl +0 -44
- package/src/shaders/fill_pattern.fragment.glsl +0 -36
- package/src/shaders/fill_pattern.vertex.glsl +0 -39
- package/src/shaders/heatmap.fragment.glsl +0 -22
- package/src/shaders/heatmap.vertex.glsl +0 -54
- package/src/shaders/heatmap_texture.fragment.glsl +0 -14
- package/src/shaders/heatmap_texture.vertex.glsl +0 -11
- package/src/shaders/hillshade.fragment.glsl +0 -52
- package/src/shaders/hillshade.vertex.glsl +0 -11
- package/src/shaders/hillshade_prepare.fragment.glsl +0 -74
- package/src/shaders/hillshade_prepare.vertex.glsl +0 -15
- package/src/shaders/index.js +0 -20
- package/src/shaders/line.fragment.glsl +0 -30
- package/src/shaders/line.vertex.glsl +0 -85
- package/src/shaders/line_gradient.fragment.glsl +0 -34
- package/src/shaders/line_gradient.vertex.glsl +0 -87
- package/src/shaders/line_pattern.fragment.glsl +0 -74
- package/src/shaders/line_pattern.vertex.glsl +0 -99
- package/src/shaders/line_sdf.fragment.glsl +0 -45
- package/src/shaders/line_sdf.vertex.glsl +0 -98
- package/src/shaders/raster.fragment.glsl +0 -52
- package/src/shaders/raster.vertex.glsl +0 -21
- package/src/shaders/shaders.js +0 -180
- package/src/shaders/symbol_icon.fragment.glsl +0 -17
- package/src/shaders/symbol_icon.vertex.glsl +0 -94
- package/src/shaders/symbol_sdf.fragment.glsl +0 -52
- package/src/shaders/symbol_sdf.vertex.glsl +0 -115
- package/src/shaders/symbol_text_and_icon.fragment.glsl +0 -68
- package/src/shaders/symbol_text_and_icon.vertex.glsl +0 -116
- package/src/source/canvas_source.js +0 -238
- package/src/source/geojson_helper.js +0 -92
- package/src/source/geojson_source.js +0 -374
- package/src/source/geojson_worker_source.js +0 -357
- package/src/source/geojson_wrapper.js +0 -94
- package/src/source/image_source.js +0 -307
- package/src/source/load_tilejson.js +0 -39
- package/src/source/mbtiles_source.js +0 -115
- package/src/source/offline_database.js +0 -61
- package/src/source/offline_database_root.js +0 -62
- package/src/source/pixels_to_tile_units.js +0 -21
- package/src/source/query_features.js +0 -208
- package/src/source/raster_dem_tile_source.js +0 -138
- package/src/source/raster_dem_tile_worker_source.js +0 -62
- package/src/source/raster_tile_offline_source.js +0 -136
- package/src/source/raster_tile_source.js +0 -177
- package/src/source/rtl_text_plugin.js +0 -138
- package/src/source/source.js +0 -137
- package/src/source/source_cache.js +0 -957
- package/src/source/source_state.js +0 -159
- package/src/source/tile.js +0 -465
- package/src/source/tile_bounds.js +0 -38
- package/src/source/tile_cache.js +0 -212
- package/src/source/tile_id.js +0 -402
- package/src/source/vector_tile_source.js +0 -192
- package/src/source/vector_tile_worker_source.js +0 -216
- package/src/source/video_source.js +0 -203
- package/src/source/worker.js +0 -237
- package/src/source/worker_source.js +0 -106
- package/src/source/worker_tile.js +0 -224
- package/src/style/create_style_layer.js +0 -36
- package/src/style/evaluation_parameters.js +0 -62
- package/src/style/light.js +0 -130
- package/src/style/load_glyph_range.js +0 -38
- package/src/style/load_sprite.js +0 -67
- package/src/style/parse_glyph_pbf.js +0 -44
- package/src/style/pauseable_placement.js +0 -132
- package/src/style/properties.js +0 -753
- package/src/style/query_utils.js +0 -43
- package/src/style/style.js +0 -1361
- package/src/style/style_glyph.js +0 -17
- package/src/style/style_image.js +0 -137
- package/src/style/style_layer/background_style_layer.js +0 -21
- package/src/style/style_layer/background_style_layer_properties.js +0 -40
- package/src/style/style_layer/circle_style_layer.js +0 -98
- package/src/style/style_layer/circle_style_layer_properties.js +0 -63
- package/src/style/style_layer/custom_style_layer.js +0 -223
- package/src/style/style_layer/fill_extrusion_style_layer.js +0 -224
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +0 -50
- package/src/style/style_layer/fill_style_layer.js +0 -67
- package/src/style/style_layer/fill_style_layer_properties.js +0 -55
- package/src/style/style_layer/heatmap_style_layer.js +0 -69
- package/src/style/style_layer/heatmap_style_layer_properties.js +0 -44
- package/src/style/style_layer/hillshade_style_layer.js +0 -25
- package/src/style/style_layer/hillshade_style_layer_properties.js +0 -46
- package/src/style/style_layer/layer_properties.js.ejs +0 -69
- package/src/style/style_layer/line_style_layer.js +0 -151
- package/src/style/style_layer/line_style_layer_properties.js +0 -71
- package/src/style/style_layer/raster_style_layer.js +0 -21
- package/src/style/style_layer/raster_style_layer_properties.js +0 -50
- package/src/style/style_layer/symbol_style_layer.js +0 -190
- package/src/style/style_layer/symbol_style_layer_properties.js +0 -153
- package/src/style/style_layer/typed_style_layer.js +0 -17
- package/src/style/style_layer.js +0 -281
- package/src/style/style_layer_index.js +0 -80
- package/src/style/validate_style.js +0 -42
- package/src/style/zoom_history.js +0 -44
- package/src/style-spec/.eslintrc +0 -5
- package/src/style-spec/CHANGELOG.md +0 -438
- package/src/style-spec/README.md +0 -59
- package/src/style-spec/bin/gl-style-composite +0 -9
- package/src/style-spec/bin/gl-style-format +0 -22
- package/src/style-spec/bin/gl-style-migrate +0 -9
- package/src/style-spec/bin/gl-style-validate +0 -50
- package/src/style-spec/composite.js +0 -50
- package/src/style-spec/declass.js +0 -42
- package/src/style-spec/deref.js +0 -52
- package/src/style-spec/diff.js +0 -393
- package/src/style-spec/dist/.gitkeep +0 -0
- package/src/style-spec/empty.js +0 -29
- package/src/style-spec/error/parsing_error.js +0 -16
- package/src/style-spec/error/validation_error.js +0 -18
- package/src/style-spec/expression/compound_expression.js +0 -162
- package/src/style-spec/expression/definitions/assertion.js +0 -130
- package/src/style-spec/expression/definitions/at.js +0 -70
- package/src/style-spec/expression/definitions/case.js +0 -85
- package/src/style-spec/expression/definitions/coalesce.js +0 -93
- package/src/style-spec/expression/definitions/coercion.js +0 -133
- package/src/style-spec/expression/definitions/collator.js +0 -78
- package/src/style-spec/expression/definitions/comparison.js +0 -184
- package/src/style-spec/expression/definitions/format.js +0 -144
- package/src/style-spec/expression/definitions/format_section_override.js +0 -54
- package/src/style-spec/expression/definitions/image.js +0 -52
- package/src/style-spec/expression/definitions/in.js +0 -92
- package/src/style-spec/expression/definitions/index.js +0 -561
- package/src/style-spec/expression/definitions/interpolate.js +0 -267
- package/src/style-spec/expression/definitions/length.js +0 -61
- package/src/style-spec/expression/definitions/let.js +0 -72
- package/src/style-spec/expression/definitions/literal.js +0 -77
- package/src/style-spec/expression/definitions/match.js +0 -158
- package/src/style-spec/expression/definitions/number_format.js +0 -142
- package/src/style-spec/expression/definitions/step.js +0 -120
- package/src/style-spec/expression/definitions/var.js +0 -46
- package/src/style-spec/expression/definitions/within.js +0 -333
- package/src/style-spec/expression/evaluation_context.js +0 -59
- package/src/style-spec/expression/expression.js +0 -27
- package/src/style-spec/expression/index.js +0 -392
- package/src/style-spec/expression/is_constant.js +0 -59
- package/src/style-spec/expression/parsing_context.js +0 -233
- package/src/style-spec/expression/parsing_error.js +0 -13
- package/src/style-spec/expression/runtime_error.js +0 -17
- package/src/style-spec/expression/scope.js +0 -36
- package/src/style-spec/expression/stops.js +0 -39
- package/src/style-spec/expression/types/collator.js +0 -61
- package/src/style-spec/expression/types/formatted.js +0 -73
- package/src/style-spec/expression/types/resolved_image.js +0 -29
- package/src/style-spec/expression/types.js +0 -106
- package/src/style-spec/expression/values.js +0 -123
- package/src/style-spec/feature_filter/README.md +0 -55
- package/src/style-spec/feature_filter/convert.js +0 -208
- package/src/style-spec/feature_filter/index.js +0 -165
- package/src/style-spec/format.js +0 -51
- package/src/style-spec/function/convert.js +0 -254
- package/src/style-spec/function/index.js +0 -262
- package/src/style-spec/group_by_layout.js +0 -75
- package/src/style-spec/migrate/expressions.js +0 -39
- package/src/style-spec/migrate/v8.js +0 -203
- package/src/style-spec/migrate/v9.js +0 -26
- package/src/style-spec/migrate.js +0 -36
- package/src/style-spec/package.json +0 -41
- package/src/style-spec/read_style.js +0 -14
- package/src/style-spec/reference/latest.js +0 -3
- package/src/style-spec/reference/v8.json +0 -5808
- package/src/style-spec/rollup.config.js +0 -45
- package/src/style-spec/style-spec.js +0 -122
- package/src/style-spec/types.js +0 -438
- package/src/style-spec/util/color.js +0 -95
- package/src/style-spec/util/color_spaces.js +0 -139
- package/src/style-spec/util/deep_equal.js +0 -28
- package/src/style-spec/util/extend.js +0 -10
- package/src/style-spec/util/get_type.js +0 -17
- package/src/style-spec/util/interpolate.js +0 -22
- package/src/style-spec/util/properties.js +0 -15
- package/src/style-spec/util/ref_properties.js +0 -2
- package/src/style-spec/util/result.js +0 -19
- package/src/style-spec/util/unbundle_jsonlint.js +0 -24
- package/src/style-spec/validate/latest.js +0 -11
- package/src/style-spec/validate/validate.js +0 -75
- package/src/style-spec/validate/validate_array.js +0 -52
- package/src/style-spec/validate/validate_boolean.js +0 -15
- package/src/style-spec/validate/validate_color.js +0 -20
- package/src/style-spec/validate/validate_constants.js +0 -13
- package/src/style-spec/validate/validate_enum.js +0 -21
- package/src/style-spec/validate/validate_expression.js +0 -43
- package/src/style-spec/validate/validate_filter.js +0 -111
- package/src/style-spec/validate/validate_formatted.js +0 -11
- package/src/style-spec/validate/validate_function.js +0 -207
- package/src/style-spec/validate/validate_glyphs_url.js +0 -21
- package/src/style-spec/validate/validate_image.js +0 -11
- package/src/style-spec/validate/validate_layer.js +0 -134
- package/src/style-spec/validate/validate_layout_property.js +0 -6
- package/src/style-spec/validate/validate_light.js +0 -47
- package/src/style-spec/validate/validate_number.js +0 -29
- package/src/style-spec/validate/validate_object.js +0 -61
- package/src/style-spec/validate/validate_paint_property.js +0 -6
- package/src/style-spec/validate/validate_property.js +0 -64
- package/src/style-spec/validate/validate_source.js +0 -111
- package/src/style-spec/validate/validate_string.js +0 -15
- package/src/style-spec/validate_mapbox_api_supported.js +0 -171
- package/src/style-spec/validate_style.js +0 -39
- package/src/style-spec/validate_style.min.js +0 -78
- package/src/style-spec/visit.js +0 -77
- package/src/symbol/anchor.js +0 -26
- package/src/symbol/check_max_angle.js +0 -81
- package/src/symbol/clip_line.js +0 -71
- package/src/symbol/collision_feature.js +0 -217
- package/src/symbol/collision_index.js +0 -372
- package/src/symbol/cross_tile_symbol_index.js +0 -301
- package/src/symbol/get_anchors.js +0 -167
- package/src/symbol/grid_index.js +0 -335
- package/src/symbol/mergelines.js +0 -82
- package/src/symbol/one_em.js +0 -4
- package/src/symbol/opacity_state.js +0 -27
- package/src/symbol/placement.js +0 -1062
- package/src/symbol/projection.js +0 -450
- package/src/symbol/quads.js +0 -334
- package/src/symbol/shaping.js +0 -816
- package/src/symbol/symbol_layout.js +0 -772
- package/src/symbol/symbol_size.js +0 -113
- package/src/symbol/transform_text.js +0 -29
- package/src/types/callback.js +0 -17
- package/src/types/cancelable.js +0 -3
- package/src/types/tilejson.js +0 -17
- package/src/types/transferable.js +0 -3
- package/src/types/window.js +0 -172
- package/src/ui/anchor.js +0 -32
- package/src/ui/bind_handlers.js +0 -202
- package/src/ui/camera.js +0 -1152
- package/src/ui/control/attribution_control.js +0 -189
- package/src/ui/control/fps_control.js +0 -185
- package/src/ui/control/fullscreen_control.js +0 -147
- package/src/ui/control/geolocate_control.js +0 -594
- package/src/ui/control/logo_control.js +0 -92
- package/src/ui/control/navigation_control.js +0 -148
- package/src/ui/control/scale_control.js +0 -142
- package/src/ui/crs.js +0 -64
- package/src/ui/default_locale.js +0 -20
- package/src/ui/events.js +0 -806
- package/src/ui/handler/box_zoom.js +0 -175
- package/src/ui/handler/dblclick_zoom.js +0 -139
- package/src/ui/handler/drag_pan.js +0 -416
- package/src/ui/handler/drag_rotate.js +0 -378
- package/src/ui/handler/keyboard.js +0 -161
- package/src/ui/handler/scroll_zoom.js +0 -333
- package/src/ui/handler/touch_zoom_rotate.js +0 -293
- package/src/ui/hash.js +0 -147
- package/src/ui/map.js +0 -2883
- package/src/ui/marker.js +0 -607
- package/src/ui/offline_map.js +0 -91
- package/src/ui/popup.js +0 -530
- package/src/util/actor.js +0 -212
- package/src/util/ajax.js +0 -371
- package/src/util/browser/web_worker.js +0 -10
- package/src/util/browser/window.js +0 -5
- package/src/util/browser.js +0 -70
- package/src/util/classify_rings.js +0 -52
- package/src/util/color_ramp.js +0 -28
- package/src/util/config.js +0 -30
- package/src/util/debug.js +0 -12
- package/src/util/dictionary_coder.js +0 -30
- package/src/util/dispatcher.js +0 -70
- package/src/util/dom.js +0 -144
- package/src/util/evented.js +0 -174
- package/src/util/find_pole_of_inaccessibility.js +0 -129
- package/src/util/global_worker_pool.js +0 -17
- package/src/util/image.js +0 -142
- package/src/util/intersection_tests.js +0 -208
- package/src/util/is_char_in_unicode_block.js +0 -311
- package/src/util/mapbox.js +0 -486
- package/src/util/offscreen_canvas_supported.js +0 -14
- package/src/util/performance.js +0 -112
- package/src/util/primitives.js +0 -145
- package/src/util/resolve_tokens.js +0 -16
- package/src/util/script_detection.js +0 -328
- package/src/util/sku_token.js +0 -42
- package/src/util/smart_wrap.js +0 -55
- package/src/util/struct_array.js +0 -243
- package/src/util/struct_array.js.ejs +0 -112
- package/src/util/struct_array_layout.js.ejs +0 -98
- package/src/util/task_queue.js +0 -68
- package/src/util/throttle.js +0 -28
- package/src/util/throttled_invoker.js +0 -46
- package/src/util/tile_cover.js +0 -101
- package/src/util/tile_request_cache.js +0 -172
- package/src/util/util.js +0 -504
- package/src/util/vectortile_to_geojson.js +0 -54
- package/src/util/verticalize_punctuation.js +0 -114
- package/src/util/web_worker.js +0 -91
- package/src/util/web_worker_transfer.js +0 -266
- package/src/util/webp_supported.js +0 -69
- package/src/util/window.js +0 -102
- package/src/util/worker_pool.js +0 -47
package/src/shaders/shaders.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Disable Flow annotations here because Flow doesn't support importing GLSL files
|
|
3
|
-
/* eslint-disable flowtype/require-valid-file-annotation */
|
|
4
|
-
|
|
5
|
-
import preludeFrag from './_prelude.fragment.glsl';
|
|
6
|
-
import preludeVert from './_prelude.vertex.glsl';
|
|
7
|
-
import backgroundFrag from './background.fragment.glsl';
|
|
8
|
-
import backgroundVert from './background.vertex.glsl';
|
|
9
|
-
import backgroundPatternFrag from './background_pattern.fragment.glsl';
|
|
10
|
-
import backgroundPatternVert from './background_pattern.vertex.glsl';
|
|
11
|
-
import circleFrag from './circle.fragment.glsl';
|
|
12
|
-
import circleVert from './circle.vertex.glsl';
|
|
13
|
-
import clippingMaskFrag from './clipping_mask.fragment.glsl';
|
|
14
|
-
import clippingMaskVert from './clipping_mask.vertex.glsl';
|
|
15
|
-
import heatmapFrag from './heatmap.fragment.glsl';
|
|
16
|
-
import heatmapVert from './heatmap.vertex.glsl';
|
|
17
|
-
import heatmapTextureFrag from './heatmap_texture.fragment.glsl';
|
|
18
|
-
import heatmapTextureVert from './heatmap_texture.vertex.glsl';
|
|
19
|
-
import collisionBoxFrag from './collision_box.fragment.glsl';
|
|
20
|
-
import collisionBoxVert from './collision_box.vertex.glsl';
|
|
21
|
-
import collisionCircleFrag from './collision_circle.fragment.glsl';
|
|
22
|
-
import collisionCircleVert from './collision_circle.vertex.glsl';
|
|
23
|
-
import debugFrag from './debug.fragment.glsl';
|
|
24
|
-
import debugVert from './debug.vertex.glsl';
|
|
25
|
-
import fillFrag from './fill.fragment.glsl';
|
|
26
|
-
import fillVert from './fill.vertex.glsl';
|
|
27
|
-
import fillOutlineFrag from './fill_outline.fragment.glsl';
|
|
28
|
-
import fillOutlineVert from './fill_outline.vertex.glsl';
|
|
29
|
-
import fillOutlinePatternFrag from './fill_outline_pattern.fragment.glsl';
|
|
30
|
-
import fillOutlinePatternVert from './fill_outline_pattern.vertex.glsl';
|
|
31
|
-
import fillPatternFrag from './fill_pattern.fragment.glsl';
|
|
32
|
-
import fillPatternVert from './fill_pattern.vertex.glsl';
|
|
33
|
-
import fillExtrusionFrag from './fill_extrusion.fragment.glsl';
|
|
34
|
-
import fillExtrusionVert from './fill_extrusion.vertex.glsl';
|
|
35
|
-
import fillExtrusionPatternFrag from './fill_extrusion_pattern.fragment.glsl';
|
|
36
|
-
import fillExtrusionPatternVert from './fill_extrusion_pattern.vertex.glsl';
|
|
37
|
-
import hillshadePrepareFrag from './hillshade_prepare.fragment.glsl';
|
|
38
|
-
import hillshadePrepareVert from './hillshade_prepare.vertex.glsl';
|
|
39
|
-
import hillshadeFrag from './hillshade.fragment.glsl';
|
|
40
|
-
import hillshadeVert from './hillshade.vertex.glsl';
|
|
41
|
-
import lineFrag from './line.fragment.glsl';
|
|
42
|
-
import lineVert from './line.vertex.glsl';
|
|
43
|
-
import lineGradientFrag from './line_gradient.fragment.glsl';
|
|
44
|
-
import lineGradientVert from './line_gradient.vertex.glsl';
|
|
45
|
-
import linePatternFrag from './line_pattern.fragment.glsl';
|
|
46
|
-
import linePatternVert from './line_pattern.vertex.glsl';
|
|
47
|
-
import lineSDFFrag from './line_sdf.fragment.glsl';
|
|
48
|
-
import lineSDFVert from './line_sdf.vertex.glsl';
|
|
49
|
-
import rasterFrag from './raster.fragment.glsl';
|
|
50
|
-
import rasterVert from './raster.vertex.glsl';
|
|
51
|
-
import symbolIconFrag from './symbol_icon.fragment.glsl';
|
|
52
|
-
import symbolIconVert from './symbol_icon.vertex.glsl';
|
|
53
|
-
import symbolSDFFrag from './symbol_sdf.fragment.glsl';
|
|
54
|
-
import symbolSDFVert from './symbol_sdf.vertex.glsl';
|
|
55
|
-
import symbolTextAndIconFrag from './symbol_text_and_icon.fragment.glsl';
|
|
56
|
-
import symbolTextAndIconVert from './symbol_text_and_icon.vertex.glsl';
|
|
57
|
-
|
|
58
|
-
export const prelude = compile(preludeFrag, preludeVert);
|
|
59
|
-
export const background = compile(backgroundFrag, backgroundVert);
|
|
60
|
-
export const backgroundPattern = compile(backgroundPatternFrag, backgroundPatternVert);
|
|
61
|
-
export const circle = compile(circleFrag, circleVert);
|
|
62
|
-
export const clippingMask = compile(clippingMaskFrag, clippingMaskVert);
|
|
63
|
-
export const heatmap = compile(heatmapFrag, heatmapVert);
|
|
64
|
-
export const heatmapTexture = compile(heatmapTextureFrag, heatmapTextureVert);
|
|
65
|
-
export const collisionBox = compile(collisionBoxFrag, collisionBoxVert);
|
|
66
|
-
export const collisionCircle = compile(collisionCircleFrag, collisionCircleVert);
|
|
67
|
-
export const debug = compile(debugFrag, debugVert);
|
|
68
|
-
export const fill = compile(fillFrag, fillVert);
|
|
69
|
-
export const fillOutline = compile(fillOutlineFrag, fillOutlineVert);
|
|
70
|
-
export const fillOutlinePattern = compile(fillOutlinePatternFrag, fillOutlinePatternVert);
|
|
71
|
-
export const fillPattern = compile(fillPatternFrag, fillPatternVert);
|
|
72
|
-
export const fillExtrusion = compile(fillExtrusionFrag, fillExtrusionVert);
|
|
73
|
-
export const fillExtrusionPattern = compile(fillExtrusionPatternFrag, fillExtrusionPatternVert);
|
|
74
|
-
export const hillshadePrepare = compile(hillshadePrepareFrag, hillshadePrepareVert);
|
|
75
|
-
export const hillshade = compile(hillshadeFrag, hillshadeVert);
|
|
76
|
-
export const line = compile(lineFrag, lineVert);
|
|
77
|
-
export const lineGradient = compile(lineGradientFrag, lineGradientVert);
|
|
78
|
-
export const linePattern = compile(linePatternFrag, linePatternVert);
|
|
79
|
-
export const lineSDF = compile(lineSDFFrag, lineSDFVert);
|
|
80
|
-
export const raster = compile(rasterFrag, rasterVert);
|
|
81
|
-
export const symbolIcon = compile(symbolIconFrag, symbolIconVert);
|
|
82
|
-
export const symbolSDF = compile(symbolSDFFrag, symbolSDFVert);
|
|
83
|
-
export const symbolTextAndIcon = compile(symbolTextAndIconFrag, symbolTextAndIconVert);
|
|
84
|
-
|
|
85
|
-
// Expand #pragmas to #ifdefs.
|
|
86
|
-
|
|
87
|
-
function compile(fragmentSource, vertexSource) {
|
|
88
|
-
const re = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g;
|
|
89
|
-
|
|
90
|
-
const fragmentPragmas = {};
|
|
91
|
-
|
|
92
|
-
fragmentSource = fragmentSource.replace(re, (match, operation, precision, type, name) => {
|
|
93
|
-
fragmentPragmas[name] = true;
|
|
94
|
-
if (operation === 'define') {
|
|
95
|
-
return `
|
|
96
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
97
|
-
varying ${precision} ${type} ${name};
|
|
98
|
-
#else
|
|
99
|
-
uniform ${precision} ${type} u_${name};
|
|
100
|
-
#endif
|
|
101
|
-
`;
|
|
102
|
-
} else /* if (operation === 'initialize') */ {
|
|
103
|
-
return `
|
|
104
|
-
#ifdef HAS_UNIFORM_u_${name}
|
|
105
|
-
${precision} ${type} ${name} = u_${name};
|
|
106
|
-
#endif
|
|
107
|
-
`;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
vertexSource = vertexSource.replace(re, (match, operation, precision, type, name) => {
|
|
112
|
-
const attrType = type === 'float' ? 'vec2' : 'vec4';
|
|
113
|
-
const unpackType = name.match(/color/) ? 'color' : attrType;
|
|
114
|
-
|
|
115
|
-
if (fragmentPragmas[name]) {
|
|
116
|
-
if (operation === 'define') {
|
|
117
|
-
return `
|
|
118
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
119
|
-
uniform lowp float u_${name}_t;
|
|
120
|
-
attribute ${precision} ${attrType} a_${name};
|
|
121
|
-
varying ${precision} ${type} ${name};
|
|
122
|
-
#else
|
|
123
|
-
uniform ${precision} ${type} u_${name};
|
|
124
|
-
#endif
|
|
125
|
-
`;
|
|
126
|
-
} else /* if (operation === 'initialize') */ {
|
|
127
|
-
if (unpackType === 'vec4') {
|
|
128
|
-
// vec4 attributes are only used for cross-faded properties, and are not packed
|
|
129
|
-
return `
|
|
130
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
131
|
-
${name} = a_${name};
|
|
132
|
-
#else
|
|
133
|
-
${precision} ${type} ${name} = u_${name};
|
|
134
|
-
#endif
|
|
135
|
-
`;
|
|
136
|
-
} else {
|
|
137
|
-
return `
|
|
138
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
139
|
-
${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);
|
|
140
|
-
#else
|
|
141
|
-
${precision} ${type} ${name} = u_${name};
|
|
142
|
-
#endif
|
|
143
|
-
`;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} else {
|
|
147
|
-
if (operation === 'define') {
|
|
148
|
-
return `
|
|
149
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
150
|
-
uniform lowp float u_${name}_t;
|
|
151
|
-
attribute ${precision} ${attrType} a_${name};
|
|
152
|
-
#else
|
|
153
|
-
uniform ${precision} ${type} u_${name};
|
|
154
|
-
#endif
|
|
155
|
-
`;
|
|
156
|
-
} else /* if (operation === 'initialize') */ {
|
|
157
|
-
if (unpackType === 'vec4') {
|
|
158
|
-
// vec4 attributes are only used for cross-faded properties, and are not packed
|
|
159
|
-
return `
|
|
160
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
161
|
-
${precision} ${type} ${name} = a_${name};
|
|
162
|
-
#else
|
|
163
|
-
${precision} ${type} ${name} = u_${name};
|
|
164
|
-
#endif
|
|
165
|
-
`;
|
|
166
|
-
} else /* */{
|
|
167
|
-
return `
|
|
168
|
-
#ifndef HAS_UNIFORM_u_${name}
|
|
169
|
-
${precision} ${type} ${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);
|
|
170
|
-
#else
|
|
171
|
-
${precision} ${type} ${name} = u_${name};
|
|
172
|
-
#endif
|
|
173
|
-
`;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return {fragmentSource, vertexSource};
|
|
180
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
uniform sampler2D u_texture;
|
|
2
|
-
|
|
3
|
-
varying vec2 v_tex;
|
|
4
|
-
varying float v_fade_opacity;
|
|
5
|
-
|
|
6
|
-
#pragma mapbox: define lowp float opacity
|
|
7
|
-
|
|
8
|
-
void main() {
|
|
9
|
-
#pragma mapbox: initialize lowp float opacity
|
|
10
|
-
|
|
11
|
-
lowp float alpha = opacity * v_fade_opacity;
|
|
12
|
-
gl_FragColor = texture2D(u_texture, v_tex) * alpha;
|
|
13
|
-
|
|
14
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
15
|
-
gl_FragColor = vec4(1.0);
|
|
16
|
-
#endif
|
|
17
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const float PI = 3.141592653589793;
|
|
2
|
-
|
|
3
|
-
attribute vec4 a_pos_offset;
|
|
4
|
-
attribute vec4 a_data;
|
|
5
|
-
attribute vec4 a_pixeloffset;
|
|
6
|
-
attribute vec3 a_projected_pos;
|
|
7
|
-
attribute float a_fade_opacity;
|
|
8
|
-
|
|
9
|
-
uniform bool u_is_size_zoom_constant;
|
|
10
|
-
uniform bool u_is_size_feature_constant;
|
|
11
|
-
uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
|
12
|
-
uniform highp float u_size; // used when size is both zoom and feature constant
|
|
13
|
-
uniform highp float u_camera_to_center_distance;
|
|
14
|
-
uniform highp float u_pitch;
|
|
15
|
-
uniform bool u_rotate_symbol;
|
|
16
|
-
uniform highp float u_aspect_ratio;
|
|
17
|
-
uniform float u_fade_change;
|
|
18
|
-
|
|
19
|
-
uniform mat4 u_matrix;
|
|
20
|
-
uniform mat4 u_label_plane_matrix;
|
|
21
|
-
uniform mat4 u_coord_matrix;
|
|
22
|
-
|
|
23
|
-
uniform bool u_is_text;
|
|
24
|
-
uniform bool u_pitch_with_map;
|
|
25
|
-
|
|
26
|
-
uniform vec2 u_texsize;
|
|
27
|
-
|
|
28
|
-
varying vec2 v_tex;
|
|
29
|
-
varying float v_fade_opacity;
|
|
30
|
-
|
|
31
|
-
#pragma mapbox: define lowp float opacity
|
|
32
|
-
|
|
33
|
-
void main() {
|
|
34
|
-
#pragma mapbox: initialize lowp float opacity
|
|
35
|
-
|
|
36
|
-
vec2 a_pos = a_pos_offset.xy;
|
|
37
|
-
vec2 a_offset = a_pos_offset.zw;
|
|
38
|
-
|
|
39
|
-
vec2 a_tex = a_data.xy;
|
|
40
|
-
vec2 a_size = a_data.zw;
|
|
41
|
-
|
|
42
|
-
float a_size_min = floor(a_size[0] * 0.5);
|
|
43
|
-
vec2 a_pxoffset = a_pixeloffset.xy;
|
|
44
|
-
vec2 a_minFontScale = a_pixeloffset.zw / 256.0;
|
|
45
|
-
|
|
46
|
-
highp float segment_angle = -a_projected_pos[2];
|
|
47
|
-
float size;
|
|
48
|
-
|
|
49
|
-
if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
50
|
-
size = mix(a_size_min, a_size[1], u_size_t) / 128.0;
|
|
51
|
-
} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
52
|
-
size = a_size_min / 128.0;
|
|
53
|
-
} else {
|
|
54
|
-
size = u_size;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);
|
|
58
|
-
highp float camera_to_anchor_distance = projectedPoint.w;
|
|
59
|
-
// See comments in symbol_sdf.vertex
|
|
60
|
-
highp float distance_ratio = u_pitch_with_map ?
|
|
61
|
-
camera_to_anchor_distance / u_camera_to_center_distance :
|
|
62
|
-
u_camera_to_center_distance / camera_to_anchor_distance;
|
|
63
|
-
highp float perspective_ratio = clamp(
|
|
64
|
-
0.5 + 0.5 * distance_ratio,
|
|
65
|
-
0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles
|
|
66
|
-
4.0);
|
|
67
|
-
|
|
68
|
-
size *= perspective_ratio;
|
|
69
|
-
|
|
70
|
-
float fontScale = u_is_text ? size / 24.0 : size;
|
|
71
|
-
|
|
72
|
-
highp float symbol_rotation = 0.0;
|
|
73
|
-
if (u_rotate_symbol) {
|
|
74
|
-
// See comments in symbol_sdf.vertex
|
|
75
|
-
vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);
|
|
76
|
-
|
|
77
|
-
vec2 a = projectedPoint.xy / projectedPoint.w;
|
|
78
|
-
vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;
|
|
79
|
-
|
|
80
|
-
symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
highp float angle_sin = sin(segment_angle + symbol_rotation);
|
|
84
|
-
highp float angle_cos = cos(segment_angle + symbol_rotation);
|
|
85
|
-
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
86
|
-
|
|
87
|
-
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
|
|
88
|
-
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * max(a_minFontScale, fontScale) + a_pxoffset / 16.0), 0.0, 1.0);
|
|
89
|
-
|
|
90
|
-
v_tex = a_tex / u_texsize;
|
|
91
|
-
vec2 fade_opacity = unpack_opacity(a_fade_opacity);
|
|
92
|
-
float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
|
|
93
|
-
v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));
|
|
94
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#define SDF_PX 8.0
|
|
2
|
-
|
|
3
|
-
uniform bool u_is_halo;
|
|
4
|
-
uniform sampler2D u_texture;
|
|
5
|
-
uniform highp float u_gamma_scale;
|
|
6
|
-
uniform lowp float u_device_pixel_ratio;
|
|
7
|
-
uniform bool u_is_text;
|
|
8
|
-
|
|
9
|
-
varying vec2 v_data0;
|
|
10
|
-
varying vec3 v_data1;
|
|
11
|
-
|
|
12
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
13
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
14
|
-
#pragma mapbox: define lowp float opacity
|
|
15
|
-
#pragma mapbox: define lowp float halo_width
|
|
16
|
-
#pragma mapbox: define lowp float halo_blur
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
20
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
21
|
-
#pragma mapbox: initialize lowp float opacity
|
|
22
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
23
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
24
|
-
|
|
25
|
-
float EDGE_GAMMA = 0.105 / u_device_pixel_ratio;
|
|
26
|
-
|
|
27
|
-
vec2 tex = v_data0.xy;
|
|
28
|
-
float gamma_scale = v_data1.x;
|
|
29
|
-
float size = v_data1.y;
|
|
30
|
-
float fade_opacity = v_data1[2];
|
|
31
|
-
|
|
32
|
-
float fontScale = u_is_text ? size / 24.0 : size;
|
|
33
|
-
|
|
34
|
-
lowp vec4 color = fill_color;
|
|
35
|
-
highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);
|
|
36
|
-
lowp float buff = (256.0 - 64.0) / 256.0;
|
|
37
|
-
if (u_is_halo) {
|
|
38
|
-
color = halo_color;
|
|
39
|
-
gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);
|
|
40
|
-
buff = (6.0 - halo_width / fontScale) / SDF_PX;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
lowp float dist = texture2D(u_texture, tex).a;
|
|
44
|
-
highp float gamma_scaled = gamma * gamma_scale;
|
|
45
|
-
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
|
46
|
-
|
|
47
|
-
gl_FragColor = color * (alpha * opacity * fade_opacity);
|
|
48
|
-
|
|
49
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
50
|
-
gl_FragColor = vec4(1.0);
|
|
51
|
-
#endif
|
|
52
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
const float PI = 3.141592653589793;
|
|
2
|
-
|
|
3
|
-
attribute vec4 a_pos_offset;
|
|
4
|
-
attribute vec4 a_data;
|
|
5
|
-
attribute vec4 a_pixeloffset;
|
|
6
|
-
attribute vec3 a_projected_pos;
|
|
7
|
-
attribute float a_fade_opacity;
|
|
8
|
-
|
|
9
|
-
// contents of a_size vary based on the type of property value
|
|
10
|
-
// used for {text,icon}-size.
|
|
11
|
-
// For constants, a_size is disabled.
|
|
12
|
-
// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.
|
|
13
|
-
// For composite functions:
|
|
14
|
-
// [ text-size(lowerZoomStop, feature),
|
|
15
|
-
// text-size(upperZoomStop, feature) ]
|
|
16
|
-
uniform bool u_is_size_zoom_constant;
|
|
17
|
-
uniform bool u_is_size_feature_constant;
|
|
18
|
-
uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
|
19
|
-
uniform highp float u_size; // used when size is both zoom and feature constant
|
|
20
|
-
uniform mat4 u_matrix;
|
|
21
|
-
uniform mat4 u_label_plane_matrix;
|
|
22
|
-
uniform mat4 u_coord_matrix;
|
|
23
|
-
uniform bool u_is_text;
|
|
24
|
-
uniform bool u_pitch_with_map;
|
|
25
|
-
uniform highp float u_pitch;
|
|
26
|
-
uniform bool u_rotate_symbol;
|
|
27
|
-
uniform highp float u_aspect_ratio;
|
|
28
|
-
uniform highp float u_camera_to_center_distance;
|
|
29
|
-
uniform float u_fade_change;
|
|
30
|
-
uniform vec2 u_texsize;
|
|
31
|
-
|
|
32
|
-
varying vec2 v_data0;
|
|
33
|
-
varying vec3 v_data1;
|
|
34
|
-
|
|
35
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
36
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
37
|
-
#pragma mapbox: define lowp float opacity
|
|
38
|
-
#pragma mapbox: define lowp float halo_width
|
|
39
|
-
#pragma mapbox: define lowp float halo_blur
|
|
40
|
-
|
|
41
|
-
void main() {
|
|
42
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
43
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
44
|
-
#pragma mapbox: initialize lowp float opacity
|
|
45
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
46
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
47
|
-
|
|
48
|
-
vec2 a_pos = a_pos_offset.xy;
|
|
49
|
-
vec2 a_offset = a_pos_offset.zw;
|
|
50
|
-
|
|
51
|
-
vec2 a_tex = a_data.xy;
|
|
52
|
-
vec2 a_size = a_data.zw;
|
|
53
|
-
|
|
54
|
-
float a_size_min = floor(a_size[0] * 0.5);
|
|
55
|
-
vec2 a_pxoffset = a_pixeloffset.xy;
|
|
56
|
-
|
|
57
|
-
highp float segment_angle = -a_projected_pos[2];
|
|
58
|
-
float size;
|
|
59
|
-
|
|
60
|
-
if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
61
|
-
size = mix(a_size_min, a_size[1], u_size_t) / 128.0;
|
|
62
|
-
} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
63
|
-
size = a_size_min / 128.0;
|
|
64
|
-
} else {
|
|
65
|
-
size = u_size;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);
|
|
69
|
-
highp float camera_to_anchor_distance = projectedPoint.w;
|
|
70
|
-
// If the label is pitched with the map, layout is done in pitched space,
|
|
71
|
-
// which makes labels in the distance smaller relative to viewport space.
|
|
72
|
-
// We counteract part of that effect by multiplying by the perspective ratio.
|
|
73
|
-
// If the label isn't pitched with the map, we do layout in viewport space,
|
|
74
|
-
// which makes labels in the distance larger relative to the features around
|
|
75
|
-
// them. We counteract part of that effect by dividing by the perspective ratio.
|
|
76
|
-
highp float distance_ratio = u_pitch_with_map ?
|
|
77
|
-
camera_to_anchor_distance / u_camera_to_center_distance :
|
|
78
|
-
u_camera_to_center_distance / camera_to_anchor_distance;
|
|
79
|
-
highp float perspective_ratio = clamp(
|
|
80
|
-
0.5 + 0.5 * distance_ratio,
|
|
81
|
-
0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles
|
|
82
|
-
4.0);
|
|
83
|
-
|
|
84
|
-
size *= perspective_ratio;
|
|
85
|
-
|
|
86
|
-
float fontScale = u_is_text ? size / 24.0 : size;
|
|
87
|
-
|
|
88
|
-
highp float symbol_rotation = 0.0;
|
|
89
|
-
if (u_rotate_symbol) {
|
|
90
|
-
// Point labels with 'rotation-alignment: map' are horizontal with respect to tile units
|
|
91
|
-
// To figure out that angle in projected space, we draw a short horizontal line in tile
|
|
92
|
-
// space, project it, and measure its angle in projected space.
|
|
93
|
-
vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);
|
|
94
|
-
|
|
95
|
-
vec2 a = projectedPoint.xy / projectedPoint.w;
|
|
96
|
-
vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;
|
|
97
|
-
|
|
98
|
-
symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
highp float angle_sin = sin(segment_angle + symbol_rotation);
|
|
102
|
-
highp float angle_cos = cos(segment_angle + symbol_rotation);
|
|
103
|
-
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
104
|
-
|
|
105
|
-
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
|
|
106
|
-
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale + a_pxoffset), 0.0, 1.0);
|
|
107
|
-
float gamma_scale = gl_Position.w;
|
|
108
|
-
|
|
109
|
-
vec2 fade_opacity = unpack_opacity(a_fade_opacity);
|
|
110
|
-
float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
|
|
111
|
-
float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));
|
|
112
|
-
|
|
113
|
-
v_data0 = a_tex / u_texsize;
|
|
114
|
-
v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);
|
|
115
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#define SDF_PX 8.0
|
|
2
|
-
|
|
3
|
-
#define SDF 1.0
|
|
4
|
-
#define ICON 0.0
|
|
5
|
-
|
|
6
|
-
uniform bool u_is_halo;
|
|
7
|
-
uniform sampler2D u_texture;
|
|
8
|
-
uniform sampler2D u_texture_icon;
|
|
9
|
-
uniform highp float u_gamma_scale;
|
|
10
|
-
uniform lowp float u_device_pixel_ratio;
|
|
11
|
-
|
|
12
|
-
varying vec4 v_data0;
|
|
13
|
-
varying vec4 v_data1;
|
|
14
|
-
|
|
15
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
16
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
17
|
-
#pragma mapbox: define lowp float opacity
|
|
18
|
-
#pragma mapbox: define lowp float halo_width
|
|
19
|
-
#pragma mapbox: define lowp float halo_blur
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
23
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
24
|
-
#pragma mapbox: initialize lowp float opacity
|
|
25
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
26
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
27
|
-
|
|
28
|
-
float fade_opacity = v_data1[2];
|
|
29
|
-
|
|
30
|
-
if (v_data1.w == ICON) {
|
|
31
|
-
vec2 tex_icon = v_data0.zw;
|
|
32
|
-
lowp float alpha = opacity * fade_opacity;
|
|
33
|
-
gl_FragColor = texture2D(u_texture_icon, tex_icon) * alpha;
|
|
34
|
-
|
|
35
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
36
|
-
gl_FragColor = vec4(1.0);
|
|
37
|
-
#endif
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
vec2 tex = v_data0.xy;
|
|
42
|
-
|
|
43
|
-
float EDGE_GAMMA = 0.105 / u_device_pixel_ratio;
|
|
44
|
-
|
|
45
|
-
float gamma_scale = v_data1.x;
|
|
46
|
-
float size = v_data1.y;
|
|
47
|
-
|
|
48
|
-
float fontScale = size / 24.0;
|
|
49
|
-
|
|
50
|
-
lowp vec4 color = fill_color;
|
|
51
|
-
highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);
|
|
52
|
-
lowp float buff = (256.0 - 64.0) / 256.0;
|
|
53
|
-
if (u_is_halo) {
|
|
54
|
-
color = halo_color;
|
|
55
|
-
gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);
|
|
56
|
-
buff = (6.0 - halo_width / fontScale) / SDF_PX;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
lowp float dist = texture2D(u_texture, tex).a;
|
|
60
|
-
highp float gamma_scaled = gamma * gamma_scale;
|
|
61
|
-
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
|
62
|
-
|
|
63
|
-
gl_FragColor = color * (alpha * opacity * fade_opacity);
|
|
64
|
-
|
|
65
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
66
|
-
gl_FragColor = vec4(1.0);
|
|
67
|
-
#endif
|
|
68
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
const float PI = 3.141592653589793;
|
|
2
|
-
|
|
3
|
-
attribute vec4 a_pos_offset;
|
|
4
|
-
attribute vec4 a_data;
|
|
5
|
-
attribute vec3 a_projected_pos;
|
|
6
|
-
attribute float a_fade_opacity;
|
|
7
|
-
|
|
8
|
-
// contents of a_size vary based on the type of property value
|
|
9
|
-
// used for {text,icon}-size.
|
|
10
|
-
// For constants, a_size is disabled.
|
|
11
|
-
// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.
|
|
12
|
-
// For composite functions:
|
|
13
|
-
// [ text-size(lowerZoomStop, feature),
|
|
14
|
-
// text-size(upperZoomStop, feature) ]
|
|
15
|
-
uniform bool u_is_size_zoom_constant;
|
|
16
|
-
uniform bool u_is_size_feature_constant;
|
|
17
|
-
uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
|
18
|
-
uniform highp float u_size; // used when size is both zoom and feature constant
|
|
19
|
-
uniform mat4 u_matrix;
|
|
20
|
-
uniform mat4 u_label_plane_matrix;
|
|
21
|
-
uniform mat4 u_coord_matrix;
|
|
22
|
-
uniform bool u_is_text;
|
|
23
|
-
uniform bool u_pitch_with_map;
|
|
24
|
-
uniform highp float u_pitch;
|
|
25
|
-
uniform bool u_rotate_symbol;
|
|
26
|
-
uniform highp float u_aspect_ratio;
|
|
27
|
-
uniform highp float u_camera_to_center_distance;
|
|
28
|
-
uniform float u_fade_change;
|
|
29
|
-
uniform vec2 u_texsize;
|
|
30
|
-
uniform vec2 u_texsize_icon;
|
|
31
|
-
|
|
32
|
-
varying vec4 v_data0;
|
|
33
|
-
varying vec4 v_data1;
|
|
34
|
-
|
|
35
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
36
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
37
|
-
#pragma mapbox: define lowp float opacity
|
|
38
|
-
#pragma mapbox: define lowp float halo_width
|
|
39
|
-
#pragma mapbox: define lowp float halo_blur
|
|
40
|
-
|
|
41
|
-
void main() {
|
|
42
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
43
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
44
|
-
#pragma mapbox: initialize lowp float opacity
|
|
45
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
46
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
47
|
-
|
|
48
|
-
vec2 a_pos = a_pos_offset.xy;
|
|
49
|
-
vec2 a_offset = a_pos_offset.zw;
|
|
50
|
-
|
|
51
|
-
vec2 a_tex = a_data.xy;
|
|
52
|
-
vec2 a_size = a_data.zw;
|
|
53
|
-
|
|
54
|
-
float a_size_min = floor(a_size[0] * 0.5);
|
|
55
|
-
float is_sdf = a_size[0] - 2.0 * a_size_min;
|
|
56
|
-
|
|
57
|
-
highp float segment_angle = -a_projected_pos[2];
|
|
58
|
-
float size;
|
|
59
|
-
|
|
60
|
-
if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
61
|
-
size = mix(a_size_min, a_size[1], u_size_t) / 128.0;
|
|
62
|
-
} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {
|
|
63
|
-
size = a_size_min / 128.0;
|
|
64
|
-
} else {
|
|
65
|
-
size = u_size;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);
|
|
69
|
-
highp float camera_to_anchor_distance = projectedPoint.w;
|
|
70
|
-
// If the label is pitched with the map, layout is done in pitched space,
|
|
71
|
-
// which makes labels in the distance smaller relative to viewport space.
|
|
72
|
-
// We counteract part of that effect by multiplying by the perspective ratio.
|
|
73
|
-
// If the label isn't pitched with the map, we do layout in viewport space,
|
|
74
|
-
// which makes labels in the distance larger relative to the features around
|
|
75
|
-
// them. We counteract part of that effect by dividing by the perspective ratio.
|
|
76
|
-
highp float distance_ratio = u_pitch_with_map ?
|
|
77
|
-
camera_to_anchor_distance / u_camera_to_center_distance :
|
|
78
|
-
u_camera_to_center_distance / camera_to_anchor_distance;
|
|
79
|
-
highp float perspective_ratio = clamp(
|
|
80
|
-
0.5 + 0.5 * distance_ratio,
|
|
81
|
-
0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles
|
|
82
|
-
4.0);
|
|
83
|
-
|
|
84
|
-
size *= perspective_ratio;
|
|
85
|
-
|
|
86
|
-
float fontScale = size / 24.0;
|
|
87
|
-
|
|
88
|
-
highp float symbol_rotation = 0.0;
|
|
89
|
-
if (u_rotate_symbol) {
|
|
90
|
-
// Point labels with 'rotation-alignment: map' are horizontal with respect to tile units
|
|
91
|
-
// To figure out that angle in projected space, we draw a short horizontal line in tile
|
|
92
|
-
// space, project it, and measure its angle in projected space.
|
|
93
|
-
vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);
|
|
94
|
-
|
|
95
|
-
vec2 a = projectedPoint.xy / projectedPoint.w;
|
|
96
|
-
vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;
|
|
97
|
-
|
|
98
|
-
symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
highp float angle_sin = sin(segment_angle + symbol_rotation);
|
|
102
|
-
highp float angle_cos = cos(segment_angle + symbol_rotation);
|
|
103
|
-
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
104
|
-
|
|
105
|
-
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
|
|
106
|
-
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);
|
|
107
|
-
float gamma_scale = gl_Position.w;
|
|
108
|
-
|
|
109
|
-
vec2 fade_opacity = unpack_opacity(a_fade_opacity);
|
|
110
|
-
float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
|
|
111
|
-
float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));
|
|
112
|
-
|
|
113
|
-
v_data0.xy = a_tex / u_texsize;
|
|
114
|
-
v_data0.zw = a_tex / u_texsize_icon;
|
|
115
|
-
v_data1 = vec4(gamma_scale, size, interpolated_fade_opacity, is_sdf);
|
|
116
|
-
}
|