@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
|
@@ -5,12 +5,10 @@ attribute float a_Size;
|
|
|
5
5
|
attribute vec2 a_Uv;
|
|
6
6
|
attribute float a_Rotate;
|
|
7
7
|
|
|
8
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
9
|
-
|
|
10
8
|
uniform mat4 u_ModelMatrix;
|
|
11
9
|
uniform mat4 u_Mvp;
|
|
12
10
|
uniform mat2 u_RotateMatrix;
|
|
13
|
-
uniform int
|
|
11
|
+
uniform int u_size_unit;
|
|
14
12
|
|
|
15
13
|
varying vec2 v_uv; // 本身的 uv 坐标
|
|
16
14
|
varying vec2 v_Iconuv; // icon 贴图的 uv 坐标
|
|
@@ -20,69 +18,28 @@ uniform float u_heightfixed: 0.0;
|
|
|
20
18
|
uniform float u_opacity : 1;
|
|
21
19
|
uniform vec2 u_offsets;
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
#pragma include "styleMappingCalOpacity"
|
|
21
|
+
|
|
25
22
|
|
|
26
23
|
#pragma include "projection"
|
|
27
24
|
#pragma include "picking"
|
|
28
25
|
|
|
29
26
|
void main() {
|
|
30
27
|
vec3 extrude = a_Extrude;
|
|
31
|
-
|
|
32
28
|
v_uv = (a_Extrude.xy + 1.0)/2.0;
|
|
33
29
|
v_uv.y = 1.0 - v_uv.y;
|
|
34
30
|
v_Iconuv = a_Uv;
|
|
35
31
|
|
|
36
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
37
|
-
styleMappingMat = mat4(
|
|
38
|
-
0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty
|
|
39
|
-
0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty
|
|
40
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
41
|
-
0.0, 0.0, 0.0, 0.0
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
45
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
46
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
47
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
48
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
49
|
-
float id = a_vertexId; // 第n个顶点
|
|
50
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
51
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
52
|
-
|
|
53
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
54
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
55
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
56
|
-
|
|
57
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
58
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
59
|
-
textureOffset = opacityAndOffset.g;
|
|
60
|
-
|
|
61
|
-
vec2 textrueOffsets = vec2(0.0, 0.0);
|
|
62
|
-
if(hasOffsets()) {
|
|
63
|
-
vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
64
|
-
textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x
|
|
65
|
-
textureOffset += 1.0;
|
|
66
|
-
|
|
67
|
-
vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
68
|
-
textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x
|
|
69
|
-
textureOffset += 1.0;
|
|
70
|
-
} else {
|
|
71
|
-
textrueOffsets = u_offsets;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// cal style mapping
|
|
75
32
|
|
|
76
33
|
highp float angle_sin = sin(a_Rotate);
|
|
77
34
|
highp float angle_cos = cos(a_Rotate);
|
|
78
35
|
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
79
36
|
float newSize = a_Size;
|
|
80
|
-
if(
|
|
37
|
+
if(u_size_unit == 1) {
|
|
81
38
|
newSize = newSize * u_PixelsPerMeter.z;
|
|
82
39
|
}
|
|
83
40
|
|
|
84
41
|
// vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
|
|
85
|
-
vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (newSize) +
|
|
42
|
+
vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (newSize) + u_offsets);
|
|
86
43
|
vec3 aPosition = a_Position;
|
|
87
44
|
|
|
88
45
|
offset = project_pixel(offset);
|
|
@@ -5,13 +5,9 @@ varying vec2 v_uv;
|
|
|
5
5
|
uniform vec2 u_textSize;
|
|
6
6
|
uniform float u_opacity : 1;
|
|
7
7
|
|
|
8
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
9
|
-
|
|
10
8
|
#pragma include "picking"
|
|
11
9
|
|
|
12
10
|
void main(){
|
|
13
|
-
float opacity = styleMappingMat[0][0];
|
|
14
|
-
float size = styleMappingMat[1][0];
|
|
15
11
|
vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;
|
|
16
12
|
vec4 textureColor;
|
|
17
13
|
|
|
@@ -34,7 +30,7 @@ void main(){
|
|
|
34
30
|
gl_FragColor= step(0.01, textureColor.z) * v_color;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
gl_FragColor.a = gl_FragColor.a *
|
|
33
|
+
gl_FragColor.a = gl_FragColor.a * u_opacity;
|
|
38
34
|
|
|
39
35
|
if (gl_FragColor.a < 0.01) {
|
|
40
36
|
discard;
|
|
@@ -13,61 +13,18 @@ uniform float u_opacity : 1;
|
|
|
13
13
|
uniform float u_raisingHeight: 0.0;
|
|
14
14
|
uniform float u_heightfixed: 0.0;
|
|
15
15
|
|
|
16
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
17
|
-
|
|
18
|
-
#pragma include "styleMapping"
|
|
19
|
-
#pragma include "styleMappingCalOpacity"
|
|
20
16
|
|
|
21
17
|
#pragma include "projection"
|
|
22
18
|
#pragma include "picking"
|
|
23
19
|
|
|
24
20
|
void main() {
|
|
25
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
26
|
-
styleMappingMat = mat4(
|
|
27
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
28
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
29
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
30
|
-
0.0, 0.0, 0.0, 0.0
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
34
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
35
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
36
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
37
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
38
|
-
float id = a_vertexId; // 第n个顶点
|
|
39
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
40
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
41
|
-
|
|
42
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
43
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
44
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
45
|
-
|
|
46
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
47
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
48
|
-
textureOffset = opacityAndOffset.g;
|
|
49
|
-
|
|
50
|
-
styleMappingMat[1][0] = a_Size;
|
|
51
|
-
|
|
52
|
-
vec2 textrueOffsets = vec2(0.0, 0.0);
|
|
53
|
-
if(hasOffsets()) {
|
|
54
|
-
vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
55
|
-
textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x
|
|
56
|
-
textureOffset += 1.0;
|
|
57
|
-
|
|
58
|
-
vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
59
|
-
textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x
|
|
60
|
-
textureOffset += 1.0;
|
|
61
|
-
} else {
|
|
62
|
-
textrueOffsets = u_offsets;
|
|
63
|
-
}
|
|
64
21
|
|
|
65
22
|
// cal style mapping - 数据纹理映射部分的计算
|
|
66
23
|
v_color = a_Color;
|
|
67
24
|
v_uv = a_Uv;
|
|
68
25
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
69
26
|
|
|
70
|
-
vec2 offset = project_pixel(
|
|
27
|
+
vec2 offset = project_pixel(u_offsets);
|
|
71
28
|
|
|
72
29
|
float raisingHeight = u_raisingHeight;
|
|
73
30
|
if(u_heightfixed < 1.0) { // false
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
attribute vec3 a_Position;
|
|
3
3
|
uniform mat4 u_ModelMatrix;
|
|
4
|
+
uniform float u_opacity : 1;
|
|
4
5
|
uniform mat4 u_Mvp;
|
|
5
6
|
attribute float a_Size;
|
|
6
7
|
attribute vec4 a_Color;
|
|
@@ -11,7 +12,7 @@ varying vec4 v_color;
|
|
|
11
12
|
#pragma include "project"
|
|
12
13
|
|
|
13
14
|
void main() {
|
|
14
|
-
v_color = a_Color;
|
|
15
|
+
v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);
|
|
15
16
|
|
|
16
17
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
17
18
|
gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);
|
|
@@ -7,7 +7,7 @@ uniform float u_time;
|
|
|
7
7
|
|
|
8
8
|
uniform mat4 u_ModelMatrix;
|
|
9
9
|
uniform mat4 u_Mvp;
|
|
10
|
-
uniform int
|
|
10
|
+
uniform int u_size_unit;
|
|
11
11
|
|
|
12
12
|
varying vec4 v_data;
|
|
13
13
|
varying vec4 v_color;
|
|
@@ -37,7 +37,7 @@ void main() {
|
|
|
37
37
|
float blur = 0.0;
|
|
38
38
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);
|
|
39
39
|
|
|
40
|
-
if(
|
|
40
|
+
if(u_size_unit == 1) {
|
|
41
41
|
newSize = newSize * u_PixelsPerMeter.z;
|
|
42
42
|
}
|
|
43
43
|
// radius(16-bit)
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
uniform float u_opacity : 1;
|
|
3
|
-
uniform vec2 u_offsets;
|
|
4
2
|
uniform float u_additive;
|
|
5
|
-
|
|
6
3
|
uniform float u_stroke_opacity : 1;
|
|
7
4
|
|
|
8
5
|
uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
|
|
9
6
|
|
|
10
7
|
varying vec4 v_color;
|
|
11
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
12
8
|
varying float v_blur;
|
|
13
9
|
varying float v_innerRadius;
|
|
14
10
|
|
|
@@ -16,7 +12,6 @@ varying float v_innerRadius;
|
|
|
16
12
|
void main() {
|
|
17
13
|
vec2 center = vec2(0.5);
|
|
18
14
|
|
|
19
|
-
float opacity = styleMappingMat[0][0];
|
|
20
15
|
// Tip: 片元到中心点的距离 0 - 1
|
|
21
16
|
float fragmengTocenter = distance(center, gl_PointCoord) * 2.0;
|
|
22
17
|
// Tip: 片元的剪切成圆形
|
|
@@ -40,8 +35,6 @@ void main() {
|
|
|
40
35
|
gl_FragColor = v_color;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
gl_FragColor.a *= opacity;
|
|
44
|
-
|
|
45
38
|
gl_FragColor = filterColor(gl_FragColor);
|
|
46
39
|
|
|
47
40
|
if(u_additive > 0.0) {
|
|
@@ -10,62 +10,20 @@ uniform float u_opacity : 1;
|
|
|
10
10
|
uniform vec2 u_offsets;
|
|
11
11
|
uniform float u_stroke_width;
|
|
12
12
|
|
|
13
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
14
13
|
varying float v_blur;
|
|
15
14
|
varying float v_innerRadius;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
#pragma include "styleMappingCalOpacity"
|
|
16
|
+
|
|
19
17
|
|
|
20
18
|
#pragma include "projection"
|
|
21
19
|
#pragma include "picking"
|
|
22
20
|
#pragma include "project"
|
|
23
21
|
void main() {
|
|
24
|
-
v_color = a_Color;
|
|
22
|
+
v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);
|
|
25
23
|
v_blur = 1.0 - max(2.0/a_Size, 0.05);
|
|
26
24
|
v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);
|
|
27
|
-
|
|
28
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
29
|
-
styleMappingMat = mat4(
|
|
30
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
31
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
32
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
33
|
-
0.0, 0.0, 0.0, 0.0
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
37
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
38
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
39
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
40
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
41
|
-
float id = a_vertexId; // 第n个顶点
|
|
42
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
43
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
44
|
-
|
|
45
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
46
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
47
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
48
|
-
|
|
49
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
50
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
51
|
-
textureOffset = opacityAndOffset.g;
|
|
52
|
-
|
|
53
|
-
vec2 textrueOffsets = vec2(0.0, 0.0);
|
|
54
|
-
if(hasOffsets()) {
|
|
55
|
-
vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
56
|
-
textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x
|
|
57
|
-
textureOffset += 1.0;
|
|
58
|
-
|
|
59
|
-
vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
60
|
-
textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x
|
|
61
|
-
textureOffset += 1.0;
|
|
62
|
-
} else {
|
|
63
|
-
textrueOffsets = u_offsets;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// cal style mapping
|
|
67
25
|
|
|
68
|
-
vec2 offset = project_pixel(
|
|
26
|
+
vec2 offset = project_pixel(u_offsets);
|
|
69
27
|
|
|
70
28
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
71
29
|
gl_Position = u_Mvp * vec4(a_Position.xy + offset, a_Position.z, 1.0);
|
|
@@ -3,47 +3,34 @@
|
|
|
3
3
|
#define FONT_SIZE 48.0
|
|
4
4
|
uniform sampler2D u_sdf_map;
|
|
5
5
|
uniform float u_gamma_scale : 0.5;
|
|
6
|
-
// uniform float u_font_size : 24.0;
|
|
7
|
-
uniform float u_opacity : 1.0;
|
|
8
|
-
uniform vec4 u_stroke_color : [0, 0, 0, 1];
|
|
9
6
|
uniform float u_stroke_width : 2.0;
|
|
10
7
|
uniform float u_halo_blur : 0.5;
|
|
11
8
|
uniform float u_DevicePixelRatio;
|
|
12
9
|
|
|
13
10
|
varying vec4 v_color;
|
|
11
|
+
varying vec4 v_stroke_color;
|
|
14
12
|
varying vec2 v_uv;
|
|
15
13
|
varying float v_gamma_scale;
|
|
16
14
|
varying float v_fontScale;
|
|
17
15
|
|
|
18
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
19
16
|
|
|
20
17
|
#pragma include "picking"
|
|
21
18
|
void main() {
|
|
22
19
|
// get style data mapping
|
|
23
|
-
float opacity = styleMappingMat[0][0];
|
|
24
|
-
float strokeWidth = styleMappingMat[0][2];
|
|
25
|
-
vec4 textrueStroke = vec4(
|
|
26
|
-
styleMappingMat[1][0],
|
|
27
|
-
styleMappingMat[1][1],
|
|
28
|
-
styleMappingMat[1][2],
|
|
29
|
-
styleMappingMat[1][3]
|
|
30
|
-
);
|
|
31
20
|
|
|
32
21
|
// get sdf from atlas
|
|
33
22
|
float dist = texture2D(u_sdf_map, v_uv).a;
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
|
|
38
|
-
lowp float buff = (6.0 - strokeWidth / v_fontScale) / SDF_PX;
|
|
24
|
+
lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
|
|
39
25
|
highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
|
|
40
26
|
|
|
41
27
|
highp float gamma_scaled = gamma * v_gamma_scale;
|
|
42
28
|
|
|
43
29
|
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
|
44
|
-
|
|
45
|
-
gl_FragColor = mix(
|
|
46
|
-
|
|
30
|
+
|
|
31
|
+
gl_FragColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));
|
|
32
|
+
|
|
33
|
+
gl_FragColor.a *= alpha;
|
|
47
34
|
// 作为 mask 模板时需要丢弃透明的像素
|
|
48
35
|
if (gl_FragColor.a < 0.01) {
|
|
49
36
|
discard;
|
|
@@ -16,86 +16,25 @@ uniform float u_raisingHeight: 0.0;
|
|
|
16
16
|
varying vec2 v_uv;
|
|
17
17
|
varying float v_gamma_scale;
|
|
18
18
|
varying vec4 v_color;
|
|
19
|
+
varying vec4 v_stroke_color;
|
|
19
20
|
varying float v_fontScale;
|
|
20
|
-
|
|
21
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
22
|
-
|
|
23
|
-
uniform float u_opacity : 1;
|
|
21
|
+
// uniform float u_opacity : 1;
|
|
24
22
|
uniform float u_stroke_width : 2;
|
|
25
23
|
uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
|
|
26
24
|
|
|
27
|
-
#pragma include "styleMapping"
|
|
28
|
-
#pragma include "styleMappingCalOpacity"
|
|
29
|
-
#pragma include "styleMappingCalStrokeWidth"
|
|
30
25
|
|
|
31
26
|
#pragma include "projection"
|
|
32
27
|
#pragma include "picking"
|
|
33
28
|
|
|
34
29
|
void main() {
|
|
35
30
|
// cal style mapping - 数据纹理映射部分的计算
|
|
36
|
-
styleMappingMat = mat4(
|
|
37
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
38
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
39
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
40
|
-
0.0, 0.0, 0.0, 0.0
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
44
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
45
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
46
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
47
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
48
|
-
float id = a_vertexId; // 第n个顶点
|
|
49
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
50
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
51
31
|
|
|
52
|
-
|
|
53
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
54
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
55
|
-
|
|
56
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
57
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
58
|
-
textureOffset = opacityAndOffset.g;
|
|
59
|
-
|
|
60
|
-
vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
61
|
-
styleMappingMat[0][2] = strokeWidthAndOffset.r;
|
|
62
|
-
textureOffset = strokeWidthAndOffset.g;
|
|
63
|
-
|
|
64
|
-
vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);
|
|
65
|
-
if(hasStroke()) {
|
|
66
|
-
vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
67
|
-
styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R
|
|
68
|
-
textureOffset += 1.0;
|
|
69
|
-
|
|
70
|
-
vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
71
|
-
styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G
|
|
72
|
-
textureOffset += 1.0;
|
|
32
|
+
v_uv = a_tex / u_sdf_map_size;
|
|
73
33
|
|
|
74
|
-
vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
75
|
-
styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B
|
|
76
|
-
textureOffset += 1.0;
|
|
77
34
|
|
|
78
|
-
vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
|
|
79
|
-
styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A
|
|
80
|
-
textureOffset += 1.0;
|
|
81
|
-
} else {
|
|
82
|
-
if(u_stroke_color == vec4(0.0)) {
|
|
83
|
-
styleMappingMat[1][0] = v_color.r;
|
|
84
|
-
styleMappingMat[1][1] = v_color.g;
|
|
85
|
-
styleMappingMat[1][2] = v_color.b;
|
|
86
|
-
styleMappingMat[1][3] = v_color.a;
|
|
87
|
-
} else {
|
|
88
|
-
styleMappingMat[1][0] = u_stroke_color.r;
|
|
89
|
-
styleMappingMat[1][1] = u_stroke_color.g;
|
|
90
|
-
styleMappingMat[1][2] = u_stroke_color.b;
|
|
91
|
-
styleMappingMat[1][3] = u_stroke_color.a;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
96
35
|
|
|
97
|
-
v_color = a_Color;
|
|
98
|
-
|
|
36
|
+
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
37
|
+
v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);
|
|
99
38
|
|
|
100
39
|
// 文本缩放比例
|
|
101
40
|
float fontScale = a_Size / FONT_SIZE;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import earcut from 'earcut';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
6
5
|
* @param paths 路径数据组
|
|
@@ -9,45 +8,37 @@ import earcut from 'earcut';
|
|
|
9
8
|
export default function extrudePolygon(path) {
|
|
10
9
|
var p1 = path[0][0];
|
|
11
10
|
var p2 = path[0][path[0].length - 1];
|
|
12
|
-
|
|
13
11
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
14
12
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
var n = path[0].length;
|
|
18
15
|
var flattengeo = earcut.flatten(path);
|
|
19
16
|
var positions = [];
|
|
20
17
|
var indexArray = [];
|
|
21
|
-
var normals = [];
|
|
22
|
-
|
|
18
|
+
var normals = [];
|
|
19
|
+
// 设置顶部z值
|
|
23
20
|
for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
|
|
24
21
|
flattengeo.vertices[j * 3 + 2] = 1;
|
|
25
22
|
normals.push(0, 0, 1);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
positions.push.apply(positions, _toConsumableArray(flattengeo.vertices));
|
|
29
25
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
30
26
|
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
31
|
-
|
|
32
|
-
var _loop = function _loop(i) {
|
|
27
|
+
var _loop = function _loop() {
|
|
33
28
|
var prePoint = flattengeo.vertices.slice(i * 3, i * 3 + 3);
|
|
34
29
|
var nextPoint = flattengeo.vertices.slice(i * 3 + 3, i * 3 + 6);
|
|
35
|
-
|
|
36
30
|
if (nextPoint.length === 0) {
|
|
37
31
|
nextPoint = flattengeo.vertices.slice(0, 3);
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
var indexOffset = positions.length / 3;
|
|
41
34
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
42
35
|
indexArray.push.apply(indexArray, _toConsumableArray([1, 2, 0, 3, 2, 1].map(function (v) {
|
|
43
36
|
return v + indexOffset;
|
|
44
37
|
})));
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
for (var i = 0; i < n; i++) {
|
|
48
|
-
_loop(
|
|
40
|
+
_loop();
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
return {
|
|
52
43
|
positions: positions,
|
|
53
44
|
index: indexArray
|
package/es/polygon/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IPolygonLayerStyleOptions } from '../core/interface';
|
|
|
3
3
|
import { PolygonModelType } from './models/';
|
|
4
4
|
export default class PolygonLayer extends BaseLayer<IPolygonLayerStyleOptions> {
|
|
5
5
|
type: string;
|
|
6
|
+
enableEncodeStyles: string[];
|
|
6
7
|
defaultSourceConfig: {
|
|
7
8
|
data: [];
|
|
8
9
|
options: {
|
package/es/polygon/index.js
CHANGED
|
@@ -7,71 +7,53 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
-
|
|
15
12
|
import BaseLayer from "../core/BaseLayer";
|
|
16
13
|
import PolygonModels from "./models/";
|
|
17
|
-
|
|
18
14
|
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
19
15
|
_inherits(PolygonLayer, _BaseLayer);
|
|
20
|
-
|
|
21
16
|
var _super = _createSuper(PolygonLayer);
|
|
22
|
-
|
|
23
17
|
function PolygonLayer() {
|
|
24
18
|
var _this;
|
|
25
|
-
|
|
26
19
|
_classCallCheck(this, PolygonLayer);
|
|
27
|
-
|
|
28
20
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
21
|
args[_key] = arguments[_key];
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
-
|
|
34
24
|
_defineProperty(_assertThisInitialized(_this), "type", 'PolygonLayer');
|
|
35
|
-
|
|
25
|
+
_defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", ['opacity']);
|
|
36
26
|
return _this;
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
_createClass(PolygonLayer, [{
|
|
40
29
|
key: "buildModels",
|
|
41
30
|
value: function () {
|
|
42
31
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
43
32
|
var shape;
|
|
44
33
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
|
-
while (1) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
case "end":
|
|
55
|
-
return _context.stop();
|
|
56
|
-
}
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
shape = this.getModelType();
|
|
37
|
+
this.layerModel = new PolygonModels[shape](this);
|
|
38
|
+
_context.next = 4;
|
|
39
|
+
return this.initLayerModels();
|
|
40
|
+
case 4:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
57
43
|
}
|
|
58
44
|
}, _callee, this);
|
|
59
45
|
}));
|
|
60
|
-
|
|
61
46
|
function buildModels() {
|
|
62
47
|
return _buildModels.apply(this, arguments);
|
|
63
48
|
}
|
|
64
|
-
|
|
65
49
|
return buildModels;
|
|
66
50
|
}()
|
|
67
51
|
}, {
|
|
68
52
|
key: "getModelType",
|
|
69
53
|
value: function getModelType() {
|
|
70
54
|
var _shapeAttribute$scale;
|
|
71
|
-
|
|
72
55
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
73
56
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
74
|
-
|
|
75
57
|
if (shape === 'fill' || !shape) {
|
|
76
58
|
return 'fill';
|
|
77
59
|
} else if (shape === 'extrude') {
|
|
@@ -92,43 +74,33 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
92
74
|
// pointlayer
|
|
93
75
|
// 2D、 3d、 shape、image、text、normal、
|
|
94
76
|
var layerData = this.getEncodedData();
|
|
95
|
-
|
|
96
77
|
var _this$getLayerConfig = this.getLayerConfig(),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
78
|
+
shape2d = _this$getLayerConfig.shape2d,
|
|
79
|
+
shape3d = _this$getLayerConfig.shape3d;
|
|
100
80
|
var iconMap = this.iconService.getIconMap();
|
|
101
81
|
var item = layerData.find(function (fe) {
|
|
102
82
|
return fe.hasOwnProperty('shape');
|
|
103
83
|
});
|
|
104
|
-
|
|
105
84
|
if (!item) {
|
|
106
85
|
return 'fill';
|
|
107
86
|
} else {
|
|
108
87
|
var shape = item.shape;
|
|
109
|
-
|
|
110
88
|
if (shape === 'dot') {
|
|
111
89
|
return 'point_normal';
|
|
112
90
|
}
|
|
113
|
-
|
|
114
91
|
if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
|
|
115
92
|
return 'point_fill';
|
|
116
93
|
}
|
|
117
|
-
|
|
118
94
|
if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
|
|
119
95
|
return 'point_extrude';
|
|
120
96
|
}
|
|
121
|
-
|
|
122
97
|
if (iconMap.hasOwnProperty(shape)) {
|
|
123
98
|
return 'point_image';
|
|
124
99
|
}
|
|
125
|
-
|
|
126
100
|
return 'text';
|
|
127
101
|
}
|
|
128
102
|
}
|
|
129
103
|
}]);
|
|
130
|
-
|
|
131
104
|
return PolygonLayer;
|
|
132
105
|
}(BaseLayer);
|
|
133
|
-
|
|
134
106
|
export { PolygonLayer as default };
|
|
@@ -6,10 +6,7 @@ export default class ExtrudeModel extends BaseModel {
|
|
|
6
6
|
u_topsurface: number;
|
|
7
7
|
u_sidesurface: number;
|
|
8
8
|
u_heightfixed: number;
|
|
9
|
-
u_dataTexture: ITexture2D;
|
|
10
|
-
u_cellTypeLayout: number[];
|
|
11
9
|
u_raisingHeight: number;
|
|
12
|
-
u_opacity: number;
|
|
13
10
|
u_linearColor: number;
|
|
14
11
|
u_sourceColor: number[];
|
|
15
12
|
u_targetColor: number[];
|