@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/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// This file is intended for use in the GL-JS test suite
|
|
2
|
-
// It provides the shaders entry point for Node (tests and GL Native)
|
|
3
|
-
// In a browser environment, this file is replaced with ./src/shaders/shaders.js
|
|
4
|
-
// when Rollup builds the main bundle.
|
|
5
|
-
// See https://github.com/mapbox/mapbox-gl-js/blob/master/package.json#L104-L108
|
|
6
|
-
|
|
7
|
-
/* eslint-disable import/unambiguous, import/no-commonjs, flowtype/require-valid-file-annotation, no-global-assign */
|
|
8
|
-
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
|
|
11
|
-
// enable ES Modules in Node
|
|
12
|
-
require = require("esm")(module);
|
|
13
|
-
|
|
14
|
-
// enable requiring GLSL in Node
|
|
15
|
-
require.extensions['.glsl'] = function (module, filename) {
|
|
16
|
-
const content = fs.readFileSync(filename, 'utf8');
|
|
17
|
-
module._compile(`module.exports = \`${content}\``, filename);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = require("./shaders.js");
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
uniform lowp float u_device_pixel_ratio;
|
|
2
|
-
|
|
3
|
-
varying vec2 v_width2;
|
|
4
|
-
varying vec2 v_normal;
|
|
5
|
-
varying float v_gamma_scale;
|
|
6
|
-
|
|
7
|
-
#pragma mapbox: define highp vec4 color
|
|
8
|
-
#pragma mapbox: define lowp float blur
|
|
9
|
-
#pragma mapbox: define lowp float opacity
|
|
10
|
-
|
|
11
|
-
void main() {
|
|
12
|
-
#pragma mapbox: initialize highp vec4 color
|
|
13
|
-
#pragma mapbox: initialize lowp float blur
|
|
14
|
-
#pragma mapbox: initialize lowp float opacity
|
|
15
|
-
|
|
16
|
-
// Calculate the distance of the pixel from the line in pixels.
|
|
17
|
-
float dist = length(v_normal) * v_width2.s;
|
|
18
|
-
|
|
19
|
-
// Calculate the antialiasing fade factor. This is either when fading in
|
|
20
|
-
// the line in case of an offset line (v_width2.t) or when fading out
|
|
21
|
-
// (v_width2.s)
|
|
22
|
-
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
|
|
23
|
-
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
|
|
24
|
-
|
|
25
|
-
gl_FragColor = color * (alpha * opacity);
|
|
26
|
-
|
|
27
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
28
|
-
gl_FragColor = vec4(1.0);
|
|
29
|
-
#endif
|
|
30
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// floor(127 / 2) == 63.0
|
|
2
|
-
// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
|
|
3
|
-
// stored in a byte (-128..127). we scale regular normals up to length 63, but
|
|
4
|
-
// there are also "special" normals that have a bigger length (of up to 126 in
|
|
5
|
-
// this case).
|
|
6
|
-
// #define scale 63.0
|
|
7
|
-
#define scale 0.015873016
|
|
8
|
-
|
|
9
|
-
attribute vec2 a_pos_normal;
|
|
10
|
-
attribute vec4 a_data;
|
|
11
|
-
|
|
12
|
-
uniform mat4 u_matrix;
|
|
13
|
-
uniform mediump float u_ratio;
|
|
14
|
-
uniform vec2 u_units_to_pixels;
|
|
15
|
-
uniform lowp float u_device_pixel_ratio;
|
|
16
|
-
|
|
17
|
-
varying vec2 v_normal;
|
|
18
|
-
varying vec2 v_width2;
|
|
19
|
-
varying float v_gamma_scale;
|
|
20
|
-
varying highp float v_linesofar;
|
|
21
|
-
|
|
22
|
-
#pragma mapbox: define highp vec4 color
|
|
23
|
-
#pragma mapbox: define lowp float blur
|
|
24
|
-
#pragma mapbox: define lowp float opacity
|
|
25
|
-
#pragma mapbox: define mediump float gapwidth
|
|
26
|
-
#pragma mapbox: define lowp float offset
|
|
27
|
-
#pragma mapbox: define mediump float width
|
|
28
|
-
|
|
29
|
-
void main() {
|
|
30
|
-
#pragma mapbox: initialize highp vec4 color
|
|
31
|
-
#pragma mapbox: initialize lowp float blur
|
|
32
|
-
#pragma mapbox: initialize lowp float opacity
|
|
33
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
34
|
-
#pragma mapbox: initialize lowp float offset
|
|
35
|
-
#pragma mapbox: initialize mediump float width
|
|
36
|
-
|
|
37
|
-
// the distance over which the line edge fades out.
|
|
38
|
-
// Retina devices need a smaller distance to avoid aliasing.
|
|
39
|
-
float ANTIALIASING = 1.0 / u_device_pixel_ratio / 2.0;
|
|
40
|
-
|
|
41
|
-
vec2 a_extrude = a_data.xy - 128.0;
|
|
42
|
-
float a_direction = mod(a_data.z, 4.0) - 1.0;
|
|
43
|
-
|
|
44
|
-
v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;
|
|
45
|
-
|
|
46
|
-
vec2 pos = floor(a_pos_normal * 0.5);
|
|
47
|
-
|
|
48
|
-
// x is 1 if it's a round cap, 0 otherwise
|
|
49
|
-
// y is 1 if the normal points up, and -1 if it points down
|
|
50
|
-
// We store these in the least significant bit of a_pos_normal
|
|
51
|
-
mediump vec2 normal = a_pos_normal - 2.0 * pos;
|
|
52
|
-
normal.y = normal.y * 2.0 - 1.0;
|
|
53
|
-
v_normal = normal;
|
|
54
|
-
|
|
55
|
-
// these transformations used to be applied in the JS and native code bases.
|
|
56
|
-
// moved them into the shader for clarity and simplicity.
|
|
57
|
-
gapwidth = gapwidth / 2.0;
|
|
58
|
-
float halfwidth = width / 2.0;
|
|
59
|
-
offset = -1.0 * offset;
|
|
60
|
-
|
|
61
|
-
float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
|
62
|
-
float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
|
63
|
-
|
|
64
|
-
// Scale the extrusion vector down to a normal and then up by the line width
|
|
65
|
-
// of this vertex.
|
|
66
|
-
mediump vec2 dist = outset * a_extrude * scale;
|
|
67
|
-
|
|
68
|
-
// Calculate the offset when drawing a line that is to the side of the actual line.
|
|
69
|
-
// We do this by creating a vector that points towards the extrude, but rotate
|
|
70
|
-
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
|
71
|
-
// extrude vector points in another direction.
|
|
72
|
-
mediump float u = 0.5 * a_direction;
|
|
73
|
-
mediump float t = 1.0 - abs(u);
|
|
74
|
-
mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
|
|
75
|
-
|
|
76
|
-
vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
|
|
77
|
-
gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
|
|
78
|
-
|
|
79
|
-
// calculate how much the perspective view squishes or stretches the extrude
|
|
80
|
-
float extrude_length_without_perspective = length(dist);
|
|
81
|
-
float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_units_to_pixels);
|
|
82
|
-
v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
|
|
83
|
-
|
|
84
|
-
v_width2 = vec2(outset, inset);
|
|
85
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
uniform lowp float u_device_pixel_ratio;
|
|
2
|
-
uniform sampler2D u_image;
|
|
3
|
-
|
|
4
|
-
varying vec2 v_width2;
|
|
5
|
-
varying vec2 v_normal;
|
|
6
|
-
varying float v_gamma_scale;
|
|
7
|
-
varying highp float v_lineprogress;
|
|
8
|
-
|
|
9
|
-
#pragma mapbox: define lowp float blur
|
|
10
|
-
#pragma mapbox: define lowp float opacity
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
#pragma mapbox: initialize lowp float blur
|
|
14
|
-
#pragma mapbox: initialize lowp float opacity
|
|
15
|
-
|
|
16
|
-
// Calculate the distance of the pixel from the line in pixels.
|
|
17
|
-
float dist = length(v_normal) * v_width2.s;
|
|
18
|
-
|
|
19
|
-
// Calculate the antialiasing fade factor. This is either when fading in
|
|
20
|
-
// the line in case of an offset line (v_width2.t) or when fading out
|
|
21
|
-
// (v_width2.s)
|
|
22
|
-
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
|
|
23
|
-
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
|
|
24
|
-
|
|
25
|
-
// For gradient lines, v_lineprogress is the ratio along the entire line,
|
|
26
|
-
// scaled to [0, 2^15), and the gradient ramp is stored in a texture.
|
|
27
|
-
vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));
|
|
28
|
-
|
|
29
|
-
gl_FragColor = color * (alpha * opacity);
|
|
30
|
-
|
|
31
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
32
|
-
gl_FragColor = vec4(1.0);
|
|
33
|
-
#endif
|
|
34
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// the attribute conveying progress along a line is scaled to [0, 2^15)
|
|
3
|
-
#define MAX_LINE_DISTANCE 32767.0
|
|
4
|
-
|
|
5
|
-
// floor(127 / 2) == 63.0
|
|
6
|
-
// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
|
|
7
|
-
// stored in a byte (-128..127). we scale regular normals up to length 63, but
|
|
8
|
-
// there are also "special" normals that have a bigger length (of up to 126 in
|
|
9
|
-
// this case).
|
|
10
|
-
// #define scale 63.0
|
|
11
|
-
#define scale 0.015873016
|
|
12
|
-
|
|
13
|
-
attribute vec2 a_pos_normal;
|
|
14
|
-
attribute vec4 a_data;
|
|
15
|
-
|
|
16
|
-
uniform mat4 u_matrix;
|
|
17
|
-
uniform mediump float u_ratio;
|
|
18
|
-
uniform lowp float u_device_pixel_ratio;
|
|
19
|
-
uniform vec2 u_units_to_pixels;
|
|
20
|
-
|
|
21
|
-
varying vec2 v_normal;
|
|
22
|
-
varying vec2 v_width2;
|
|
23
|
-
varying float v_gamma_scale;
|
|
24
|
-
varying highp float v_lineprogress;
|
|
25
|
-
|
|
26
|
-
#pragma mapbox: define lowp float blur
|
|
27
|
-
#pragma mapbox: define lowp float opacity
|
|
28
|
-
#pragma mapbox: define mediump float gapwidth
|
|
29
|
-
#pragma mapbox: define lowp float offset
|
|
30
|
-
#pragma mapbox: define mediump float width
|
|
31
|
-
|
|
32
|
-
void main() {
|
|
33
|
-
#pragma mapbox: initialize lowp float blur
|
|
34
|
-
#pragma mapbox: initialize lowp float opacity
|
|
35
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
36
|
-
#pragma mapbox: initialize lowp float offset
|
|
37
|
-
#pragma mapbox: initialize mediump float width
|
|
38
|
-
|
|
39
|
-
// the distance over which the line edge fades out.
|
|
40
|
-
// Retina devices need a smaller distance to avoid aliasing.
|
|
41
|
-
float ANTIALIASING = 1.0 / u_device_pixel_ratio / 2.0;
|
|
42
|
-
|
|
43
|
-
vec2 a_extrude = a_data.xy - 128.0;
|
|
44
|
-
float a_direction = mod(a_data.z, 4.0) - 1.0;
|
|
45
|
-
|
|
46
|
-
v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;
|
|
47
|
-
|
|
48
|
-
vec2 pos = floor(a_pos_normal * 0.5);
|
|
49
|
-
|
|
50
|
-
// x is 1 if it's a round cap, 0 otherwise
|
|
51
|
-
// y is 1 if the normal points up, and -1 if it points down
|
|
52
|
-
// We store these in the least significant bit of a_pos_normal
|
|
53
|
-
mediump vec2 normal = a_pos_normal - 2.0 * pos;
|
|
54
|
-
normal.y = normal.y * 2.0 - 1.0;
|
|
55
|
-
v_normal = normal;
|
|
56
|
-
|
|
57
|
-
// these transformations used to be applied in the JS and native code bases.
|
|
58
|
-
// moved them into the shader for clarity and simplicity.
|
|
59
|
-
gapwidth = gapwidth / 2.0;
|
|
60
|
-
float halfwidth = width / 2.0;
|
|
61
|
-
offset = -1.0 * offset;
|
|
62
|
-
|
|
63
|
-
float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
|
64
|
-
float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
|
65
|
-
|
|
66
|
-
// Scale the extrusion vector down to a normal and then up by the line width
|
|
67
|
-
// of this vertex.
|
|
68
|
-
mediump vec2 dist = outset * a_extrude * scale;
|
|
69
|
-
|
|
70
|
-
// Calculate the offset when drawing a line that is to the side of the actual line.
|
|
71
|
-
// We do this by creating a vector that points towards the extrude, but rotate
|
|
72
|
-
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
|
73
|
-
// extrude vector points in another direction.
|
|
74
|
-
mediump float u = 0.5 * a_direction;
|
|
75
|
-
mediump float t = 1.0 - abs(u);
|
|
76
|
-
mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
|
|
77
|
-
|
|
78
|
-
vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
|
|
79
|
-
gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
|
|
80
|
-
|
|
81
|
-
// calculate how much the perspective view squishes or stretches the extrude
|
|
82
|
-
float extrude_length_without_perspective = length(dist);
|
|
83
|
-
float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_units_to_pixels);
|
|
84
|
-
v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
|
|
85
|
-
|
|
86
|
-
v_width2 = vec2(outset, inset);
|
|
87
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
uniform lowp float u_device_pixel_ratio;
|
|
2
|
-
uniform vec2 u_texsize;
|
|
3
|
-
uniform float u_fade;
|
|
4
|
-
uniform mediump vec3 u_scale;
|
|
5
|
-
|
|
6
|
-
uniform sampler2D u_image;
|
|
7
|
-
|
|
8
|
-
varying vec2 v_normal;
|
|
9
|
-
varying vec2 v_width2;
|
|
10
|
-
varying float v_linesofar;
|
|
11
|
-
varying float v_gamma_scale;
|
|
12
|
-
varying float v_width;
|
|
13
|
-
|
|
14
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
15
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
16
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
17
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
18
|
-
#pragma mapbox: define lowp float blur
|
|
19
|
-
#pragma mapbox: define lowp float opacity
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
23
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
24
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
25
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
26
|
-
|
|
27
|
-
#pragma mapbox: initialize lowp float blur
|
|
28
|
-
#pragma mapbox: initialize lowp float opacity
|
|
29
|
-
|
|
30
|
-
vec2 pattern_tl_a = pattern_from.xy;
|
|
31
|
-
vec2 pattern_br_a = pattern_from.zw;
|
|
32
|
-
vec2 pattern_tl_b = pattern_to.xy;
|
|
33
|
-
vec2 pattern_br_b = pattern_to.zw;
|
|
34
|
-
|
|
35
|
-
float tileZoomRatio = u_scale.x;
|
|
36
|
-
float fromScale = u_scale.y;
|
|
37
|
-
float toScale = u_scale.z;
|
|
38
|
-
|
|
39
|
-
vec2 display_size_a = (pattern_br_a - pattern_tl_a) / pixel_ratio_from;
|
|
40
|
-
vec2 display_size_b = (pattern_br_b - pattern_tl_b) / pixel_ratio_to;
|
|
41
|
-
|
|
42
|
-
vec2 pattern_size_a = vec2(display_size_a.x * fromScale / tileZoomRatio, display_size_a.y);
|
|
43
|
-
vec2 pattern_size_b = vec2(display_size_b.x * toScale / tileZoomRatio, display_size_b.y);
|
|
44
|
-
|
|
45
|
-
float aspect_a = display_size_a.y / v_width;
|
|
46
|
-
float aspect_b = display_size_b.y / v_width;
|
|
47
|
-
|
|
48
|
-
// Calculate the distance of the pixel from the line in pixels.
|
|
49
|
-
float dist = length(v_normal) * v_width2.s;
|
|
50
|
-
|
|
51
|
-
// Calculate the antialiasing fade factor. This is either when fading in
|
|
52
|
-
// the line in case of an offset line (v_width2.t) or when fading out
|
|
53
|
-
// (v_width2.s)
|
|
54
|
-
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
|
|
55
|
-
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
|
|
56
|
-
|
|
57
|
-
float x_a = mod(v_linesofar / pattern_size_a.x * aspect_a, 1.0);
|
|
58
|
-
float x_b = mod(v_linesofar / pattern_size_b.x * aspect_b, 1.0);
|
|
59
|
-
|
|
60
|
-
float y = 0.5 * v_normal.y + 0.5;
|
|
61
|
-
|
|
62
|
-
vec2 texel_size = 1.0 / u_texsize;
|
|
63
|
-
|
|
64
|
-
vec2 pos_a = mix(pattern_tl_a * texel_size - texel_size, pattern_br_a * texel_size + texel_size, vec2(x_a, y));
|
|
65
|
-
vec2 pos_b = mix(pattern_tl_b * texel_size - texel_size, pattern_br_b * texel_size + texel_size, vec2(x_b, y));
|
|
66
|
-
|
|
67
|
-
vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);
|
|
68
|
-
|
|
69
|
-
gl_FragColor = color * alpha * opacity;
|
|
70
|
-
|
|
71
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
72
|
-
gl_FragColor = vec4(1.0);
|
|
73
|
-
#endif
|
|
74
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// floor(127 / 2) == 63.0
|
|
2
|
-
// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
|
|
3
|
-
// stored in a byte (-128..127). we scale regular normals up to length 63, but
|
|
4
|
-
// there are also "special" normals that have a bigger length (of up to 126 in
|
|
5
|
-
// this case).
|
|
6
|
-
// #define scale 63.0
|
|
7
|
-
#define scale 0.015873016
|
|
8
|
-
|
|
9
|
-
// We scale the distance before adding it to the buffers so that we can store
|
|
10
|
-
// long distances for long segments. Use this value to unscale the distance.
|
|
11
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
12
|
-
|
|
13
|
-
attribute vec2 a_pos_normal;
|
|
14
|
-
attribute vec4 a_data;
|
|
15
|
-
|
|
16
|
-
uniform mat4 u_matrix;
|
|
17
|
-
uniform vec2 u_units_to_pixels;
|
|
18
|
-
uniform mediump float u_ratio;
|
|
19
|
-
uniform lowp float u_device_pixel_ratio;
|
|
20
|
-
|
|
21
|
-
varying vec2 v_normal;
|
|
22
|
-
varying vec2 v_width2;
|
|
23
|
-
varying float v_linesofar;
|
|
24
|
-
varying float v_gamma_scale;
|
|
25
|
-
varying float v_width;
|
|
26
|
-
|
|
27
|
-
#pragma mapbox: define lowp float blur
|
|
28
|
-
#pragma mapbox: define lowp float opacity
|
|
29
|
-
#pragma mapbox: define lowp float offset
|
|
30
|
-
#pragma mapbox: define mediump float gapwidth
|
|
31
|
-
#pragma mapbox: define mediump float width
|
|
32
|
-
#pragma mapbox: define lowp float floorwidth
|
|
33
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
34
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
35
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
36
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
#pragma mapbox: initialize lowp float blur
|
|
40
|
-
#pragma mapbox: initialize lowp float opacity
|
|
41
|
-
#pragma mapbox: initialize lowp float offset
|
|
42
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
43
|
-
#pragma mapbox: initialize mediump float width
|
|
44
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
45
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
46
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
47
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
48
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
49
|
-
|
|
50
|
-
// the distance over which the line edge fades out.
|
|
51
|
-
// Retina devices need a smaller distance to avoid aliasing.
|
|
52
|
-
float ANTIALIASING = 1.0 / u_device_pixel_ratio / 2.0;
|
|
53
|
-
|
|
54
|
-
vec2 a_extrude = a_data.xy - 128.0;
|
|
55
|
-
float a_direction = mod(a_data.z, 4.0) - 1.0;
|
|
56
|
-
float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;
|
|
57
|
-
// float tileRatio = u_scale.x;
|
|
58
|
-
vec2 pos = floor(a_pos_normal * 0.5);
|
|
59
|
-
|
|
60
|
-
// x is 1 if it's a round cap, 0 otherwise
|
|
61
|
-
// y is 1 if the normal points up, and -1 if it points down
|
|
62
|
-
// We store these in the least significant bit of a_pos_normal
|
|
63
|
-
mediump vec2 normal = a_pos_normal - 2.0 * pos;
|
|
64
|
-
normal.y = normal.y * 2.0 - 1.0;
|
|
65
|
-
v_normal = normal;
|
|
66
|
-
|
|
67
|
-
// these transformations used to be applied in the JS and native code bases.
|
|
68
|
-
// moved them into the shader for clarity and simplicity.
|
|
69
|
-
gapwidth = gapwidth / 2.0;
|
|
70
|
-
float halfwidth = width / 2.0;
|
|
71
|
-
offset = -1.0 * offset;
|
|
72
|
-
|
|
73
|
-
float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
|
74
|
-
float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
|
75
|
-
|
|
76
|
-
// Scale the extrusion vector down to a normal and then up by the line width
|
|
77
|
-
// of this vertex.
|
|
78
|
-
mediump vec2 dist = outset * a_extrude * scale;
|
|
79
|
-
|
|
80
|
-
// Calculate the offset when drawing a line that is to the side of the actual line.
|
|
81
|
-
// We do this by creating a vector that points towards the extrude, but rotate
|
|
82
|
-
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
|
83
|
-
// extrude vector points in another direction.
|
|
84
|
-
mediump float u = 0.5 * a_direction;
|
|
85
|
-
mediump float t = 1.0 - abs(u);
|
|
86
|
-
mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
|
|
87
|
-
|
|
88
|
-
vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
|
|
89
|
-
gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
|
|
90
|
-
|
|
91
|
-
// calculate how much the perspective view squishes or stretches the extrude
|
|
92
|
-
float extrude_length_without_perspective = length(dist);
|
|
93
|
-
float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_units_to_pixels);
|
|
94
|
-
v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
|
|
95
|
-
|
|
96
|
-
v_linesofar = a_linesofar;
|
|
97
|
-
v_width2 = vec2(outset, inset);
|
|
98
|
-
v_width = floorwidth;
|
|
99
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
uniform lowp float u_device_pixel_ratio;
|
|
3
|
-
uniform sampler2D u_image;
|
|
4
|
-
uniform float u_sdfgamma;
|
|
5
|
-
uniform float u_mix;
|
|
6
|
-
|
|
7
|
-
varying vec2 v_normal;
|
|
8
|
-
varying vec2 v_width2;
|
|
9
|
-
varying vec2 v_tex_a;
|
|
10
|
-
varying vec2 v_tex_b;
|
|
11
|
-
varying float v_gamma_scale;
|
|
12
|
-
|
|
13
|
-
#pragma mapbox: define highp vec4 color
|
|
14
|
-
#pragma mapbox: define lowp float blur
|
|
15
|
-
#pragma mapbox: define lowp float opacity
|
|
16
|
-
#pragma mapbox: define mediump float width
|
|
17
|
-
#pragma mapbox: define lowp float floorwidth
|
|
18
|
-
|
|
19
|
-
void main() {
|
|
20
|
-
#pragma mapbox: initialize highp vec4 color
|
|
21
|
-
#pragma mapbox: initialize lowp float blur
|
|
22
|
-
#pragma mapbox: initialize lowp float opacity
|
|
23
|
-
#pragma mapbox: initialize mediump float width
|
|
24
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
25
|
-
|
|
26
|
-
// Calculate the distance of the pixel from the line in pixels.
|
|
27
|
-
float dist = length(v_normal) * v_width2.s;
|
|
28
|
-
|
|
29
|
-
// Calculate the antialiasing fade factor. This is either when fading in
|
|
30
|
-
// the line in case of an offset line (v_width2.t) or when fading out
|
|
31
|
-
// (v_width2.s)
|
|
32
|
-
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
|
|
33
|
-
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
|
|
34
|
-
|
|
35
|
-
float sdfdist_a = texture2D(u_image, v_tex_a).a;
|
|
36
|
-
float sdfdist_b = texture2D(u_image, v_tex_b).a;
|
|
37
|
-
float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);
|
|
38
|
-
alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);
|
|
39
|
-
|
|
40
|
-
gl_FragColor = color * (alpha * opacity);
|
|
41
|
-
|
|
42
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
43
|
-
gl_FragColor = vec4(1.0);
|
|
44
|
-
#endif
|
|
45
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// floor(127 / 2) == 63.0
|
|
2
|
-
// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
|
|
3
|
-
// stored in a byte (-128..127). we scale regular normals up to length 63, but
|
|
4
|
-
// there are also "special" normals that have a bigger length (of up to 126 in
|
|
5
|
-
// this case).
|
|
6
|
-
// #define scale 63.0
|
|
7
|
-
#define scale 0.015873016
|
|
8
|
-
|
|
9
|
-
// We scale the distance before adding it to the buffers so that we can store
|
|
10
|
-
// long distances for long segments. Use this value to unscale the distance.
|
|
11
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
12
|
-
|
|
13
|
-
attribute vec2 a_pos_normal;
|
|
14
|
-
attribute vec4 a_data;
|
|
15
|
-
|
|
16
|
-
uniform mat4 u_matrix;
|
|
17
|
-
uniform mediump float u_ratio;
|
|
18
|
-
uniform lowp float u_device_pixel_ratio;
|
|
19
|
-
uniform vec2 u_patternscale_a;
|
|
20
|
-
uniform float u_tex_y_a;
|
|
21
|
-
uniform vec2 u_patternscale_b;
|
|
22
|
-
uniform float u_tex_y_b;
|
|
23
|
-
uniform vec2 u_units_to_pixels;
|
|
24
|
-
|
|
25
|
-
varying vec2 v_normal;
|
|
26
|
-
varying vec2 v_width2;
|
|
27
|
-
varying vec2 v_tex_a;
|
|
28
|
-
varying vec2 v_tex_b;
|
|
29
|
-
varying float v_gamma_scale;
|
|
30
|
-
|
|
31
|
-
#pragma mapbox: define highp vec4 color
|
|
32
|
-
#pragma mapbox: define lowp float blur
|
|
33
|
-
#pragma mapbox: define lowp float opacity
|
|
34
|
-
#pragma mapbox: define mediump float gapwidth
|
|
35
|
-
#pragma mapbox: define lowp float offset
|
|
36
|
-
#pragma mapbox: define mediump float width
|
|
37
|
-
#pragma mapbox: define lowp float floorwidth
|
|
38
|
-
|
|
39
|
-
void main() {
|
|
40
|
-
#pragma mapbox: initialize highp vec4 color
|
|
41
|
-
#pragma mapbox: initialize lowp float blur
|
|
42
|
-
#pragma mapbox: initialize lowp float opacity
|
|
43
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
44
|
-
#pragma mapbox: initialize lowp float offset
|
|
45
|
-
#pragma mapbox: initialize mediump float width
|
|
46
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
47
|
-
|
|
48
|
-
// the distance over which the line edge fades out.
|
|
49
|
-
// Retina devices need a smaller distance to avoid aliasing.
|
|
50
|
-
float ANTIALIASING = 1.0 / u_device_pixel_ratio / 2.0;
|
|
51
|
-
|
|
52
|
-
vec2 a_extrude = a_data.xy - 128.0;
|
|
53
|
-
float a_direction = mod(a_data.z, 4.0) - 1.0;
|
|
54
|
-
float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;
|
|
55
|
-
|
|
56
|
-
vec2 pos = floor(a_pos_normal * 0.5);
|
|
57
|
-
|
|
58
|
-
// x is 1 if it's a round cap, 0 otherwise
|
|
59
|
-
// y is 1 if the normal points up, and -1 if it points down
|
|
60
|
-
// We store these in the least significant bit of a_pos_normal
|
|
61
|
-
mediump vec2 normal = a_pos_normal - 2.0 * pos;
|
|
62
|
-
normal.y = normal.y * 2.0 - 1.0;
|
|
63
|
-
v_normal = normal;
|
|
64
|
-
|
|
65
|
-
// these transformations used to be applied in the JS and native code bases.
|
|
66
|
-
// moved them into the shader for clarity and simplicity.
|
|
67
|
-
gapwidth = gapwidth / 2.0;
|
|
68
|
-
float halfwidth = width / 2.0;
|
|
69
|
-
offset = -1.0 * offset;
|
|
70
|
-
|
|
71
|
-
float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
|
72
|
-
float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
|
73
|
-
|
|
74
|
-
// Scale the extrusion vector down to a normal and then up by the line width
|
|
75
|
-
// of this vertex.
|
|
76
|
-
mediump vec2 dist =outset * a_extrude * scale;
|
|
77
|
-
|
|
78
|
-
// Calculate the offset when drawing a line that is to the side of the actual line.
|
|
79
|
-
// We do this by creating a vector that points towards the extrude, but rotate
|
|
80
|
-
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
|
81
|
-
// extrude vector points in another direction.
|
|
82
|
-
mediump float u = 0.5 * a_direction;
|
|
83
|
-
mediump float t = 1.0 - abs(u);
|
|
84
|
-
mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
|
|
85
|
-
|
|
86
|
-
vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
|
|
87
|
-
gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
|
|
88
|
-
|
|
89
|
-
// calculate how much the perspective view squishes or stretches the extrude
|
|
90
|
-
float extrude_length_without_perspective = length(dist);
|
|
91
|
-
float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_units_to_pixels);
|
|
92
|
-
v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
|
|
93
|
-
|
|
94
|
-
v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);
|
|
95
|
-
v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);
|
|
96
|
-
|
|
97
|
-
v_width2 = vec2(outset, inset);
|
|
98
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
uniform float u_fade_t;
|
|
2
|
-
uniform float u_opacity;
|
|
3
|
-
uniform sampler2D u_image0;
|
|
4
|
-
uniform sampler2D u_image1;
|
|
5
|
-
varying vec2 v_pos0;
|
|
6
|
-
varying vec2 v_pos1;
|
|
7
|
-
|
|
8
|
-
uniform float u_brightness_low;
|
|
9
|
-
uniform float u_brightness_high;
|
|
10
|
-
|
|
11
|
-
uniform float u_saturation_factor;
|
|
12
|
-
uniform float u_contrast_factor;
|
|
13
|
-
uniform vec3 u_spin_weights;
|
|
14
|
-
|
|
15
|
-
void main() {
|
|
16
|
-
|
|
17
|
-
// read and cross-fade colors from the main and parent tiles
|
|
18
|
-
vec4 color0 = texture2D(u_image0, v_pos0);
|
|
19
|
-
vec4 color1 = texture2D(u_image1, v_pos1);
|
|
20
|
-
if (color0.a > 0.0) {
|
|
21
|
-
color0.rgb = color0.rgb / color0.a;
|
|
22
|
-
}
|
|
23
|
-
if (color1.a > 0.0) {
|
|
24
|
-
color1.rgb = color1.rgb / color1.a;
|
|
25
|
-
}
|
|
26
|
-
vec4 color = mix(color0, color1, u_fade_t);
|
|
27
|
-
color.a *= u_opacity;
|
|
28
|
-
vec3 rgb = color.rgb;
|
|
29
|
-
|
|
30
|
-
// spin
|
|
31
|
-
rgb = vec3(
|
|
32
|
-
dot(rgb, u_spin_weights.xyz),
|
|
33
|
-
dot(rgb, u_spin_weights.zxy),
|
|
34
|
-
dot(rgb, u_spin_weights.yzx));
|
|
35
|
-
|
|
36
|
-
// saturation
|
|
37
|
-
float average = (color.r + color.g + color.b) / 3.0;
|
|
38
|
-
rgb += (average - rgb) * u_saturation_factor;
|
|
39
|
-
|
|
40
|
-
// contrast
|
|
41
|
-
rgb = (rgb - 0.5) * u_contrast_factor + 0.5;
|
|
42
|
-
|
|
43
|
-
// brightness
|
|
44
|
-
vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);
|
|
45
|
-
vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);
|
|
46
|
-
|
|
47
|
-
gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);
|
|
48
|
-
|
|
49
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
50
|
-
gl_FragColor = vec4(1.0);
|
|
51
|
-
#endif
|
|
52
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
uniform mat4 u_matrix;
|
|
2
|
-
uniform vec2 u_tl_parent;
|
|
3
|
-
uniform float u_scale_parent;
|
|
4
|
-
uniform float u_buffer_scale;
|
|
5
|
-
|
|
6
|
-
attribute vec2 a_pos;
|
|
7
|
-
attribute vec2 a_texture_pos;
|
|
8
|
-
|
|
9
|
-
varying vec2 v_pos0;
|
|
10
|
-
varying vec2 v_pos1;
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
gl_Position = u_matrix * vec4(a_pos, 0, 1);
|
|
14
|
-
// We are using Int16 for texture position coordinates to give us enough precision for
|
|
15
|
-
// fractional coordinates. We use 8192 to scale the texture coordinates in the buffer
|
|
16
|
-
// as an arbitrarily high number to preserve adequate precision when rendering.
|
|
17
|
-
// This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,
|
|
18
|
-
// so math for modifying either is consistent.
|
|
19
|
-
v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;
|
|
20
|
-
v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;
|
|
21
|
-
}
|