@antv/l7-layers 2.9.20 → 2.9.22
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 +4 -5
- package/es/Geometry/models/billboard.js +23 -9
- package/es/Geometry/models/index.js +4 -5
- package/es/Geometry/models/plane.js +25 -13
- package/es/Geometry/models/sprite.js +11 -21
- package/es/Geometry/shaders/billboard_frag.glsl +13 -0
- package/es/Geometry/shaders/billboard_vert.glsl +50 -0
- package/es/Geometry/shaders/plane_frag.glsl +22 -0
- package/es/Geometry/shaders/plane_vert.glsl +53 -0
- package/es/Geometry/shaders/sprite_frag.glsl +21 -0
- package/es/Geometry/shaders/sprite_vert.glsl +28 -0
- package/es/canvas/index.js +4 -5
- package/es/canvas/models/canvas.js +6 -12
- package/es/canvas/models/index.js +2 -3
- package/es/citybuliding/building.js +4 -5
- package/es/citybuliding/models/build.js +19 -22
- package/es/citybuliding/shaders/build_frag.glsl +117 -0
- package/es/citybuliding/shaders/build_vert.glsl +54 -0
- package/es/core/BaseLayer.js +205 -157
- package/es/core/BaseModel.js +135 -76
- package/es/core/interface.d.ts +11 -1
- package/es/core/interface.js +15 -2
- package/es/core/schema.js +4 -2
- package/es/core/shape/Path.js +8 -3
- package/es/core/shape/extrude.js +9 -4
- package/es/core/triangulation.js +89 -17
- package/es/earth/index.js +11 -7
- package/es/earth/models/atmosphere.js +15 -7
- package/es/earth/models/base.js +19 -7
- package/es/earth/models/bloomsphere.js +15 -7
- package/es/earth/shaders/atmosphere_frag.glsl +17 -0
- package/es/earth/shaders/atmosphere_vert.glsl +26 -0
- package/es/earth/shaders/base_frag.glsl +13 -0
- package/es/earth/shaders/base_vert.glsl +52 -0
- package/es/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/es/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/es/earth/utils.js +28 -5
- package/es/heatmap/index.js +8 -7
- package/es/heatmap/models/grid.js +11 -5
- package/es/heatmap/models/grid3d.js +18 -7
- package/es/heatmap/models/heatmap.js +45 -44
- package/es/heatmap/models/hexagon.js +14 -6
- package/es/heatmap/models/index.js +5 -6
- package/es/heatmap/shaders/grid_vert.glsl +42 -0
- package/es/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/es/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/es/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/es/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/es/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/es/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/es/heatmap/triangulation.js +2 -2
- package/es/image/index.js +4 -5
- package/es/image/models/dataImage.js +21 -31
- package/es/image/models/image.js +19 -25
- package/es/image/models/index.js +3 -4
- package/es/image/shaders/dataImage_frag.glsl +38 -0
- package/es/image/shaders/image_frag.glsl +9 -0
- package/es/image/shaders/image_vert.glsl +17 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +92 -30
- package/es/line/index.js +4 -5
- package/es/line/models/arc.js +38 -15
- package/es/line/models/arc_3d.js +33 -14
- package/es/line/models/earthArc_3d.js +33 -14
- package/es/line/models/great_circle.js +25 -13
- package/es/line/models/half.js +33 -12
- package/es/line/models/index.js +12 -13
- package/es/line/models/line.js +57 -17
- package/es/line/models/linearline.js +32 -14
- package/es/line/models/simpleLine.js +26 -11
- package/es/line/models/tile.js +28 -10
- package/es/line/models/wall.js +30 -13
- package/es/line/shaders/arc_chunks.vert.glsl +21 -0
- package/es/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/es/line/shaders/dash/arc_dash_vert.glsl +148 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/es/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/es/line/shaders/half/line_half_frag.glsl +53 -0
- package/es/line/shaders/half/line_half_vert.glsl +169 -0
- package/es/line/shaders/line_arc2d_vert.glsl +114 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/es/line/shaders/line_arc_3d_vert.glsl +207 -0
- package/es/line/shaders/line_arc_frag.glsl +89 -0
- package/es/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/es/line/shaders/line_arc_great_circle_vert.glsl +215 -0
- package/es/line/shaders/line_arc_vert.glsl +174 -0
- package/es/line/shaders/line_bezier_vert.glsl +85 -0
- package/es/line/shaders/line_frag.glsl +100 -0
- package/es/line/shaders/line_vert.glsl +192 -0
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
- package/es/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/es/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/es/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/es/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/es/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/es/line/shaders/simple/simpleline_vert.glsl +78 -0
- package/es/line/shaders/tile/line_tile_frag.glsl +79 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +210 -0
- package/es/line/shaders/wall_frag.glsl +93 -0
- package/es/line/shaders/wall_vert.glsl +111 -0
- package/es/mask/index.js +4 -5
- package/es/mask/models/fill.js +11 -8
- package/es/mask/models/index.js +2 -3
- package/es/mask/shaders/mask_frag.glsl +7 -0
- package/es/mask/shaders/mask_vert.glsl +22 -0
- package/es/plugins/DataMappingPlugin.js +71 -34
- package/es/plugins/DataSourcePlugin.js +12 -10
- package/es/plugins/FeatureScalePlugin.js +44 -24
- package/es/plugins/LayerAnimateStylePlugin.js +6 -7
- package/es/plugins/LayerModelPlugin.js +16 -7
- package/es/plugins/LayerStylePlugin.js +7 -3
- package/es/plugins/LightingPlugin.js +21 -13
- package/es/plugins/MultiPassRendererPlugin.js +21 -8
- package/es/plugins/PixelPickingPlugin.js +33 -11
- package/es/plugins/RegisterStyleAttributePlugin.js +10 -3
- package/es/plugins/ShaderUniformPlugin.js +24 -10
- package/es/plugins/UpdateModelPlugin.js +7 -3
- package/es/plugins/UpdateStyleAttributePlugin.js +20 -7
- package/es/point/index.js +12 -6
- package/es/point/models/earthExtrude.js +30 -12
- package/es/point/models/earthFill.js +25 -13
- package/es/point/models/extrude.js +30 -12
- package/es/point/models/fill.js +50 -15
- package/es/point/models/fillmage.js +46 -17
- package/es/point/models/image.js +20 -12
- package/es/point/models/index.js +14 -14
- package/es/point/models/normal.js +15 -7
- package/es/point/models/radar.js +33 -13
- package/es/point/models/simplePoint.js +17 -9
- package/es/point/models/text.js +77 -30
- package/es/point/models/tile.js +33 -12
- package/es/point/shaders/animate/wave_frag.glsl +65 -0
- package/es/point/shaders/earth/extrude_frag.glsl +44 -0
- package/es/point/shaders/earth/extrude_vert.glsl +140 -0
- package/es/point/shaders/earth/fill_frag.glsl +86 -0
- package/es/point/shaders/earth/fill_vert.glsl +126 -0
- package/es/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/es/point/shaders/fill_frag.glsl +84 -0
- package/es/point/shaders/fill_vert.glsl +182 -0
- package/es/point/shaders/image/fillImage_frag.glsl +20 -0
- package/es/point/shaders/image/fillImage_vert.glsl +108 -0
- package/es/point/shaders/image_frag.glsl +39 -0
- package/es/point/shaders/image_vert.glsl +81 -0
- package/es/point/shaders/normal_frag.glsl +15 -0
- package/es/point/shaders/normal_vert.glsl +79 -0
- package/es/point/shaders/radar/radar_frag.glsl +64 -0
- package/es/point/shaders/radar/radar_vert.glsl +120 -0
- package/es/point/shaders/simplePoint_frag.glsl +53 -0
- package/es/point/shaders/simplePoint_vert.glsl +79 -0
- package/es/point/shaders/text_frag.glsl +48 -0
- package/es/point/shaders/text_vert.glsl +131 -0
- package/es/point/shaders/tile/fill_tile_frag.glsl +83 -0
- package/es/point/shaders/tile/fill_tile_vert.glsl +181 -0
- package/es/point/shape/extrude.js +8 -3
- package/es/polygon/index.js +6 -5
- package/es/polygon/models/extrude.js +40 -31
- package/es/polygon/models/fill.js +19 -8
- package/es/polygon/models/index.js +14 -14
- package/es/polygon/models/ocean.js +25 -33
- package/es/polygon/models/tile.js +13 -7
- package/es/polygon/models/water.js +21 -25
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/es/polygon/shaders/polygon_frag.glsl +12 -0
- package/es/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/es/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/es/polygon/shaders/polygon_vert.glsl +66 -0
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
- package/es/polygon/shaders/water/polygon_water_frag.glsl +73 -0
- package/es/polygon/shaders/water/polygon_water_vert.glsl +55 -0
- package/es/raster/buffers/triangulation.js +2 -2
- package/es/raster/index.js +7 -6
- package/es/raster/models/index.js +3 -4
- package/es/raster/models/raster.js +15 -25
- package/es/raster/raster.js +9 -13
- package/es/raster/shaders/raster_2d_frag.glsl +28 -0
- package/es/raster/shaders/raster_2d_vert.glsl +18 -0
- package/es/raster/shaders/raster_frag.glsl +9 -0
- package/es/raster/shaders/raster_vert.glsl +44 -0
- package/es/tile/interface.js +1 -2
- package/es/tile/manager/tileConfigManager.js +6 -8
- package/es/tile/manager/tileLayerManager.js +19 -30
- package/es/tile/manager/tilePickerManager.js +14 -14
- package/es/tile/models/tileModel.js +6 -6
- package/es/tile/tileFactory/base.js +26 -32
- package/es/tile/tileFactory/index.js +6 -7
- package/es/tile/tileFactory/line.js +3 -9
- package/es/tile/tileFactory/point.js +3 -9
- package/es/tile/tileFactory/polygon.js +3 -9
- package/es/tile/tileFactory/raster.js +4 -10
- package/es/tile/tileFactory/rasterData.js +5 -11
- package/es/tile/tileFactory/rasterDataLayer.js +4 -5
- package/es/tile/tileFactory/vectorLayer.js +8 -9
- package/es/tile/tileLayer/baseTileLayer.js +67 -39
- package/es/tile/tmsTileLayer.js +5 -4
- package/es/tile/utils.js +5 -3
- package/es/utils/blend.js +1 -2
- package/es/utils/collision-index.js +36 -21
- package/es/utils/dataMappingStyle.js +71 -15
- package/es/utils/extrude_polyline.js +90 -48
- package/es/utils/grid-index.js +7 -21
- package/es/utils/layerData.js +41 -17
- package/es/utils/multiPassRender.js +21 -5
- package/es/utils/polylineNormal.js +40 -20
- package/es/utils/simpleLine.js +4 -6
- package/es/utils/symbol-layout.js +49 -10
- package/es/utils/updateShape.js +6 -3
- package/es/wind/index.js +5 -6
- package/es/wind/models/index.js +2 -3
- package/es/wind/models/utils.js +50 -26
- package/es/wind/models/wind.js +15 -18
- package/es/wind/models/windRender.js +89 -78
- package/es/wind/models/windShader.d.ts +6 -6
- package/es/wind/models/windShader.js +12 -7
- package/es/wind/shaders/wind_frag.glsl +9 -0
- package/es/wind/shaders/wind_vert.glsl +17 -0
- package/lib/Geometry/index.js +77 -115
- package/lib/Geometry/models/billboard.js +181 -218
- package/lib/Geometry/models/index.js +34 -19
- package/lib/Geometry/models/plane.js +278 -394
- package/lib/Geometry/models/sprite.js +189 -294
- package/lib/Geometry/shaders/billboard_frag.glsl +13 -0
- package/lib/Geometry/shaders/billboard_vert.glsl +50 -0
- package/lib/Geometry/shaders/plane_frag.glsl +22 -0
- package/lib/Geometry/shaders/plane_vert.glsl +53 -0
- package/lib/Geometry/shaders/sprite_frag.glsl +21 -0
- package/lib/Geometry/shaders/sprite_vert.glsl +28 -0
- package/lib/canvas/index.js +66 -102
- package/lib/canvas/models/canvas.js +140 -210
- package/lib/canvas/models/index.js +30 -13
- package/lib/citybuliding/building.js +63 -99
- package/lib/citybuliding/models/build.js +146 -196
- package/lib/citybuliding/shaders/build_frag.glsl +117 -0
- package/lib/citybuliding/shaders/build_vert.glsl +54 -0
- package/lib/core/BaseLayer.js +807 -1245
- package/lib/core/BaseModel.js +275 -375
- package/lib/core/interface.js +52 -20
- package/lib/core/schema.js +39 -18
- package/lib/core/shape/Path.js +78 -60
- package/lib/core/shape/extrude.js +90 -127
- package/lib/core/triangulation.js +191 -304
- package/lib/earth/index.js +62 -96
- package/lib/earth/models/atmosphere.js +112 -139
- package/lib/earth/models/base.js +150 -198
- package/lib/earth/models/bloomsphere.js +112 -139
- package/lib/earth/shaders/atmosphere_frag.glsl +17 -0
- package/lib/earth/shaders/atmosphere_vert.glsl +26 -0
- package/lib/earth/shaders/base_frag.glsl +13 -0
- package/lib/earth/shaders/base_vert.glsl +52 -0
- package/lib/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/lib/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/lib/earth/utils.js +89 -85
- package/lib/heatmap/index.js +92 -148
- package/lib/heatmap/models/grid.js +91 -113
- package/lib/heatmap/models/grid3d.js +123 -145
- package/lib/heatmap/models/heatmap.js +338 -470
- package/lib/heatmap/models/hexagon.js +92 -114
- package/lib/heatmap/models/index.js +37 -23
- package/lib/heatmap/shaders/grid_vert.glsl +42 -0
- package/lib/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/lib/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/lib/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/lib/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/lib/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/lib/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/lib/heatmap/triangulation.js +46 -30
- package/lib/image/index.js +74 -112
- package/lib/image/models/dataImage.js +173 -241
- package/lib/image/models/image.js +123 -177
- package/lib/image/models/index.js +32 -16
- package/lib/image/shaders/dataImage_frag.glsl +38 -0
- package/lib/image/shaders/image_frag.glsl +9 -0
- package/lib/image/shaders/image_vert.glsl +17 -0
- package/lib/index.js +96 -193
- package/lib/line/index.js +83 -128
- package/lib/line/models/arc.js +237 -328
- package/lib/line/models/arc_3d.js +228 -314
- package/lib/line/models/earthArc_3d.js +228 -316
- package/lib/line/models/great_circle.js +200 -279
- package/lib/line/models/half.js +201 -266
- package/lib/line/models/index.js +50 -43
- package/lib/line/models/line.js +299 -386
- package/lib/line/models/linearline.js +203 -258
- package/lib/line/models/simpleLine.js +175 -225
- package/lib/line/models/tile.js +237 -330
- package/lib/line/models/wall.js +235 -310
- package/lib/line/shaders/arc_chunks.vert.glsl +21 -0
- package/lib/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/lib/line/shaders/dash/arc_dash_vert.glsl +148 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/lib/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/lib/line/shaders/half/line_half_frag.glsl +53 -0
- package/lib/line/shaders/half/line_half_vert.glsl +169 -0
- package/lib/line/shaders/line_arc2d_vert.glsl +114 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/lib/line/shaders/line_arc_3d_vert.glsl +207 -0
- package/lib/line/shaders/line_arc_frag.glsl +89 -0
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +215 -0
- package/lib/line/shaders/line_arc_vert.glsl +174 -0
- package/lib/line/shaders/line_bezier_vert.glsl +85 -0
- package/lib/line/shaders/line_frag.glsl +100 -0
- package/lib/line/shaders/line_vert.glsl +192 -0
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
- package/lib/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/lib/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/lib/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/lib/line/shaders/simple/simpleline_vert.glsl +78 -0
- package/lib/line/shaders/tile/line_tile_frag.glsl +79 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +210 -0
- package/lib/line/shaders/wall_frag.glsl +93 -0
- package/lib/line/shaders/wall_vert.glsl +111 -0
- package/lib/mask/index.js +59 -93
- package/lib/mask/models/fill.js +82 -132
- package/lib/mask/models/index.js +30 -13
- package/lib/mask/shaders/mask_frag.glsl +7 -0
- package/lib/mask/shaders/mask_vert.glsl +22 -0
- package/lib/plugins/DataMappingPlugin.js +222 -304
- package/lib/plugins/DataSourcePlugin.js +87 -100
- package/lib/plugins/FeatureScalePlugin.js +239 -310
- package/lib/plugins/LayerAnimateStylePlugin.js +55 -61
- package/lib/plugins/LayerModelPlugin.js +72 -70
- package/lib/plugins/LayerStylePlugin.js +51 -44
- package/lib/plugins/LightingPlugin.js +68 -72
- package/lib/plugins/MultiPassRendererPlugin.js +65 -77
- package/lib/plugins/PixelPickingPlugin.js +109 -128
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -103
- package/lib/plugins/ShaderUniformPlugin.js +98 -103
- package/lib/plugins/UpdateModelPlugin.js +47 -36
- package/lib/plugins/UpdateStyleAttributePlugin.js +75 -80
- package/lib/point/index.js +147 -216
- package/lib/point/models/earthExtrude.js +201 -262
- package/lib/point/models/earthFill.js +202 -276
- package/lib/point/models/extrude.js +203 -282
- package/lib/point/models/fill.js +273 -369
- package/lib/point/models/fillmage.js +250 -327
- package/lib/point/models/image.js +163 -226
- package/lib/point/models/index.js +52 -46
- package/lib/point/models/normal.js +134 -176
- package/lib/point/models/radar.js +212 -286
- package/lib/point/models/simplePoint.js +142 -187
- package/lib/point/models/text.js +385 -559
- package/lib/point/models/tile.js +223 -294
- package/lib/point/shaders/animate/wave_frag.glsl +65 -0
- package/lib/point/shaders/earth/extrude_frag.glsl +44 -0
- package/lib/point/shaders/earth/extrude_vert.glsl +140 -0
- package/lib/point/shaders/earth/fill_frag.glsl +86 -0
- package/lib/point/shaders/earth/fill_vert.glsl +126 -0
- package/lib/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/lib/point/shaders/fill_frag.glsl +84 -0
- package/lib/point/shaders/fill_vert.glsl +182 -0
- package/lib/point/shaders/image/fillImage_frag.glsl +20 -0
- package/lib/point/shaders/image/fillImage_vert.glsl +108 -0
- package/lib/point/shaders/image_frag.glsl +39 -0
- package/lib/point/shaders/image_vert.glsl +81 -0
- package/lib/point/shaders/normal_frag.glsl +15 -0
- package/lib/point/shaders/normal_vert.glsl +79 -0
- package/lib/point/shaders/radar/radar_frag.glsl +64 -0
- package/lib/point/shaders/radar/radar_vert.glsl +120 -0
- package/lib/point/shaders/simplePoint_frag.glsl +53 -0
- package/lib/point/shaders/simplePoint_vert.glsl +79 -0
- package/lib/point/shaders/text_frag.glsl +48 -0
- package/lib/point/shaders/text_vert.glsl +131 -0
- package/lib/point/shaders/tile/fill_tile_frag.glsl +83 -0
- package/lib/point/shaders/tile/fill_tile_vert.glsl +181 -0
- package/lib/point/shape/extrude.js +51 -51
- package/lib/polygon/index.js +100 -149
- package/lib/polygon/models/extrude.js +222 -303
- package/lib/polygon/models/fill.js +153 -205
- package/lib/polygon/models/index.js +52 -46
- package/lib/polygon/models/ocean.js +172 -251
- package/lib/polygon/models/tile.js +100 -139
- package/lib/polygon/models/water.js +152 -227
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/lib/polygon/shaders/polygon_frag.glsl +12 -0
- package/lib/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/lib/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/lib/polygon/shaders/polygon_vert.glsl +66 -0
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +73 -0
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +55 -0
- package/lib/raster/buffers/triangulation.js +39 -26
- package/lib/raster/index.js +73 -111
- package/lib/raster/models/index.js +33 -17
- package/lib/raster/models/raster.js +134 -187
- package/lib/raster/raster.js +132 -189
- package/lib/raster/shaders/raster_2d_frag.glsl +28 -0
- package/lib/raster/shaders/raster_2d_vert.glsl +18 -0
- package/lib/raster/shaders/raster_frag.glsl +9 -0
- package/lib/raster/shaders/raster_vert.glsl +44 -0
- package/lib/tile/interface.js +17 -2
- package/lib/tile/manager/tileConfigManager.js +86 -126
- package/lib/tile/manager/tileLayerManager.js +227 -312
- package/lib/tile/manager/tilePickerManager.js +123 -187
- package/lib/tile/models/tileModel.js +51 -70
- package/lib/tile/tileFactory/base.js +292 -403
- package/lib/tile/tileFactory/index.js +48 -51
- package/lib/tile/tileFactory/line.js +50 -71
- package/lib/tile/tileFactory/point.js +50 -71
- package/lib/tile/tileFactory/polygon.js +50 -71
- package/lib/tile/tileFactory/raster.js +54 -72
- package/lib/tile/tileFactory/rasterData.js +76 -94
- package/lib/tile/tileFactory/rasterDataLayer.js +62 -98
- package/lib/tile/tileFactory/vectorLayer.js +95 -148
- package/lib/tile/tileLayer/baseTileLayer.js +220 -380
- package/lib/tile/tmsTileLayer.js +67 -109
- package/lib/tile/utils.js +86 -101
- package/lib/utils/blend.js +79 -60
- package/lib/utils/collision-index.js +63 -83
- package/lib/utils/dataMappingStyle.js +59 -56
- package/lib/utils/extrude_polyline.js +397 -554
- package/lib/utils/grid-index.js +111 -168
- package/lib/utils/layerData.js +88 -95
- package/lib/utils/multiPassRender.js +38 -31
- package/lib/utils/polylineNormal.js +86 -118
- package/lib/utils/simpleLine.js +85 -101
- package/lib/utils/symbol-layout.js +109 -173
- package/lib/utils/updateShape.js +40 -11
- package/lib/wind/index.js +71 -110
- package/lib/wind/models/index.js +30 -13
- package/lib/wind/models/utils.js +89 -104
- package/lib/wind/models/wind.js +224 -332
- package/lib/wind/models/windRender.js +215 -293
- package/lib/wind/models/windShader.js +181 -17
- package/lib/wind/shaders/wind_frag.glsl +9 -0
- package/lib/wind/shaders/wind_vert.glsl +17 -0
- package/package.json +11 -9
- package/es/Geometry/index.js.map +0 -1
- package/es/Geometry/models/billboard.js.map +0 -1
- package/es/Geometry/models/index.js.map +0 -1
- package/es/Geometry/models/plane.js.map +0 -1
- package/es/Geometry/models/sprite.js.map +0 -1
- package/es/canvas/index.js.map +0 -1
- package/es/canvas/models/canvas.js.map +0 -1
- package/es/canvas/models/index.js.map +0 -1
- package/es/citybuliding/building.js.map +0 -1
- package/es/citybuliding/models/build.js.map +0 -1
- package/es/core/BaseLayer.js.map +0 -1
- package/es/core/BaseModel.js.map +0 -1
- package/es/core/interface.js.map +0 -1
- package/es/core/schema.js.map +0 -1
- package/es/core/shape/Path.js.map +0 -1
- package/es/core/shape/extrude.js.map +0 -1
- package/es/core/triangulation.js.map +0 -1
- package/es/earth/index.js.map +0 -1
- package/es/earth/models/atmosphere.js.map +0 -1
- package/es/earth/models/base.js.map +0 -1
- package/es/earth/models/bloomsphere.js.map +0 -1
- package/es/earth/utils.js.map +0 -1
- package/es/glsl.d.js +0 -2
- package/es/glsl.d.js.map +0 -1
- package/es/heatmap/index.js.map +0 -1
- package/es/heatmap/models/grid.js.map +0 -1
- package/es/heatmap/models/grid3d.js.map +0 -1
- package/es/heatmap/models/heatmap.js.map +0 -1
- package/es/heatmap/models/hexagon.js.map +0 -1
- package/es/heatmap/models/index.js.map +0 -1
- package/es/heatmap/triangulation.js.map +0 -1
- package/es/image/index.js.map +0 -1
- package/es/image/models/dataImage.js.map +0 -1
- package/es/image/models/image.js.map +0 -1
- package/es/image/models/index.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/line/index.js.map +0 -1
- package/es/line/models/arc.js.map +0 -1
- package/es/line/models/arc_3d.js.map +0 -1
- package/es/line/models/earthArc_3d.js.map +0 -1
- package/es/line/models/great_circle.js.map +0 -1
- package/es/line/models/half.js.map +0 -1
- package/es/line/models/index.js.map +0 -1
- package/es/line/models/line.js.map +0 -1
- package/es/line/models/linearline.js.map +0 -1
- package/es/line/models/simpleLine.js.map +0 -1
- package/es/line/models/tile.js.map +0 -1
- package/es/line/models/wall.js.map +0 -1
- package/es/mask/index.js.map +0 -1
- package/es/mask/models/fill.js.map +0 -1
- package/es/mask/models/index.js.map +0 -1
- package/es/plugins/DataMappingPlugin.js.map +0 -1
- package/es/plugins/DataSourcePlugin.js.map +0 -1
- package/es/plugins/FeatureScalePlugin.js.map +0 -1
- package/es/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/es/plugins/LayerModelPlugin.js.map +0 -1
- package/es/plugins/LayerStylePlugin.js.map +0 -1
- package/es/plugins/LightingPlugin.js.map +0 -1
- package/es/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/es/plugins/PixelPickingPlugin.js.map +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/es/plugins/ShaderUniformPlugin.js.map +0 -1
- package/es/plugins/UpdateModelPlugin.js.map +0 -1
- package/es/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/es/point/index.js.map +0 -1
- package/es/point/models/earthExtrude.js.map +0 -1
- package/es/point/models/earthFill.js.map +0 -1
- package/es/point/models/extrude.js.map +0 -1
- package/es/point/models/fill.js.map +0 -1
- package/es/point/models/fillmage.js.map +0 -1
- package/es/point/models/image.js.map +0 -1
- package/es/point/models/index.js.map +0 -1
- package/es/point/models/normal.js.map +0 -1
- package/es/point/models/radar.js.map +0 -1
- package/es/point/models/simplePoint.js.map +0 -1
- package/es/point/models/text.js.map +0 -1
- package/es/point/models/tile.js.map +0 -1
- package/es/point/shape/extrude.js.map +0 -1
- package/es/polygon/index.js.map +0 -1
- package/es/polygon/models/extrude.js.map +0 -1
- package/es/polygon/models/fill.js.map +0 -1
- package/es/polygon/models/index.js.map +0 -1
- package/es/polygon/models/ocean.js.map +0 -1
- package/es/polygon/models/tile.js.map +0 -1
- package/es/polygon/models/water.js.map +0 -1
- package/es/raster/buffers/triangulation.js.map +0 -1
- package/es/raster/index.js.map +0 -1
- package/es/raster/models/index.js.map +0 -1
- package/es/raster/models/raster.js.map +0 -1
- package/es/raster/raster.js.map +0 -1
- package/es/tile/interface.js.map +0 -1
- package/es/tile/manager/tileConfigManager.js.map +0 -1
- package/es/tile/manager/tileLayerManager.js.map +0 -1
- package/es/tile/manager/tilePickerManager.js.map +0 -1
- package/es/tile/models/tileModel.js.map +0 -1
- package/es/tile/tileFactory/base.js.map +0 -1
- package/es/tile/tileFactory/index.js.map +0 -1
- package/es/tile/tileFactory/line.js.map +0 -1
- package/es/tile/tileFactory/point.js.map +0 -1
- package/es/tile/tileFactory/polygon.js.map +0 -1
- package/es/tile/tileFactory/raster.js.map +0 -1
- package/es/tile/tileFactory/rasterData.js.map +0 -1
- package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/es/tile/tileFactory/vectorLayer.js.map +0 -1
- package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/es/tile/tmsTileLayer.js.map +0 -1
- package/es/tile/utils.js.map +0 -1
- package/es/utils/blend.js.map +0 -1
- package/es/utils/collision-index.js.map +0 -1
- package/es/utils/dataMappingStyle.js.map +0 -1
- package/es/utils/extrude_polyline.js.map +0 -1
- package/es/utils/grid-index.js.map +0 -1
- package/es/utils/layerData.js.map +0 -1
- package/es/utils/multiPassRender.js.map +0 -1
- package/es/utils/polylineNormal.js.map +0 -1
- package/es/utils/simpleLine.js.map +0 -1
- package/es/utils/symbol-layout.js.map +0 -1
- package/es/utils/updateShape.js.map +0 -1
- package/es/wind/index.js.map +0 -1
- package/es/wind/models/index.js.map +0 -1
- package/es/wind/models/utils.js.map +0 -1
- package/es/wind/models/wind.js.map +0 -1
- package/es/wind/models/windRender.js.map +0 -1
- package/es/wind/models/windShader.js.map +0 -1
- package/lib/Geometry/index.js.map +0 -1
- package/lib/Geometry/models/billboard.js.map +0 -1
- package/lib/Geometry/models/index.js.map +0 -1
- package/lib/Geometry/models/plane.js.map +0 -1
- package/lib/Geometry/models/sprite.js.map +0 -1
- package/lib/canvas/index.js.map +0 -1
- package/lib/canvas/models/canvas.js.map +0 -1
- package/lib/canvas/models/index.js.map +0 -1
- package/lib/citybuliding/building.js.map +0 -1
- package/lib/citybuliding/models/build.js.map +0 -1
- package/lib/core/BaseLayer.js.map +0 -1
- package/lib/core/BaseModel.js.map +0 -1
- package/lib/core/interface.js.map +0 -1
- package/lib/core/schema.js.map +0 -1
- package/lib/core/shape/Path.js.map +0 -1
- package/lib/core/shape/extrude.js.map +0 -1
- package/lib/core/triangulation.js.map +0 -1
- package/lib/earth/index.js.map +0 -1
- package/lib/earth/models/atmosphere.js.map +0 -1
- package/lib/earth/models/base.js.map +0 -1
- package/lib/earth/models/bloomsphere.js.map +0 -1
- package/lib/earth/utils.js.map +0 -1
- package/lib/glsl.d.js +0 -2
- package/lib/glsl.d.js.map +0 -1
- package/lib/heatmap/index.js.map +0 -1
- package/lib/heatmap/models/grid.js.map +0 -1
- package/lib/heatmap/models/grid3d.js.map +0 -1
- package/lib/heatmap/models/heatmap.js.map +0 -1
- package/lib/heatmap/models/hexagon.js.map +0 -1
- package/lib/heatmap/models/index.js.map +0 -1
- package/lib/heatmap/triangulation.js.map +0 -1
- package/lib/image/index.js.map +0 -1
- package/lib/image/models/dataImage.js.map +0 -1
- package/lib/image/models/image.js.map +0 -1
- package/lib/image/models/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/line/index.js.map +0 -1
- package/lib/line/models/arc.js.map +0 -1
- package/lib/line/models/arc_3d.js.map +0 -1
- package/lib/line/models/earthArc_3d.js.map +0 -1
- package/lib/line/models/great_circle.js.map +0 -1
- package/lib/line/models/half.js.map +0 -1
- package/lib/line/models/index.js.map +0 -1
- package/lib/line/models/line.js.map +0 -1
- package/lib/line/models/linearline.js.map +0 -1
- package/lib/line/models/simpleLine.js.map +0 -1
- package/lib/line/models/tile.js.map +0 -1
- package/lib/line/models/wall.js.map +0 -1
- package/lib/mask/index.js.map +0 -1
- package/lib/mask/models/fill.js.map +0 -1
- package/lib/mask/models/index.js.map +0 -1
- package/lib/plugins/DataMappingPlugin.js.map +0 -1
- package/lib/plugins/DataSourcePlugin.js.map +0 -1
- package/lib/plugins/FeatureScalePlugin.js.map +0 -1
- package/lib/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/lib/plugins/LayerModelPlugin.js.map +0 -1
- package/lib/plugins/LayerStylePlugin.js.map +0 -1
- package/lib/plugins/LightingPlugin.js.map +0 -1
- package/lib/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/lib/plugins/PixelPickingPlugin.js.map +0 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +0 -1
- package/lib/plugins/UpdateModelPlugin.js.map +0 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/lib/point/index.js.map +0 -1
- package/lib/point/models/earthExtrude.js.map +0 -1
- package/lib/point/models/earthFill.js.map +0 -1
- package/lib/point/models/extrude.js.map +0 -1
- package/lib/point/models/fill.js.map +0 -1
- package/lib/point/models/fillmage.js.map +0 -1
- package/lib/point/models/image.js.map +0 -1
- package/lib/point/models/index.js.map +0 -1
- package/lib/point/models/normal.js.map +0 -1
- package/lib/point/models/radar.js.map +0 -1
- package/lib/point/models/simplePoint.js.map +0 -1
- package/lib/point/models/text.js.map +0 -1
- package/lib/point/models/tile.js.map +0 -1
- package/lib/point/shape/extrude.js.map +0 -1
- package/lib/polygon/index.js.map +0 -1
- package/lib/polygon/models/extrude.js.map +0 -1
- package/lib/polygon/models/fill.js.map +0 -1
- package/lib/polygon/models/index.js.map +0 -1
- package/lib/polygon/models/ocean.js.map +0 -1
- package/lib/polygon/models/tile.js.map +0 -1
- package/lib/polygon/models/water.js.map +0 -1
- package/lib/raster/buffers/triangulation.js.map +0 -1
- package/lib/raster/index.js.map +0 -1
- package/lib/raster/models/index.js.map +0 -1
- package/lib/raster/models/raster.js.map +0 -1
- package/lib/raster/raster.js.map +0 -1
- package/lib/tile/interface.js.map +0 -1
- package/lib/tile/manager/tileConfigManager.js.map +0 -1
- package/lib/tile/manager/tileLayerManager.js.map +0 -1
- package/lib/tile/manager/tilePickerManager.js.map +0 -1
- package/lib/tile/models/tileModel.js.map +0 -1
- package/lib/tile/tileFactory/base.js.map +0 -1
- package/lib/tile/tileFactory/index.js.map +0 -1
- package/lib/tile/tileFactory/line.js.map +0 -1
- package/lib/tile/tileFactory/point.js.map +0 -1
- package/lib/tile/tileFactory/polygon.js.map +0 -1
- package/lib/tile/tileFactory/raster.js.map +0 -1
- package/lib/tile/tileFactory/rasterData.js.map +0 -1
- package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
- package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/lib/tile/tmsTileLayer.js.map +0 -1
- package/lib/tile/utils.js.map +0 -1
- package/lib/utils/blend.js.map +0 -1
- package/lib/utils/collision-index.js.map +0 -1
- package/lib/utils/dataMappingStyle.js.map +0 -1
- package/lib/utils/extrude_polyline.js.map +0 -1
- package/lib/utils/grid-index.js.map +0 -1
- package/lib/utils/layerData.js.map +0 -1
- package/lib/utils/multiPassRender.js.map +0 -1
- package/lib/utils/polylineNormal.js.map +0 -1
- package/lib/utils/simpleLine.js.map +0 -1
- package/lib/utils/symbol-layout.js.map +0 -1
- package/lib/utils/updateShape.js.map +0 -1
- package/lib/wind/index.js.map +0 -1
- package/lib/wind/models/index.js.map +0 -1
- package/lib/wind/models/utils.js.map +0 -1
- package/lib/wind/models/wind.js.map +0 -1
- package/lib/wind/models/windRender.js.map +0 -1
- package/lib/wind/models/windShader.js.map +0 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import earcut from 'earcut';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
6
|
+
* @param paths 路径数据组
|
|
7
|
+
* @param extrude 是否拉伸
|
|
8
|
+
*/
|
|
3
9
|
export default function extrudePolygon(path) {
|
|
4
10
|
var p1 = path[0][0];
|
|
5
11
|
var p2 = path[0][path[0].length - 1];
|
|
@@ -12,7 +18,7 @@ export default function extrudePolygon(path) {
|
|
|
12
18
|
var flattengeo = earcut.flatten(path);
|
|
13
19
|
var positions = [];
|
|
14
20
|
var indexArray = [];
|
|
15
|
-
var normals = [];
|
|
21
|
+
var normals = []; // 设置顶部z值
|
|
16
22
|
|
|
17
23
|
for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
|
|
18
24
|
flattengeo.vertices[j * 3 + 2] = 1;
|
|
@@ -54,5 +60,4 @@ export function fillPolygon(points) {
|
|
|
54
60
|
positions: flattengeo.vertices,
|
|
55
61
|
index: triangles
|
|
56
62
|
};
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=extrude.js.map
|
|
63
|
+
}
|
package/es/polygon/index.js
CHANGED
|
@@ -10,10 +10,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
11
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; } }
|
|
12
12
|
|
|
13
|
-
import BaseLayer from
|
|
14
|
-
import PolygonModels from
|
|
13
|
+
import BaseLayer from "../core/BaseLayer";
|
|
14
|
+
import PolygonModels from "./models/";
|
|
15
15
|
|
|
16
|
-
var PolygonLayer = function (_BaseLayer) {
|
|
16
|
+
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
17
|
_inherits(PolygonLayer, _BaseLayer);
|
|
18
18
|
|
|
19
19
|
var _super = _createSuper(PolygonLayer);
|
|
@@ -100,6 +100,8 @@ var PolygonLayer = function (_BaseLayer) {
|
|
|
100
100
|
}, {
|
|
101
101
|
key: "getPointModelType",
|
|
102
102
|
value: function getPointModelType() {
|
|
103
|
+
// pointlayer
|
|
104
|
+
// 2D、 3d、 shape、image、text、normal、
|
|
103
105
|
var layerData = this.getEncodedData();
|
|
104
106
|
|
|
105
107
|
var _this$getLayerConfig = this.getLayerConfig(),
|
|
@@ -140,5 +142,4 @@ var PolygonLayer = function (_BaseLayer) {
|
|
|
140
142
|
return PolygonLayer;
|
|
141
143
|
}(BaseLayer);
|
|
142
144
|
|
|
143
|
-
export { PolygonLayer as default };
|
|
144
|
-
//# sourceMappingURL=index.js.map
|
|
145
|
+
export { PolygonLayer as default };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import _isNumber from "lodash/isNumber";
|
|
10
7
|
|
|
11
8
|
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
9
|
|
|
@@ -14,34 +11,37 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
11
|
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
14
|
+
import { isNumber } from 'lodash';
|
|
15
|
+
import BaseModel from "../../core/BaseModel";
|
|
16
|
+
import { PolygonExtrudeTriangulation } from "../../core/triangulation";
|
|
17
|
+
|
|
18
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
19
|
+
var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // extrude
|
|
20
|
+
|
|
21
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
20
22
|
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
25
|
+
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float lightWeight = styleMappingMat[3][1];\n float topU = styleMappingMat[2][2];\n float topV = styleMappingMat[2][3];\n\n float sidey = styleMappingMat[3][0];\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
|
|
26
|
+
|
|
27
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
|
|
28
|
+
var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n v_Color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n \n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[2][2] = a_uvs[0];\n styleMappingMat[2][3] = 1.0 - a_uvs[1];\n styleMappingMat[3][0] = a_uvs[2];\n\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
|
|
29
|
+
|
|
30
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
|
|
23
31
|
var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n if(isSide < 1.0) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
|
|
32
|
+
|
|
33
|
+
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
24
34
|
var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
25
35
|
|
|
26
|
-
var ExtrudeModel = function (_BaseModel) {
|
|
36
|
+
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
37
|
_inherits(ExtrudeModel, _BaseModel);
|
|
28
38
|
|
|
29
39
|
var _super = _createSuper(ExtrudeModel);
|
|
30
40
|
|
|
31
41
|
function ExtrudeModel() {
|
|
32
|
-
var _this;
|
|
33
|
-
|
|
34
42
|
_classCallCheck(this, ExtrudeModel);
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
args[_key] = arguments[_key];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
43
|
-
|
|
44
|
-
return _this;
|
|
44
|
+
return _super.apply(this, arguments);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
_createClass(ExtrudeModel, [{
|
|
@@ -74,7 +74,8 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
74
74
|
width = _this$calDataFrame.width,
|
|
75
75
|
height = _this$calDataFrame.height;
|
|
76
76
|
|
|
77
|
-
this.rowCount = height;
|
|
77
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
78
|
+
|
|
78
79
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
79
80
|
flipY: true,
|
|
80
81
|
data: data,
|
|
@@ -90,9 +91,11 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
90
91
|
width: 1,
|
|
91
92
|
height: 1
|
|
92
93
|
});
|
|
93
|
-
}
|
|
94
|
+
} // 转化渐变色
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var useLinearColor = 0; // 默认不生效
|
|
94
98
|
|
|
95
|
-
var useLinearColor = 0;
|
|
96
99
|
var sourceColorArr = [1, 1, 1, 1];
|
|
97
100
|
var targetColorArr = [1, 1, 1, 1];
|
|
98
101
|
|
|
@@ -103,13 +106,16 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
return {
|
|
109
|
+
// 控制侧面和顶面的显示隐藏
|
|
106
110
|
u_topsurface: Number(topsurface),
|
|
107
111
|
u_sidesurface: Number(sidesurface),
|
|
108
112
|
u_heightfixed: Number(heightfixed),
|
|
109
113
|
u_dataTexture: this.dataTexture,
|
|
114
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
110
115
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
111
116
|
u_raisingHeight: Number(raisingHeight),
|
|
112
|
-
u_opacity:
|
|
117
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
118
|
+
// 渐变色支持参数
|
|
113
119
|
u_linearColor: useLinearColor,
|
|
114
120
|
u_sourceColor: sourceColorArr,
|
|
115
121
|
u_targetColor: targetColorArr,
|
|
@@ -205,6 +211,7 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
205
211
|
descriptor: {
|
|
206
212
|
name: 'a_uvs',
|
|
207
213
|
buffer: {
|
|
214
|
+
// give the WebGL driver a hint that this buffer may change
|
|
208
215
|
usage: gl.STATIC_DRAW,
|
|
209
216
|
data: [],
|
|
210
217
|
type: gl.FLOAT
|
|
@@ -216,13 +223,15 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
216
223
|
return [(lng - minLng) / lngLen, (lat - minLat) / latLen, vertex[4]];
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
|
-
});
|
|
226
|
+
}); // point layer size;
|
|
227
|
+
|
|
220
228
|
this.styleAttributeService.registerStyleAttribute({
|
|
221
229
|
name: 'normal',
|
|
222
230
|
type: AttributeType.Attribute,
|
|
223
231
|
descriptor: {
|
|
224
232
|
name: 'a_Normal',
|
|
225
233
|
buffer: {
|
|
234
|
+
// give the WebGL driver a hint that this buffer may change
|
|
226
235
|
usage: gl.STATIC_DRAW,
|
|
227
236
|
data: [],
|
|
228
237
|
type: gl.FLOAT
|
|
@@ -239,6 +248,7 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
239
248
|
descriptor: {
|
|
240
249
|
name: 'a_Size',
|
|
241
250
|
buffer: {
|
|
251
|
+
// give the WebGL driver a hint that this buffer may change
|
|
242
252
|
usage: gl.DYNAMIC_DRAW,
|
|
243
253
|
data: [],
|
|
244
254
|
type: gl.FLOAT
|
|
@@ -255,7 +265,7 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
255
265
|
}, {
|
|
256
266
|
key: "loadTexture",
|
|
257
267
|
value: function loadTexture() {
|
|
258
|
-
var
|
|
268
|
+
var _this = this;
|
|
259
269
|
|
|
260
270
|
var _ref4 = this.layer.getLayerConfig(),
|
|
261
271
|
mapTexture = _ref4.mapTexture;
|
|
@@ -272,7 +282,7 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
272
282
|
image.src = mapTexture;
|
|
273
283
|
|
|
274
284
|
image.onload = function () {
|
|
275
|
-
|
|
285
|
+
_this.texture = createTexture2D({
|
|
276
286
|
data: image,
|
|
277
287
|
width: image.width,
|
|
278
288
|
height: image.height,
|
|
@@ -282,9 +292,9 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
282
292
|
mag: gl.LINEAR
|
|
283
293
|
});
|
|
284
294
|
|
|
285
|
-
|
|
295
|
+
_this.layerService.updateLayerRenderList();
|
|
286
296
|
|
|
287
|
-
|
|
297
|
+
_this.layerService.renderLayers();
|
|
288
298
|
};
|
|
289
299
|
}
|
|
290
300
|
}
|
|
@@ -293,5 +303,4 @@ var ExtrudeModel = function (_BaseModel) {
|
|
|
293
303
|
return ExtrudeModel;
|
|
294
304
|
}(BaseModel);
|
|
295
305
|
|
|
296
|
-
export { ExtrudeModel as default };
|
|
297
|
-
//# sourceMappingURL=extrude.js.map
|
|
306
|
+
export { ExtrudeModel as default };
|
|
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _isNumber from "lodash/isNumber";
|
|
7
6
|
|
|
8
7
|
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); }; }
|
|
9
8
|
|
|
@@ -11,14 +10,23 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
10
|
|
|
12
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
12
|
import { getMask, polygonFillTriangulation } from '@antv/l7-utils';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import { isNumber } from 'lodash';
|
|
14
|
+
import BaseModel from "../../core/BaseModel";
|
|
15
|
+
import { polygonTriangulationWithCenter } from "../../core/triangulation";
|
|
16
|
+
|
|
17
|
+
/* babel-plugin-inline-import '../shaders/polygon_frag.glsl' */
|
|
16
18
|
var polygon_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
19
|
+
|
|
20
|
+
/* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
|
|
17
21
|
var polygon_linear_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n \n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
22
|
+
|
|
23
|
+
/* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
|
|
18
24
|
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n \n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}";
|
|
25
|
+
|
|
26
|
+
/* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
|
|
19
27
|
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
20
28
|
|
|
21
|
-
var FillModel = function (_BaseModel) {
|
|
29
|
+
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
22
30
|
_inherits(FillModel, _BaseModel);
|
|
23
31
|
|
|
24
32
|
var _super = _createSuper(FillModel);
|
|
@@ -56,7 +64,8 @@ var FillModel = function (_BaseModel) {
|
|
|
56
64
|
width = _this$calDataFrame.width,
|
|
57
65
|
height = _this$calDataFrame.height;
|
|
58
66
|
|
|
59
|
-
this.rowCount = height;
|
|
67
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
68
|
+
|
|
60
69
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
61
70
|
flipY: true,
|
|
62
71
|
data: data,
|
|
@@ -76,9 +85,10 @@ var FillModel = function (_BaseModel) {
|
|
|
76
85
|
|
|
77
86
|
return {
|
|
78
87
|
u_dataTexture: this.dataTexture,
|
|
88
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
79
89
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
80
90
|
u_raisingHeight: Number(raisingHeight),
|
|
81
|
-
u_opacity:
|
|
91
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
82
92
|
u_opacitylinear: Number(opacityLinear.enable),
|
|
83
93
|
u_dir: opacityLinear.dir === 'in' ? 1.0 : 0.0
|
|
84
94
|
};
|
|
@@ -154,12 +164,14 @@ var FillModel = function (_BaseModel) {
|
|
|
154
164
|
descriptor: {
|
|
155
165
|
name: 'a_linear',
|
|
156
166
|
buffer: {
|
|
167
|
+
// give the WebGL driver a hint that this buffer may change
|
|
157
168
|
usage: gl.STATIC_DRAW,
|
|
158
169
|
data: [],
|
|
159
170
|
type: gl.FLOAT
|
|
160
171
|
},
|
|
161
172
|
size: 3,
|
|
162
173
|
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
174
|
+
// center[0] center[1] radius
|
|
163
175
|
return [vertex[3], vertex[4], vertex[5]];
|
|
164
176
|
}
|
|
165
177
|
}
|
|
@@ -196,5 +208,4 @@ var FillModel = function (_BaseModel) {
|
|
|
196
208
|
return FillModel;
|
|
197
209
|
}(BaseModel);
|
|
198
210
|
|
|
199
|
-
export { FillModel as default };
|
|
200
|
-
//# sourceMappingURL=fill.js.map
|
|
211
|
+
export { FillModel as default };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import LineModel from
|
|
2
|
-
import PointExtrudeModel from
|
|
3
|
-
import PointFillModel from
|
|
4
|
-
import IMageModel from
|
|
5
|
-
import NormalModel from
|
|
6
|
-
import TextModel from
|
|
7
|
-
import PolygonTileModel from
|
|
8
|
-
import ExtrudeModel from
|
|
9
|
-
import FillModel from
|
|
10
|
-
import Ocean from
|
|
11
|
-
import TilePolygonModel from
|
|
12
|
-
import Water from
|
|
1
|
+
import LineModel from "../../line/models/line";
|
|
2
|
+
import PointExtrudeModel from "../../point/models/extrude";
|
|
3
|
+
import PointFillModel from "../../point/models/fill";
|
|
4
|
+
import IMageModel from "../../point/models/image";
|
|
5
|
+
import NormalModel from "../../point/models/normal";
|
|
6
|
+
import TextModel from "../../point/models/text";
|
|
7
|
+
import PolygonTileModel from "../../tile/models/tileModel";
|
|
8
|
+
import ExtrudeModel from "./extrude";
|
|
9
|
+
import FillModel from "./fill";
|
|
10
|
+
import Ocean from "./ocean";
|
|
11
|
+
import TilePolygonModel from "./tile";
|
|
12
|
+
import Water from "./water";
|
|
13
13
|
var PolygonModels = {
|
|
14
14
|
fill: FillModel,
|
|
15
15
|
line: LineModel,
|
|
@@ -21,8 +21,8 @@ var PolygonModels = {
|
|
|
21
21
|
point_extrude: PointExtrudeModel,
|
|
22
22
|
water: Water,
|
|
23
23
|
ocean: Ocean,
|
|
24
|
+
// point_fill: PointModels.fill,
|
|
24
25
|
vectorpolygon: PolygonTileModel,
|
|
25
26
|
tile: TilePolygonModel
|
|
26
27
|
};
|
|
27
|
-
export default PolygonModels;
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
28
|
+
export default PolygonModels;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import _isNumber from "lodash/isNumber";
|
|
10
7
|
|
|
11
8
|
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
9
|
|
|
@@ -14,34 +11,25 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
11
|
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
14
|
+
import { isNumber } from 'lodash';
|
|
15
|
+
import BaseModel from "../../core/BaseModel";
|
|
16
|
+
import { polygonTriangulation } from "../../core/triangulation";
|
|
17
|
+
|
|
18
|
+
/* babel-plugin-inline-import '../shaders/water/polygon_ocean_frag.glsl' */
|
|
19
19
|
var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nfloat coast2water_fadedepth = 0.10;\nfloat large_waveheight = .750; // change to adjust the \"heavy\" waves\nfloat large_wavesize = 3.4; // factor to adjust the large wave size\nfloat small_waveheight = 0.6; // change to adjust the small random waves\nfloat small_wavesize = 0.5; // factor to ajust the small wave size\nfloat water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)\nfloat water_glossylight_fact= 120.; // range [1..200]\nfloat particle_amount = 70.;\n// vec3 watercolor = vec3(0.43, 0.60, 0.66); // 'transparent' low-water color (RGB)\n// vec3 watercolor2 = vec3(0.06, 0.07, 0.11); // deep-water color (RGB, should be darker than the low-water color)\nuniform vec4 u_watercolor;\nuniform vec4 u_watercolor2;\nvec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights\n#define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun\n\nuniform sampler2D u_texture1;\nuniform sampler2D u_texture2;\nuniform sampler2D u_texture3;\n\n \n\nfloat hash( float n ) {\n return fract(sin(n)*43758.5453123);\n}\n\n// 2d noise function\nfloat noise1( in vec2 x ) {\n vec2 p = floor(x);\n vec2 f = smoothstep(0.0, 1.0, fract(x));\n float n = p.x + p.y*57.0;\n return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),\n mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);\n}\n\nfloat noise(vec2 p) {\n return texture2D(u_texture2,p*vec2(1./256.)).x;\n}\n\nvec4 highness(vec2 p) {\n vec4 t = texture2D(u_texture1,fract(p));\n float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;\n return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);\n}\n\nfloat height_map( vec2 p ) {\n vec4 height=highness(p);\n /*\n height = -0.5+\n 0.5*smoothstep(-100.,0.,-height)+\n 2.75*smoothstep(0.,2.,height)+\n 1.75*smoothstep(2.,4.,height)+\n 2.75*smoothstep(4.,16.,height)+\n 1.5*smoothstep(16.,1000.,height);\n */\n\n mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );\n //p = p*6.;\n float f = 0.6000*noise1( p ); p = m*p*1.1*6.;\n f += 0.2500*noise( p ); p = m*p*1.32;\n f += 0.1666*noise( p ); p = m*p*1.11;\n f += 0.0834*noise( p ); p = m*p*1.12;\n f += 0.0634*noise( p ); p = m*p*1.13;\n f += 0.0444*noise( p ); p = m*p*1.14;\n f += 0.0274*noise( p ); p = m*p*1.15;\n f += 0.0134*noise( p ); p = m*p*1.16;\n f += 0.0104*noise( p ); p = m*p*1.17;\n f += 0.0084*noise( p );\n f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;\n const float FLAT_LEVEL = 0.92525;\n //f = f*0.25+height*0.75;\n if (f<FLAT_LEVEL)\n f = f;\n else\n f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase\n return clamp(f, 0., 10.);\n}\n\nvec3 plasma_quintic( float x ) {\n x = clamp( x, 0.0, 1.0);\n vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3\n vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7\n return vec3(\n dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),\n dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),\n dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );\n}\n\nvec4 color(vec2 p){\n vec4 c1 = vec4(1.7,1.6,.9,1);\n vec4 c2 = vec4(.2,.94,.1,1);\n vec4 c3 = vec4(.3,.2,.0,1);\n vec4 c4 = vec4(.99,.99,1.6,1);\n vec4 v = highness(p);\n float los = smoothstep(0.1,1.1,v.b);\n float his = smoothstep(3.5,6.5,v.b);\n float ces = smoothstep(1.,5.,v.a);\n vec4 lo = mix(c1,c2,los);\n vec4 hi = mix(c3,c4,his);\n vec4 ce = mix(lo,hi,ces);\n\n return vec4(plasma_quintic(ces),1).ragb;\n}\n\nvec3 terrain_map( vec2 p )\n{\n return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture2D(u_texture3, fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'\n}\n\nconst mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );\n\nfloat water_map( vec2 p, float height ) {\n vec2 p2 = p*large_wavesize;\n vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );\n vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );\n\n // coarse crossing 'ocean' waves...\n float f = 0.6000*noise( p );\n f += 0.2500*noise( p*m );\n f += 0.1666*noise( p*m*m );\n float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;\n\n p *= small_wavesize;\n f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<9; i++)\n { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }\n \n return wave+f*small_waveheight;\n}\n\nfloat nautic(vec2 p) {\n p *= 18.;\n float f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }\n return pow(1.-f, 5.);\n}\n\nfloat particles(vec2 p) {\n p *= 200.;\n float f = 0.;\n float amp = 1.0, s = 1.5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }\n return pow(f*.35, 7.)*particle_amount;\n}\n\nfloat test_shadow( vec2 xy, float height) {\n vec3 r0 = vec3(xy, height);\n vec3 rd = normalize( light - r0 );\n \n float hit = 1.0;\n float t = 0.001;\n for (int j=1; j<25; j++)\n {\n vec3 p = r0 + t*rd;\n float h = height_map( p.xy );\n float height_diff = p.z - h;\n if (height_diff<0.0)\n {\n return 0.0;\n }\n t += 0.01+height_diff*.02;\n hit = min(hit, 2.*height_diff/t); // soft shaddow \n }\n return hit;\n}\n\nvec3 CalcTerrain(vec2 uv, float height) {\n vec3 col = terrain_map( uv );\n vec2 iResolution = vec2(512.);\n float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);\n float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);\n float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);\n float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);\n vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));\n vec3 r0 = vec3(uv, height);\n vec3 rd = normalize( light - r0 );\n float grad = dot(norm, rd);\n col *= grad+pow(grad, 8.);\n float terrainshade = test_shadow( uv, height );\n col = mix(col*.25, col, terrainshade);\n return col;\n}\n\n\nvoid main() {\n vec3 watercolor = u_watercolor.rgb;\n vec3 watercolor2 = u_watercolor2.rgb;\n vec2 uv = v_uv;\n float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)\n float deepwater_fadedepth = 0.4 + coast2water_fadedepth;\n float height = height_map( uv );\n vec3 col;\n\n float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);\n float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);\n if (height > level)\n {\n col = CalcTerrain(uv, height);\n }\n if (height <= level)\n {\n vec2 dif = vec2(.0, .01);\n vec2 pos = uv*15. + vec2(u_time*.01);\n float h1 = water_map(pos-dif,waveheight);\n float h2 = water_map(pos+dif,waveheight);\n float h3 = water_map(pos-dif.yx,waveheight);\n float h4 = water_map(pos+dif.yx,waveheight);\n vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane\n uv += normwater.xy*.002*(level-height);\n \n col = CalcTerrain(uv, height);\n\n float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);\n float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);\n float intensity = col.r*.2126+col.g*.7152+col.b*.0722;\n watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));\n\n vec3 r0 = vec3(uv, WATER_LEVEL);\n vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position\n float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction\n float specular = pow(grad, water_softlight_fact); // used for soft highlights \n float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights\n float gradpos = dot(vec3(0., 0., 1.), rd);\n float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...) \n float watershade = test_shadow( uv, level );\n watercolor *= 2.2+watershade;\n watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;\n watercolor /= (1.+specular1*1.25);\n watercolor += watershade*specular2*water_specularcolor;\n watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));\n \n col = mix(col, watercolor, coastfade);\n }\n \n\n float opacity = styleMappingMat[0][0];\n gl_FragColor = vec4(col, opacity); \n}\n";
|
|
20
|
+
|
|
21
|
+
/* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
|
|
20
22
|
var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
|
|
21
23
|
|
|
22
|
-
var OceanModel = function (_BaseModel) {
|
|
24
|
+
var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
23
25
|
_inherits(OceanModel, _BaseModel);
|
|
24
26
|
|
|
25
27
|
var _super = _createSuper(OceanModel);
|
|
26
28
|
|
|
27
29
|
function OceanModel() {
|
|
28
|
-
var _this;
|
|
29
|
-
|
|
30
30
|
_classCallCheck(this, OceanModel);
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
args[_key] = arguments[_key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
37
|
-
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "texture1", void 0);
|
|
39
|
-
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "texture2", void 0);
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "texture3", void 0);
|
|
43
|
-
|
|
44
|
-
return _this;
|
|
32
|
+
return _super.apply(this, arguments);
|
|
45
33
|
}
|
|
46
34
|
|
|
47
35
|
_createClass(OceanModel, [{
|
|
@@ -68,7 +56,8 @@ var OceanModel = function (_BaseModel) {
|
|
|
68
56
|
width = _this$calDataFrame.width,
|
|
69
57
|
height = _this$calDataFrame.height;
|
|
70
58
|
|
|
71
|
-
this.rowCount = height;
|
|
59
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
60
|
+
|
|
72
61
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
73
62
|
flipY: true,
|
|
74
63
|
data: data,
|
|
@@ -93,8 +82,9 @@ var OceanModel = function (_BaseModel) {
|
|
|
93
82
|
u_watercolor: rgb2arr(watercolor),
|
|
94
83
|
u_watercolor2: rgb2arr(watercolor2),
|
|
95
84
|
u_dataTexture: this.dataTexture,
|
|
85
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
96
86
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
97
|
-
u_opacity:
|
|
87
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0
|
|
98
88
|
};
|
|
99
89
|
}
|
|
100
90
|
}, {
|
|
@@ -165,6 +155,7 @@ var OceanModel = function (_BaseModel) {
|
|
|
165
155
|
descriptor: {
|
|
166
156
|
name: 'a_uv',
|
|
167
157
|
buffer: {
|
|
158
|
+
// give the WebGL driver a hint that this buffer may change
|
|
168
159
|
usage: gl.STATIC_DRAW,
|
|
169
160
|
data: [],
|
|
170
161
|
type: gl.FLOAT
|
|
@@ -183,24 +174,26 @@ var OceanModel = function (_BaseModel) {
|
|
|
183
174
|
}, {
|
|
184
175
|
key: "loadTexture",
|
|
185
176
|
value: function loadTexture() {
|
|
186
|
-
var
|
|
177
|
+
var _this = this;
|
|
187
178
|
|
|
188
179
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
189
180
|
var defaultTextureOptions = {
|
|
190
181
|
height: 0,
|
|
191
182
|
width: 0
|
|
192
|
-
};
|
|
183
|
+
}; // 默认索引为 undefined,所以单独赋值
|
|
184
|
+
|
|
193
185
|
this.texture1 = createTexture2D(defaultTextureOptions);
|
|
194
186
|
this.texture2 = createTexture2D(defaultTextureOptions);
|
|
195
|
-
this.texture3 = createTexture2D(defaultTextureOptions);
|
|
187
|
+
this.texture3 = createTexture2D(defaultTextureOptions); // 加载完 image 后单独给 texture f赋值
|
|
188
|
+
|
|
196
189
|
initImage(function (images) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
_this.texture1 = initTex(images[0]);
|
|
191
|
+
_this.texture2 = initTex(images[1]);
|
|
192
|
+
_this.texture3 = initTex(images[2]);
|
|
200
193
|
|
|
201
|
-
|
|
194
|
+
_this.layerService.updateLayerRenderList();
|
|
202
195
|
|
|
203
|
-
|
|
196
|
+
_this.layerService.renderLayers();
|
|
204
197
|
});
|
|
205
198
|
|
|
206
199
|
function initImage(callback) {
|
|
@@ -240,5 +233,4 @@ var OceanModel = function (_BaseModel) {
|
|
|
240
233
|
return OceanModel;
|
|
241
234
|
}(BaseModel);
|
|
242
235
|
|
|
243
|
-
export { OceanModel as default };
|
|
244
|
-
//# sourceMappingURL=ocean.js.map
|
|
236
|
+
export { OceanModel as default };
|
|
@@ -10,12 +10,16 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
|
|
11
11
|
import { gl } from '@antv/l7-core';
|
|
12
12
|
import { getMask } from '@antv/l7-utils';
|
|
13
|
-
import BaseModel from
|
|
14
|
-
import { polygonTriangulation } from
|
|
13
|
+
import BaseModel from "../../core/BaseModel";
|
|
14
|
+
import { polygonTriangulation } from "../../core/triangulation";
|
|
15
|
+
|
|
16
|
+
/* babel-plugin-inline-import '../shaders/tile/polygon_tile_frag.glsl' */
|
|
15
17
|
var polygon_tile_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
18
|
+
|
|
19
|
+
/* babel-plugin-inline-import '../shaders/tile/polygon_tile_vert.glsl' */
|
|
16
20
|
var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n }\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n} else {\n vec2 pointPos = a_Position.xy;\n vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n world.xy += pointOffset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n world.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
17
21
|
|
|
18
|
-
var FillModel = function (_BaseModel) {
|
|
22
|
+
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
19
23
|
_inherits(FillModel, _BaseModel);
|
|
20
24
|
|
|
21
25
|
var _super = _createSuper(FillModel);
|
|
@@ -49,7 +53,8 @@ var FillModel = function (_BaseModel) {
|
|
|
49
53
|
width = _this$calDataFrame.width,
|
|
50
54
|
height = _this$calDataFrame.height;
|
|
51
55
|
|
|
52
|
-
this.rowCount = height;
|
|
56
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
57
|
+
|
|
53
58
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
54
59
|
flipY: true,
|
|
55
60
|
data: data,
|
|
@@ -71,6 +76,7 @@ var FillModel = function (_BaseModel) {
|
|
|
71
76
|
u_tileOrigin: tileOrigin || [0, 0],
|
|
72
77
|
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
73
78
|
u_dataTexture: this.dataTexture,
|
|
79
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
74
80
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
75
81
|
u_opacity: opacity
|
|
76
82
|
};
|
|
@@ -117,11 +123,11 @@ var FillModel = function (_BaseModel) {
|
|
|
117
123
|
}
|
|
118
124
|
}, {
|
|
119
125
|
key: "registerBuiltinAttributes",
|
|
120
|
-
value: function registerBuiltinAttributes() {
|
|
126
|
+
value: function registerBuiltinAttributes() {//
|
|
127
|
+
}
|
|
121
128
|
}]);
|
|
122
129
|
|
|
123
130
|
return FillModel;
|
|
124
131
|
}(BaseModel);
|
|
125
132
|
|
|
126
|
-
export { FillModel as default };
|
|
127
|
-
//# sourceMappingURL=tile.js.map
|
|
133
|
+
export { FillModel as default };
|