@antv/l7-layers 2.16.1 → 2.16.2
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/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.d.ts +3 -0
- package/es/core/BaseLayer.js +360 -528
- package/es/core/BaseModel.d.ts +9 -71
- package/es/core/BaseModel.js +118 -429
- package/es/core/CommonStyleAttribute.d.ts +2 -0
- package/es/core/CommonStyleAttribute.js +66 -0
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.d.ts +13 -3
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -36
- package/es/core/triangulation.d.ts +12 -0
- package/es/core/triangulation.js +124 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +29 -53
- package/es/heatmap/models/grid3d.js +29 -53
- package/es/heatmap/models/heatmap.d.ts +1 -0
- package/es/heatmap/models/heatmap.js +99 -150
- package/es/heatmap/models/hexagon.js +29 -53
- package/es/heatmap/shaders/grid_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +12 -36
- package/es/line/models/arc.js +72 -160
- package/es/line/models/arc_3d.js +67 -148
- package/es/line/models/earthArc_3d.js +66 -148
- package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
- package/es/line/models/flow.js +167 -0
- package/es/line/models/great_circle.js +57 -135
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +3 -3
- package/es/line/models/line.js +98 -186
- package/es/line/models/linearline.js +46 -115
- package/es/line/models/simpleLine.d.ts +0 -1
- package/es/line/models/simpleLine.js +42 -114
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/es/line/shaders/line_arc_frag.glsl +7 -11
- package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/es/line/shaders/line_arc_vert.glsl +9 -45
- package/es/line/shaders/line_frag.glsl +15 -17
- package/es/line/shaders/line_vert.glsl +3 -34
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +90 -141
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +79 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +15 -29
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.d.ts +1 -0
- package/es/point/index.js +27 -77
- package/es/point/models/earthExtrude.d.ts +0 -3
- package/es/point/models/earthExtrude.js +60 -139
- package/es/point/models/earthFill.d.ts +0 -1
- package/es/point/models/earthFill.js +59 -140
- package/es/point/models/extrude.d.ts +0 -3
- package/es/point/models/extrude.js +60 -140
- package/es/point/models/fill.d.ts +0 -1
- package/es/point/models/fill.js +67 -158
- package/es/point/models/fillmage.js +66 -147
- package/es/point/models/image.js +52 -126
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +32 -56
- package/es/point/models/radar.d.ts +0 -1
- package/es/point/models/radar.js +42 -75
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +46 -115
- package/es/point/models/text.js +211 -344
- package/es/point/shaders/animate/wave_frag.glsl +1 -11
- package/es/point/shaders/earth/extrude_frag.glsl +5 -17
- package/es/point/shaders/earth/extrude_vert.glsl +14 -29
- package/es/point/shaders/earth/fill_frag.glsl +5 -14
- package/es/point/shaders/earth/fill_vert.glsl +1 -75
- package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/es/point/shaders/fill_frag.glsl +9 -20
- package/es/point/shaders/fill_vert.glsl +16 -101
- package/es/point/shaders/image/fillImage_frag.glsl +2 -5
- package/es/point/shaders/image/fillImage_vert.glsl +4 -47
- package/es/point/shaders/image_frag.glsl +1 -5
- package/es/point/shaders/image_vert.glsl +1 -44
- package/es/point/shaders/normal_frag.glsl +0 -2
- package/es/point/shaders/normal_vert.glsl +2 -1
- package/es/point/shaders/radar/radar_vert.glsl +2 -2
- package/es/point/shaders/simplePoint_frag.glsl +0 -7
- package/es/point/shaders/simplePoint_vert.glsl +3 -45
- package/es/point/shaders/text_frag.glsl +6 -19
- package/es/point/shaders/text_vert.glsl +5 -66
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.d.ts +1 -0
- package/es/polygon/index.js +12 -40
- package/es/polygon/models/extrude.d.ts +0 -3
- package/es/polygon/models/extrude.js +122 -162
- package/es/polygon/models/fill.d.ts +0 -4
- package/es/polygon/models/fill.js +57 -130
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/es/polygon/shaders/polygon_frag.glsl +0 -5
- package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/es/polygon/shaders/polygon_vert.glsl +1 -27
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +32 -46
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +358 -520
- package/lib/core/BaseModel.js +117 -441
- package/lib/core/CommonStyleAttribute.js +72 -0
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -59
- package/lib/core/triangulation.js +125 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +29 -61
- package/lib/heatmap/models/grid3d.js +29 -61
- package/lib/heatmap/models/heatmap.js +99 -166
- package/lib/heatmap/models/hexagon.js +29 -61
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/shaders/grid_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +12 -42
- package/lib/line/models/arc.js +70 -170
- package/lib/line/models/arc_3d.js +65 -159
- package/lib/line/models/earthArc_3d.js +64 -159
- package/lib/line/models/flow.js +174 -0
- package/lib/line/models/great_circle.js +57 -146
- package/lib/line/models/index.js +3 -14
- package/lib/line/models/line.js +96 -194
- package/lib/line/models/linearline.js +46 -127
- package/lib/line/models/simpleLine.js +42 -124
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/lib/line/shaders/line_arc_frag.glsl +7 -11
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/lib/line/shaders/line_arc_vert.glsl +9 -45
- package/lib/line/shaders/line_frag.glsl +15 -17
- package/lib/line/shaders/line_vert.glsl +3 -34
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +90 -152
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +80 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +15 -36
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +27 -83
- package/lib/point/models/earthExtrude.js +60 -150
- package/lib/point/models/earthFill.js +59 -170
- package/lib/point/models/extrude.js +60 -150
- package/lib/point/models/fill.js +65 -167
- package/lib/point/models/fillmage.js +64 -155
- package/lib/point/models/image.js +52 -136
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +32 -66
- package/lib/point/models/radar.js +42 -85
- package/lib/point/models/simplePoint.js +46 -125
- package/lib/point/models/text.js +209 -350
- package/lib/point/shaders/animate/wave_frag.glsl +1 -11
- package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
- package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
- package/lib/point/shaders/earth/fill_frag.glsl +5 -14
- package/lib/point/shaders/earth/fill_vert.glsl +1 -75
- package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/lib/point/shaders/fill_frag.glsl +9 -20
- package/lib/point/shaders/fill_vert.glsl +16 -101
- package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
- package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
- package/lib/point/shaders/image_frag.glsl +1 -5
- package/lib/point/shaders/image_vert.glsl +1 -44
- package/lib/point/shaders/normal_frag.glsl +0 -2
- package/lib/point/shaders/normal_vert.glsl +2 -1
- package/lib/point/shaders/radar/radar_vert.glsl +2 -2
- package/lib/point/shaders/simplePoint_frag.glsl +0 -7
- package/lib/point/shaders/simplePoint_vert.glsl +3 -45
- package/lib/point/shaders/text_frag.glsl +6 -19
- package/lib/point/shaders/text_vert.glsl +5 -66
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +12 -48
- package/lib/polygon/models/extrude.js +122 -173
- package/lib/polygon/models/fill.js +57 -140
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/lib/polygon/shaders/polygon_frag.glsl +0 -5
- package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/lib/polygon/shaders/polygon_vert.glsl +1 -27
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +32 -51
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
- package/es/line/models/half.js +0 -298
- package/es/line/shaders/half/line_half_frag.glsl +0 -53
- package/es/line/shaders/half/line_half_vert.glsl +0 -169
- package/es/utils/dataMappingStyle.d.ts +0 -31
- package/es/utils/dataMappingStyle.js +0 -147
- package/lib/line/models/half.js +0 -315
- package/lib/line/shaders/half/line_half_frag.glsl +0 -53
- package/lib/line/shaders/half/line_half_vert.glsl +0 -169
- package/lib/utils/dataMappingStyle.js +0 -151
|
@@ -26,12 +26,7 @@ varying float v_segmentIndex;
|
|
|
26
26
|
|
|
27
27
|
attribute vec2 a_iconMapUV;
|
|
28
28
|
varying vec2 v_iconMapUV;
|
|
29
|
-
|
|
30
|
-
uniform float u_opacity: 1.0;
|
|
31
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
32
|
-
|
|
33
|
-
#pragma include "styleMapping"
|
|
34
|
-
#pragma include "styleMappingCalOpacity"
|
|
29
|
+
varying vec4 v_line_data;
|
|
35
30
|
|
|
36
31
|
#pragma include "projection"
|
|
37
32
|
#pragma include "project"
|
|
@@ -99,31 +94,6 @@ vec3 lglt2xyz(vec2 lnglat) {
|
|
|
99
94
|
}
|
|
100
95
|
|
|
101
96
|
void main() {
|
|
102
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
103
|
-
styleMappingMat = mat4(
|
|
104
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
105
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
106
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
107
|
-
0.0, 0.0, 0.0, 0.0 // dataset 数据集
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
111
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
112
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
113
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
114
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
115
|
-
float id = a_vertexId; // 第n个顶点
|
|
116
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
117
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
118
|
-
|
|
119
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
120
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
121
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
122
|
-
|
|
123
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
124
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
125
|
-
textureOffset = opacityAndOffset.g;
|
|
126
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
127
97
|
|
|
128
98
|
v_color = a_Color;
|
|
129
99
|
vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;
|
|
@@ -148,7 +118,7 @@ void main() {
|
|
|
148
118
|
if(u_animate.x == Animate) {
|
|
149
119
|
d_distance_ratio = segmentIndex / segmentNumber;
|
|
150
120
|
}
|
|
151
|
-
|
|
121
|
+
v_line_data.g = d_distance_ratio; // 当前点位距离占线总长的比例
|
|
152
122
|
|
|
153
123
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
154
124
|
vec3 curr = getPos(source, target, segmentRatio);
|
|
@@ -162,12 +132,12 @@ void main() {
|
|
|
162
132
|
|
|
163
133
|
float arcDistrance = length(source - target);
|
|
164
134
|
float pixelLen = project_pixel_texture(u_icon_step);
|
|
165
|
-
|
|
135
|
+
v_line_data.b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
|
|
166
136
|
|
|
167
137
|
vec2 projectOffset = project_pixel(offset);
|
|
168
138
|
float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
|
|
169
139
|
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
|
|
170
|
-
|
|
140
|
+
v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
171
141
|
|
|
172
142
|
v_iconMapUV = a_iconMapUV;
|
|
173
143
|
}
|
|
@@ -19,24 +19,20 @@ uniform vec2 u_textSize;
|
|
|
19
19
|
|
|
20
20
|
uniform float segmentNumber;
|
|
21
21
|
varying vec2 v_iconMapUV;
|
|
22
|
+
varying vec4 v_lineData;
|
|
22
23
|
|
|
23
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
24
24
|
|
|
25
25
|
#pragma include "picking"
|
|
26
26
|
|
|
27
27
|
void main() {
|
|
28
|
-
float opacity = styleMappingMat[0][0];
|
|
29
28
|
float animateSpeed = 0.0; // 运动速度
|
|
30
|
-
float d_segmentIndex = styleMappingMat[3].r; // 当前顶点在弧线中所处的分段位置
|
|
31
|
-
float d_distance_ratio = styleMappingMat[3].b; // 当前顶点在弧线中所处的分段比例
|
|
32
|
-
|
|
33
29
|
gl_FragColor = v_color;
|
|
34
30
|
|
|
35
|
-
gl_FragColor.a *=
|
|
31
|
+
gl_FragColor.a *= u_opacity;
|
|
36
32
|
|
|
37
33
|
if(u_animate.x == Animate && u_line_texture != LineTexture) {
|
|
38
34
|
animateSpeed = u_time / u_animate.y;
|
|
39
|
-
float alpha =1.0 - fract( mod(1.0-
|
|
35
|
+
float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
|
|
40
36
|
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
|
|
41
37
|
// alpha = smoothstep(0., 1., alpha);
|
|
42
38
|
alpha = clamp(alpha, 0.0, 1.0);
|
|
@@ -45,10 +41,10 @@ void main() {
|
|
|
45
41
|
|
|
46
42
|
// 当存在贴图时在底色上贴上贴图
|
|
47
43
|
if(u_line_texture == LineTexture) { // while load texture
|
|
48
|
-
float arcRadio = smoothstep( 0.0, 1.0, (
|
|
44
|
+
float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));
|
|
49
45
|
// float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);
|
|
50
46
|
|
|
51
|
-
float count =
|
|
47
|
+
float count = v_lineData.g; // 贴图在弧线上重复的数量
|
|
52
48
|
|
|
53
49
|
float time = 0.0;
|
|
54
50
|
if(u_animate.x == Animate) {
|
|
@@ -57,7 +53,7 @@ void main() {
|
|
|
57
53
|
float redioCount = arcRadio * count;
|
|
58
54
|
|
|
59
55
|
float u = fract(redioCount - time);
|
|
60
|
-
float v =
|
|
56
|
+
float v = v_lineData.a; // 横向 v
|
|
61
57
|
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
|
62
58
|
|
|
63
59
|
vec4 pattern = texture2D(u_texture, uv);
|
|
@@ -75,7 +71,7 @@ void main() {
|
|
|
75
71
|
pattern.a = 0.0;
|
|
76
72
|
gl_FragColor = filterColor(gl_FragColor + pattern);
|
|
77
73
|
} else { // replace
|
|
78
|
-
pattern.a *=
|
|
74
|
+
pattern.a *= u_opacity;
|
|
79
75
|
if(gl_FragColor.a <= 0.0) {
|
|
80
76
|
pattern.a = 0.0;
|
|
81
77
|
}
|
|
@@ -25,17 +25,16 @@ varying vec2 v_iconMapUV;
|
|
|
25
25
|
uniform float u_linearColor: 0;
|
|
26
26
|
uniform vec4 u_sourceColor;
|
|
27
27
|
uniform vec4 u_targetColor;
|
|
28
|
-
|
|
29
|
-
varying mat4 styleMappingMat;
|
|
28
|
+
varying vec4 v_line_data;
|
|
30
29
|
|
|
31
30
|
#pragma include "picking"
|
|
32
31
|
#pragma include "project"
|
|
33
32
|
#pragma include "projection"
|
|
34
33
|
|
|
35
34
|
void main() {
|
|
36
|
-
float opacity =
|
|
35
|
+
float opacity = u_opacity;
|
|
37
36
|
float animateSpeed = 0.0;
|
|
38
|
-
float d_segmentIndex =
|
|
37
|
+
float d_segmentIndex = v_line_data.g;
|
|
39
38
|
|
|
40
39
|
// 设置弧线的底色
|
|
41
40
|
if(u_linearColor == 1.0) { // 使用渐变颜色
|
|
@@ -70,14 +69,14 @@ void main() {
|
|
|
70
69
|
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) {
|
|
71
70
|
float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));
|
|
72
71
|
// float arcRadio = d_segmentIndex / (segmentNumber - 1.0);
|
|
73
|
-
float count =
|
|
72
|
+
float count = v_line_data.b; // 贴图在弧线上重复的数量
|
|
74
73
|
float u = fract(arcRadio * count - animateSpeed * count);
|
|
75
74
|
// float u = fract(arcRadio * count - animateSpeed);
|
|
76
75
|
if(u_animate.x == Animate) {
|
|
77
76
|
u = gl_FragColor.a/opacity;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
float v =
|
|
79
|
+
float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
|
|
81
80
|
|
|
82
81
|
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
|
83
82
|
vec4 pattern = texture2D(u_texture, uv);
|
|
@@ -23,12 +23,8 @@ uniform float u_line_texture: 0.0;
|
|
|
23
23
|
|
|
24
24
|
attribute vec2 a_iconMapUV;
|
|
25
25
|
varying vec2 v_iconMapUV;
|
|
26
|
+
varying vec4 v_line_data;
|
|
26
27
|
|
|
27
|
-
uniform float u_opacity: 1.0;
|
|
28
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
29
|
-
|
|
30
|
-
#pragma include "styleMapping"
|
|
31
|
-
#pragma include "styleMappingCalOpacity"
|
|
32
28
|
|
|
33
29
|
#pragma include "projection"
|
|
34
30
|
#pragma include "project"
|
|
@@ -123,31 +119,7 @@ vec2 interpolate (vec2 source, vec2 target, float angularDist, float t) {
|
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
void main() {
|
|
126
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
127
|
-
styleMappingMat = mat4(
|
|
128
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
129
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
130
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
131
|
-
0.0, 0.0, 0.0, 0.0 // dataset 数据集
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
135
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
136
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
137
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
138
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
139
|
-
float id = a_vertexId; // 第n个顶点
|
|
140
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
141
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
142
122
|
|
|
143
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
144
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
145
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
146
|
-
|
|
147
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
148
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
149
|
-
textureOffset = opacityAndOffset.g;
|
|
150
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
151
123
|
|
|
152
124
|
v_color = a_Color;
|
|
153
125
|
vec2 source = radians(a_Instance.rg);
|
|
@@ -184,7 +156,7 @@ void main() {
|
|
|
184
156
|
// vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
|
|
185
157
|
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
|
|
186
158
|
|
|
187
|
-
|
|
159
|
+
v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
|
|
188
160
|
if(LineTexture == u_line_texture) { // 开启贴图模式
|
|
189
161
|
// float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;
|
|
190
162
|
float d_arcDistrance = length(source - target);
|
|
@@ -195,11 +167,11 @@ void main() {
|
|
|
195
167
|
d_arcDistrance = project_pixel_allmap(d_arcDistrance);
|
|
196
168
|
}
|
|
197
169
|
float d_pixelLen = project_pixel(u_icon_step)/8.0;
|
|
198
|
-
|
|
170
|
+
v_line_data.b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量
|
|
199
171
|
|
|
200
172
|
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
|
|
201
173
|
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
|
|
202
|
-
|
|
174
|
+
v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
203
175
|
|
|
204
176
|
v_iconMapUV = a_iconMapUV;
|
|
205
177
|
}
|
|
@@ -18,13 +18,11 @@ uniform float u_icon_step: 100;
|
|
|
18
18
|
uniform float u_line_texture: 0.0;
|
|
19
19
|
attribute vec2 a_iconMapUV;
|
|
20
20
|
varying vec2 v_iconMapUV;
|
|
21
|
+
varying vec4 v_lineData;
|
|
22
|
+
varying vec2 v_distance_ratio;
|
|
21
23
|
|
|
22
24
|
uniform float u_opacity: 1.0;
|
|
23
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
24
25
|
|
|
25
|
-
#pragma include "styleMapping"
|
|
26
|
-
#pragma include "styleMappingCalOpacity"
|
|
27
|
-
#pragma include "styleMappingCalThetaOffset"
|
|
28
26
|
|
|
29
27
|
#pragma include "projection"
|
|
30
28
|
#pragma include "project"
|
|
@@ -83,37 +81,6 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
|
|
|
83
81
|
void main() {
|
|
84
82
|
v_color = a_Color;
|
|
85
83
|
|
|
86
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
87
|
-
styleMappingMat = mat4(
|
|
88
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
89
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
90
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
91
|
-
0.0, 0.0, 0.0, 0.0 // dataset 数据集
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
95
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
96
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
97
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
98
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
99
|
-
float id = a_vertexId; // 第n个顶点
|
|
100
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
101
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
102
|
-
|
|
103
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset...
|
|
104
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
105
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
106
|
-
|
|
107
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
108
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
109
|
-
textureOffset = opacityAndOffset.g;
|
|
110
|
-
|
|
111
|
-
vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
112
|
-
styleMappingMat[0][1] = thetaOffsetAndOffset.r;
|
|
113
|
-
textureOffset = thetaOffsetAndOffset.g;
|
|
114
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
115
|
-
|
|
116
|
-
|
|
117
84
|
vec2 source = a_Instance.rg; // 起始点
|
|
118
85
|
vec2 target = a_Instance.ba; // 终点
|
|
119
86
|
float segmentIndex = a_Position.x;
|
|
@@ -130,20 +97,17 @@ void main() {
|
|
|
130
97
|
}
|
|
131
98
|
}
|
|
132
99
|
|
|
133
|
-
|
|
100
|
+
v_lineData.b = d_distance_ratio;
|
|
101
|
+
|
|
102
|
+
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, u_thetaOffset), 0.0, 1.0));
|
|
103
|
+
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, u_thetaOffset), 0.0, 1.0));
|
|
134
104
|
|
|
135
|
-
// styleMappingMat[0][1] - arcThetaOffset
|
|
136
|
-
float arcThetaOffset = styleMappingMat[0][1];
|
|
137
|
-
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, arcThetaOffset), 0.0, 1.0));
|
|
138
|
-
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, arcThetaOffset), 0.0, 1.0));
|
|
139
|
-
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
140
|
-
//unProjCustomCoord
|
|
141
105
|
|
|
142
106
|
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
|
|
143
107
|
|
|
144
108
|
|
|
145
109
|
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
|
|
146
|
-
|
|
110
|
+
v_lineData.r = d_segmentIndex;
|
|
147
111
|
|
|
148
112
|
if(LineTexture == u_line_texture) { // 开启贴图模式
|
|
149
113
|
|
|
@@ -159,11 +123,11 @@ void main() {
|
|
|
159
123
|
|
|
160
124
|
float pixelLen = project_pixel_texture(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变
|
|
161
125
|
float texCount = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
|
|
162
|
-
|
|
126
|
+
v_lineData.g = texCount;
|
|
163
127
|
|
|
164
128
|
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
|
|
165
129
|
float linePixelSize = project_pixel(a_Size); // 定点位置偏移
|
|
166
|
-
|
|
130
|
+
v_lineData.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
167
131
|
}
|
|
168
132
|
|
|
169
133
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#extension GL_OES_standard_derivatives : enable
|
|
1
2
|
#define Animate 0.0
|
|
2
3
|
#define LineTexture 1.0
|
|
3
4
|
uniform float u_opacity : 1.0;
|
|
@@ -13,24 +14,22 @@ varying vec4 v_color;
|
|
|
13
14
|
uniform float u_line_texture;
|
|
14
15
|
uniform sampler2D u_texture;
|
|
15
16
|
uniform vec2 u_textSize;
|
|
16
|
-
|
|
17
17
|
varying vec2 v_iconMapUV;
|
|
18
|
+
varying vec4 v_texture_data;
|
|
19
|
+
|
|
18
20
|
|
|
19
21
|
#pragma include "picking"
|
|
20
22
|
|
|
21
23
|
uniform float u_time;
|
|
22
24
|
uniform vec4 u_animate: [ 1, 2., 1.0, 0.2 ]; // 控制运动
|
|
23
|
-
|
|
24
|
-
varying mat4 styleMappingMat;
|
|
25
25
|
// [animate, duration, interval, trailLength],
|
|
26
26
|
void main() {
|
|
27
|
-
float opacity = styleMappingMat[0][0];
|
|
28
27
|
float animateSpeed = 0.0; // 运动速度
|
|
29
|
-
float d_distance_ratio =
|
|
28
|
+
float d_distance_ratio = v_texture_data.r; // 当前点位距离占线总长的比例
|
|
30
29
|
gl_FragColor = v_color;
|
|
31
30
|
// anti-alias
|
|
32
31
|
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
|
|
33
|
-
gl_FragColor.a *=
|
|
32
|
+
gl_FragColor.a *= u_opacity; // 全局透明度
|
|
34
33
|
if(u_animate.x == Animate) {
|
|
35
34
|
animateSpeed = u_time / u_animate.y;
|
|
36
35
|
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
|
|
@@ -40,23 +39,20 @@ void main() {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
if(u_line_texture == LineTexture) { // while load texture
|
|
43
|
-
float aDistance =
|
|
44
|
-
float d_texPixelLen =
|
|
42
|
+
float aDistance = v_texture_data.g; // 当前顶点的距离
|
|
43
|
+
float d_texPixelLen = v_texture_data.b; // 贴图的像素长度,根据地图层级缩放
|
|
45
44
|
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
|
|
46
|
-
float v =
|
|
45
|
+
float v = v_texture_data.a; // 线图层贴图部分的 v 坐标值
|
|
47
46
|
|
|
48
47
|
// v = max(smoothstep(0.95, 1.0, v), v);
|
|
49
48
|
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
|
50
|
-
|
|
51
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
|
|
52
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
|
|
53
49
|
vec4 pattern = texture2D(u_texture, uv);
|
|
54
50
|
|
|
55
51
|
if(u_textureBlend == 0.0) { // normal
|
|
56
52
|
pattern.a = 0.0;
|
|
57
53
|
gl_FragColor += pattern;
|
|
58
54
|
} else { // replace
|
|
59
|
-
pattern.a *=
|
|
55
|
+
pattern.a *= u_opacity;
|
|
60
56
|
if(gl_FragColor.a <= 0.0) {
|
|
61
57
|
pattern.a = 0.0;
|
|
62
58
|
}
|
|
@@ -64,15 +60,17 @@ void main() {
|
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
float v =
|
|
63
|
+
float v = v_texture_data.a;
|
|
68
64
|
float borderWidth = min(0.5, u_borderWidth);
|
|
69
65
|
// 绘制 border
|
|
70
66
|
if(borderWidth > 0.01) {
|
|
71
|
-
float borderOuterWidth = borderWidth/2.0;
|
|
67
|
+
float borderOuterWidth = borderWidth / 2.0;
|
|
68
|
+
|
|
72
69
|
|
|
73
70
|
if(v >= 1.0 - borderWidth || v <= borderWidth) {
|
|
74
|
-
if(v > borderWidth) {
|
|
71
|
+
if(v > borderWidth) { // 外侧
|
|
75
72
|
float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);
|
|
73
|
+
// float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);
|
|
76
74
|
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);
|
|
77
75
|
} else if(v <= borderWidth) {
|
|
78
76
|
float linear = smoothstep(0.0, 1.0, v/borderWidth);
|
|
@@ -88,7 +86,7 @@ void main() {
|
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
// blur
|
|
91
|
-
float blurV =
|
|
89
|
+
float blurV = v_texture_data.a;
|
|
92
90
|
if(blurV < 0.5) {
|
|
93
91
|
gl_FragColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);
|
|
94
92
|
} else {
|
|
@@ -37,11 +37,7 @@ uniform float u_arrowHeight: 3.0;
|
|
|
37
37
|
uniform float u_arrowWidth: 2.0;
|
|
38
38
|
uniform float u_tailWidth: 1.0;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
42
|
-
|
|
43
|
-
#pragma include "styleMapping"
|
|
44
|
-
#pragma include "styleMappingCalOpacity"
|
|
40
|
+
varying vec4 v_texture_data;
|
|
45
41
|
|
|
46
42
|
vec2 calculateArrow(vec2 offset) {
|
|
47
43
|
/*
|
|
@@ -87,31 +83,7 @@ vec2 calculateArrow(vec2 offset) {
|
|
|
87
83
|
|
|
88
84
|
void main() {
|
|
89
85
|
// cal style mapping - 数据纹理映射部分的计算
|
|
90
|
-
styleMappingMat = mat4(
|
|
91
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
92
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
93
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
94
|
-
0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
98
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
99
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
100
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
101
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
102
|
-
float id = a_vertexId; // 第n个顶点
|
|
103
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
104
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
105
86
|
|
|
106
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
107
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
108
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
109
|
-
|
|
110
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
111
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
112
|
-
textureOffset = opacityAndOffset.g;
|
|
113
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
114
|
-
|
|
115
87
|
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
116
88
|
|
|
117
89
|
v_iconMapUV = a_iconMapUV;
|
|
@@ -141,12 +113,9 @@ void main() {
|
|
|
141
113
|
float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
|
|
142
114
|
float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
|
|
143
115
|
float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
144
|
-
|
|
116
|
+
|
|
117
|
+
v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
|
|
145
118
|
// 设置数据集的参数
|
|
146
|
-
styleMappingMat[3][0] = currentLinePointRatio; // 当前点位距离占线总长的比例
|
|
147
|
-
styleMappingMat[3][1] = lineDistance; // 当前顶点的距离
|
|
148
|
-
styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
149
|
-
styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
|
|
150
119
|
|
|
151
120
|
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
152
121
|
|
|
@@ -1,34 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
#define Animate 0.0
|
|
3
|
-
|
|
4
|
-
uniform float u_opacity;
|
|
5
|
-
uniform float u_blur : 0.9;
|
|
6
|
-
varying float v_segmentIndex;
|
|
7
|
-
uniform float segmentNumber;
|
|
8
|
-
|
|
9
3
|
uniform float u_time;
|
|
10
4
|
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
5
|
+
varying vec4 v_Color;
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
uniform vec4 u_sourceColor;
|
|
14
|
-
uniform vec4 u_targetColor;
|
|
15
|
-
|
|
16
|
-
varying mat4 styleMappingMat;
|
|
17
|
-
|
|
7
|
+
varying float v_distance_ratio;
|
|
18
8
|
#pragma include "picking"
|
|
19
9
|
|
|
20
10
|
void main() {
|
|
21
|
-
float opacity = styleMappingMat[0][0];
|
|
22
|
-
float animateSpeed = 0.0; // 运动速度
|
|
23
|
-
float d_distance_ratio = styleMappingMat[3].g; // 当前点位距离占线总长的比例
|
|
24
|
-
|
|
25
|
-
gl_FragColor = mix(u_sourceColor, u_targetColor, v_segmentIndex/segmentNumber);
|
|
26
11
|
|
|
27
|
-
|
|
12
|
+
float animateSpeed = 0.0; // 运动速度
|
|
13
|
+
gl_FragColor = v_Color;
|
|
28
14
|
|
|
29
15
|
if(u_animate.x == Animate) {
|
|
30
16
|
animateSpeed = u_time / u_animate.y;
|
|
31
|
-
float alpha =1.0 - fract( mod(1.0-
|
|
17
|
+
float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
|
|
32
18
|
|
|
33
19
|
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
|
|
34
20
|
// alpha = smoothstep(0., 1., alpha);
|
|
@@ -15,22 +15,19 @@ uniform mat4 u_ModelMatrix;
|
|
|
15
15
|
uniform mat4 u_Mvp;
|
|
16
16
|
uniform float segmentNumber;
|
|
17
17
|
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
18
|
+
uniform vec4 u_sourceColor;
|
|
19
|
+
uniform vec4 u_targetColor;
|
|
18
20
|
|
|
19
21
|
uniform float u_line_type: 0.0;
|
|
20
22
|
uniform vec4 u_dash_array: [10.0, 5., 0, 0];
|
|
21
23
|
uniform float u_icon_step: 100;
|
|
22
24
|
uniform float u_line_texture: 0.0;
|
|
23
|
-
|
|
25
|
+
varying float v_distance_ratio;
|
|
24
26
|
|
|
25
27
|
varying vec4 v_dash_array;
|
|
26
28
|
varying vec4 v_color;
|
|
27
|
-
varying float v_segmentIndex;
|
|
28
29
|
varying vec2 v_iconMapUV;
|
|
29
|
-
varying
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#pragma include "styleMapping"
|
|
33
|
-
#pragma include "styleMappingCalOpacity"
|
|
30
|
+
varying vec4 v_Color;
|
|
34
31
|
|
|
35
32
|
#pragma include "projection"
|
|
36
33
|
#pragma include "project"
|
|
@@ -99,30 +96,6 @@ vec3 lglt2xyz(vec2 lnglat) {
|
|
|
99
96
|
|
|
100
97
|
void main() {
|
|
101
98
|
// cal style mapping - 数据纹理映射部分的计算
|
|
102
|
-
styleMappingMat = mat4(
|
|
103
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
104
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
105
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
106
|
-
0.0, 0.0, 0.0, 0.0 // dataset 数据集
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
110
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
111
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
112
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
113
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
114
|
-
float id = a_vertexId; // 第n个顶点
|
|
115
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
116
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
117
|
-
|
|
118
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
119
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
120
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
121
|
-
|
|
122
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
123
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
124
|
-
textureOffset = opacityAndOffset.g;
|
|
125
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
126
99
|
|
|
127
100
|
v_color = a_Color;
|
|
128
101
|
vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;
|
|
@@ -146,32 +119,20 @@ void main() {
|
|
|
146
119
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
|
|
147
120
|
}
|
|
148
121
|
if(u_animate.x == Animate) {
|
|
149
|
-
|
|
122
|
+
v_distance_ratio = segmentIndex / segmentNumber;
|
|
150
123
|
}
|
|
151
|
-
|
|
124
|
+
|
|
152
125
|
|
|
153
126
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
154
127
|
vec3 curr = getPos(source, target, segmentRatio);
|
|
155
128
|
vec3 next = getPos(source, target, nextSegmentRatio);
|
|
156
129
|
vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
157
|
-
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
158
|
-
|
|
159
130
|
|
|
160
|
-
|
|
161
|
-
|
|
131
|
+
float animateSpeed = 0.0; // 运动速度
|
|
132
|
+
v_Color = mix(u_sourceColor, u_targetColor, a_Position.x/segmentNumber);
|
|
162
133
|
|
|
163
|
-
|
|
164
|
-
float pixelLen = project_pixel_texture(u_icon_step);
|
|
165
|
-
styleMappingMat[3].b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
|
|
134
|
+
v_Color.a *= opacity;
|
|
166
135
|
|
|
167
|
-
vec2 projectOffset = project_pixel(offset);
|
|
168
|
-
float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
|
|
169
|
-
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
|
|
170
|
-
styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
171
|
-
|
|
172
|
-
v_iconMapUV = a_iconMapUV;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
136
|
|
|
176
137
|
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));
|
|
177
138
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
#define Animate 0.0
|
|
2
|
-
#define LineTexture 1.0
|
|
3
|
-
|
|
4
|
-
uniform float u_opacity;
|
|
5
|
-
uniform float u_textureBlend;
|
|
6
|
-
uniform float u_blur : 0.9;
|
|
7
|
-
uniform float u_line_type: 0.0;
|
|
8
|
-
// varying vec2 v_normal;
|
|
9
|
-
varying vec4 v_dash_array;
|
|
10
1
|
varying vec4 v_color;
|
|
11
2
|
|
|
12
|
-
uniform float u_time;
|
|
13
|
-
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
14
|
-
|
|
15
|
-
uniform float u_line_texture;
|
|
16
|
-
uniform sampler2D u_texture;
|
|
17
|
-
uniform vec2 u_textSize;
|
|
18
|
-
|
|
19
|
-
uniform float segmentNumber;
|
|
20
|
-
varying vec2 v_iconMapUV;
|
|
21
|
-
|
|
22
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
23
|
-
|
|
24
|
-
uniform float u_linearColor: 0;
|
|
25
|
-
uniform vec4 u_sourceColor;
|
|
26
|
-
uniform vec4 u_targetColor;
|
|
27
|
-
|
|
28
3
|
#pragma include "picking"
|
|
29
4
|
|
|
30
5
|
void main() {
|
|
31
|
-
|
|
32
|
-
float d_segmentIndex = styleMappingMat[3].r; // 当前顶点在弧线中所处的分段位置
|
|
6
|
+
// 当前顶点在弧线中所处的分段位置
|
|
33
7
|
|
|
34
|
-
|
|
35
|
-
gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
|
|
36
|
-
gl_FragColor.a *= opacity;
|
|
8
|
+
gl_FragColor = v_Color;
|
|
37
9
|
gl_FragColor = filterColor(gl_FragColor);
|
|
38
10
|
}
|