@antv/l7-layers 2.25.6 → 2.25.7
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/package.json +6 -6
- package/es/canvas/index.d.ts +0 -18
- package/es/canvas/index.js +0 -70
- package/es/canvas/models/canvas.d.ts +0 -23
- package/es/canvas/models/canvas.js +0 -141
- package/es/canvas/models/constants.d.ts +0 -2
- package/es/canvas/models/constants.js +0 -6
- package/es/canvas/models/index.d.ts +0 -2
- package/es/canvas/models/index.js +0 -2
- package/es/citybuilding/building.d.ts +0 -7
- package/es/citybuilding/building.js +0 -25
- package/es/citybuilding/models/build.d.ts +0 -33
- package/es/citybuilding/models/build.js +0 -160
- package/es/citybuilding/shaders/build_frag.glsl +0 -123
- package/es/citybuilding/shaders/build_vert.glsl +0 -58
- package/es/core/BaseLayer.d.ts +0 -265
- package/es/core/BaseLayer.js +0 -1310
- package/es/core/BaseModel.d.ts +0 -95
- package/es/core/BaseModel.js +0 -367
- package/es/core/CommonStyleAttribute.d.ts +0 -16
- package/es/core/CommonStyleAttribute.js +0 -114
- package/es/core/LayerPickService.d.ts +0 -12
- package/es/core/LayerPickService.js +0 -102
- package/es/core/TextureService.d.ts +0 -15
- package/es/core/TextureService.js +0 -65
- package/es/core/constant.d.ts +0 -6
- package/es/core/constant.js +0 -19
- package/es/core/interface.d.ts +0 -284
- package/es/core/interface.js +0 -32
- package/es/core/line_trangluation.d.ts +0 -19
- package/es/core/line_trangluation.js +0 -86
- package/es/core/schema.d.ts +0 -27
- package/es/core/schema.js +0 -25
- package/es/core/shape/Path.d.ts +0 -40
- package/es/core/shape/Path.js +0 -69
- package/es/core/shape/arrow.d.ts +0 -25
- package/es/core/shape/arrow.js +0 -144
- package/es/core/shape/extrude.d.ts +0 -17
- package/es/core/shape/extrude.js +0 -133
- package/es/core/triangulation.d.ts +0 -136
- package/es/core/triangulation.js +0 -601
- package/es/core/utils.d.ts +0 -5
- package/es/core/utils.js +0 -36
- package/es/earth/index.d.ts +0 -22
- package/es/earth/index.js +0 -54
- package/es/earth/models/atmosphere.d.ts +0 -30
- package/es/earth/models/atmosphere.js +0 -116
- package/es/earth/models/base.d.ts +0 -37
- package/es/earth/models/base.js +0 -172
- package/es/earth/models/bloomsphere.d.ts +0 -30
- package/es/earth/models/bloomsphere.js +0 -115
- package/es/earth/shaders/atmosphere/atmosphere_frag.glsl +0 -17
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +0 -24
- package/es/earth/shaders/base/base_frag.glsl +0 -11
- package/es/earth/shaders/base/base_vert.glsl +0 -52
- package/es/earth/shaders/bloomshpere/bloomsphere_frag.glsl +0 -15
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +0 -20
- package/es/earth/utils.d.ts +0 -26
- package/es/earth/utils.js +0 -99
- package/es/geometry/index.d.ts +0 -22
- package/es/geometry/index.js +0 -53
- package/es/geometry/models/billboard.d.ts +0 -39
- package/es/geometry/models/billboard.js +0 -175
- package/es/geometry/models/index.d.ts +0 -5
- package/es/geometry/models/index.js +0 -9
- package/es/geometry/models/plane.d.ts +0 -58
- package/es/geometry/models/plane.js +0 -308
- package/es/geometry/models/sprite.d.ts +0 -48
- package/es/geometry/models/sprite.js +0 -225
- package/es/geometry/shaders/billboard_frag.glsl +0 -18
- package/es/geometry/shaders/billboard_vert.glsl +0 -43
- package/es/geometry/shaders/plane_frag.glsl +0 -23
- package/es/geometry/shaders/plane_vert.glsl +0 -31
- package/es/geometry/shaders/sprite_frag.glsl +0 -23
- package/es/geometry/shaders/sprite_vert.glsl +0 -21
- package/es/heatmap/index.d.ts +0 -13
- package/es/heatmap/index.js +0 -87
- package/es/heatmap/models/grid.d.ts +0 -29
- package/es/heatmap/models/grid.js +0 -83
- package/es/heatmap/models/grid3d.d.ts +0 -31
- package/es/heatmap/models/grid3d.js +0 -122
- package/es/heatmap/models/heatmap.d.ts +0 -46
- package/es/heatmap/models/heatmap.js +0 -447
- package/es/heatmap/models/hexagon.d.ts +0 -29
- package/es/heatmap/models/hexagon.js +0 -83
- package/es/heatmap/models/index.d.ts +0 -5
- package/es/heatmap/models/index.js +0 -12
- package/es/heatmap/shaders/grid/grid_frag.glsl +0 -9
- package/es/heatmap/shaders/grid/grid_vert.glsl +0 -30
- package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +0 -17
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +0 -34
- package/es/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +0 -23
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +0 -59
- package/es/heatmap/shaders/heatmap/heatmap_frag.glsl +0 -40
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +0 -17
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +0 -36
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +0 -21
- package/es/heatmap/shaders/hexagon/hexagon_frag.glsl +0 -8
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +0 -30
- package/es/heatmap/triangulation.d.ts +0 -5
- package/es/heatmap/triangulation.js +0 -33
- package/es/image/index.d.ts +0 -9
- package/es/image/index.js +0 -28
- package/es/image/models/image.d.ts +0 -31
- package/es/image/models/image.js +0 -113
- package/es/image/models/index.d.ts +0 -5
- package/es/image/models/index.js +0 -5
- package/es/image/shaders/dataImage_frag.glsl +0 -32
- package/es/image/shaders/image_frag.glsl +0 -38
- package/es/image/shaders/image_vert.glsl +0 -20
- package/es/index.d.ts +0 -18
- package/es/index.js +0 -18
- package/es/line/index.d.ts +0 -36
- package/es/line/index.js +0 -90
- package/es/line/models/arc.d.ts +0 -40
- package/es/line/models/arc.js +0 -279
- package/es/line/models/arc_3d.d.ts +0 -40
- package/es/line/models/arc_3d.js +0 -269
- package/es/line/models/flow.d.ts +0 -31
- package/es/line/models/flow.js +0 -140
- package/es/line/models/great_circle.d.ts +0 -34
- package/es/line/models/great_circle.js +0 -240
- package/es/line/models/index.d.ts +0 -5
- package/es/line/models/index.js +0 -18
- package/es/line/models/line.d.ts +0 -44
- package/es/line/models/line.js +0 -273
- package/es/line/models/simple_line.d.ts +0 -33
- package/es/line/models/simple_line.js +0 -118
- package/es/line/models/wall.d.ts +0 -34
- package/es/line/models/wall.js +0 -223
- package/es/line/shaders/arc/line_arc_frag.glsl +0 -92
- package/es/line/shaders/arc/line_arc_vert.glsl +0 -156
- package/es/line/shaders/arc3d/line_arc_3d_frag.glsl +0 -108
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +0 -177
- package/es/line/shaders/flow/flow_line_frag.glsl +0 -13
- package/es/line/shaders/flow/flow_line_vert.glsl +0 -76
- package/es/line/shaders/greatCircle/line_arc_great_circle_frag.glsl +0 -99
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +0 -165
- package/es/line/shaders/line/line_frag.glsl +0 -122
- package/es/line/shaders/line/line_vert.glsl +0 -101
- package/es/line/shaders/simple/simpleline_frag.glsl +0 -30
- package/es/line/shaders/simple/simpleline_vert.glsl +0 -45
- package/es/line/shaders/wall/wall_frag.glsl +0 -94
- package/es/line/shaders/wall/wall_vert.glsl +0 -90
- package/es/mask/index.d.ts +0 -16
- package/es/mask/index.js +0 -21
- package/es/mask/models/fill.d.ts +0 -18
- package/es/mask/models/fill.js +0 -61
- package/es/mask/models/index.d.ts +0 -5
- package/es/mask/models/index.js +0 -5
- package/es/mask/shaders/mask_vert.glsl +0 -14
- package/es/plugins/DataMappingPlugin.d.ts +0 -12
- package/es/plugins/DataMappingPlugin.js +0 -226
- package/es/plugins/DataSourcePlugin.d.ts +0 -6
- package/es/plugins/DataSourcePlugin.js +0 -75
- package/es/plugins/FeatureScalePlugin.d.ts +0 -20
- package/es/plugins/FeatureScalePlugin.js +0 -295
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -4
- package/es/plugins/LayerAnimateStylePlugin.js +0 -14
- package/es/plugins/LayerMaskPlugin.d.ts +0 -7
- package/es/plugins/LayerMaskPlugin.js +0 -19
- package/es/plugins/LayerModelPlugin.d.ts +0 -10
- package/es/plugins/LayerModelPlugin.js +0 -60
- package/es/plugins/LayerStylePlugin.d.ts +0 -7
- package/es/plugins/LayerStylePlugin.js +0 -18
- package/es/plugins/LightingPlugin.d.ts +0 -35
- package/es/plugins/LightingPlugin.js +0 -84
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -22
- package/es/plugins/MultiPassRendererPlugin.js +0 -52
- package/es/plugins/PixelPickingPlugin.d.ts +0 -11
- package/es/plugins/PixelPickingPlugin.js +0 -146
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -10
- package/es/plugins/RegisterStyleAttributePlugin.js +0 -72
- package/es/plugins/ShaderUniformPlugin.d.ts +0 -17
- package/es/plugins/ShaderUniformPlugin.js +0 -196
- package/es/plugins/UpdateModelPlugin.d.ts +0 -7
- package/es/plugins/UpdateModelPlugin.js +0 -20
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +0 -9
- package/es/plugins/UpdateStyleAttributePlugin.js +0 -54
- package/es/plugins/index.d.ts +0 -15
- package/es/plugins/index.js +0 -18
- package/es/point/index.d.ts +0 -35
- package/es/point/index.js +0 -153
- package/es/point/models/billboard_point.d.ts +0 -35
- package/es/point/models/billboard_point.js +0 -95
- package/es/point/models/earthExtrude.d.ts +0 -32
- package/es/point/models/earthExtrude.js +0 -199
- package/es/point/models/earthFill.d.ts +0 -31
- package/es/point/models/earthFill.js +0 -158
- package/es/point/models/extrude.d.ts +0 -32
- package/es/point/models/extrude.js +0 -195
- package/es/point/models/fill.d.ts +0 -47
- package/es/point/models/fill.js +0 -180
- package/es/point/models/fillImage.d.ts +0 -42
- package/es/point/models/fillImage.js +0 -189
- package/es/point/models/image.d.ts +0 -48
- package/es/point/models/image.js +0 -293
- package/es/point/models/index.d.ts +0 -5
- package/es/point/models/index.js +0 -24
- package/es/point/models/normal.d.ts +0 -36
- package/es/point/models/normal.js +0 -89
- package/es/point/models/radar.d.ts +0 -37
- package/es/point/models/radar.js +0 -115
- package/es/point/models/text.d.ts +0 -85
- package/es/point/models/text.js +0 -503
- package/es/point/shaders/billboard/billboard_point_frag.glsl +0 -48
- package/es/point/shaders/billboard/billboard_point_vert.glsl +0 -33
- package/es/point/shaders/earthExtrude/earthExtrude_frag.glsl +0 -36
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +0 -118
- package/es/point/shaders/earthFill/earthFill_frag.glsl +0 -79
- package/es/point/shaders/earthFill/earthFill_vert.glsl +0 -46
- package/es/point/shaders/extrude/extrude_frag.glsl +0 -29
- package/es/point/shaders/extrude/extrude_vert.glsl +0 -95
- package/es/point/shaders/fill/fill_frag.glsl +0 -97
- package/es/point/shaders/fill/fill_vert.glsl +0 -79
- package/es/point/shaders/fillImage/fillImage_frag.glsl +0 -23
- package/es/point/shaders/fillImage/fillImage_vert.glsl +0 -46
- package/es/point/shaders/image/image_frag.glsl +0 -45
- package/es/point/shaders/image/image_vert.glsl +0 -47
- package/es/point/shaders/normal/normal_frag.glsl +0 -5
- package/es/point/shaders/normal/normal_vert.glsl +0 -22
- package/es/point/shaders/radar/radar_frag.glsl +0 -52
- package/es/point/shaders/radar/radar_vert.glsl +0 -53
- package/es/point/shaders/text/text_frag.glsl +0 -47
- package/es/point/shaders/text/text_vert.glsl +0 -65
- package/es/point/shape/extrude.d.ts +0 -15
- package/es/point/shape/extrude.js +0 -48
- package/es/polygon/index.d.ts +0 -18
- package/es/polygon/index.js +0 -71
- package/es/polygon/models/extrude.d.ts +0 -41
- package/es/polygon/models/extrude.js +0 -248
- package/es/polygon/models/extrusion.d.ts +0 -40
- package/es/polygon/models/extrusion.js +0 -137
- package/es/polygon/models/fill.d.ts +0 -32
- package/es/polygon/models/fill.js +0 -127
- package/es/polygon/models/index.d.ts +0 -5
- package/es/polygon/models/index.js +0 -26
- package/es/polygon/models/ocean.d.ts +0 -37
- package/es/polygon/models/ocean.js +0 -172
- package/es/polygon/models/water.d.ts +0 -35
- package/es/polygon/models/water.js +0 -150
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +0 -24
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +0 -49
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +0 -53
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +0 -74
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +0 -55
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +0 -54
- package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +0 -8
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +0 -24
- package/es/polygon/shaders/fill/fill_frag.glsl +0 -8
- package/es/polygon/shaders/fill/fill_linear_frag.glsl +0 -23
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +0 -36
- package/es/polygon/shaders/fill/fill_vert.glsl +0 -35
- package/es/polygon/shaders/ocean/ocean_frag.glsl +0 -277
- package/es/polygon/shaders/ocean/ocean_vert.glsl +0 -21
- package/es/polygon/shaders/water/polygon_water_frag.glsl +0 -78
- package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -22
- package/es/raster/buffers/triangulation.d.ts +0 -6
- package/es/raster/buffers/triangulation.js +0 -25
- package/es/raster/index.d.ts +0 -11
- package/es/raster/index.js +0 -55
- package/es/raster/models/index.d.ts +0 -5
- package/es/raster/models/index.js +0 -10
- package/es/raster/models/raster.d.ts +0 -35
- package/es/raster/models/raster.js +0 -156
- package/es/raster/models/rasterRgb.d.ts +0 -35
- package/es/raster/models/rasterRgb.js +0 -158
- package/es/raster/models/rasterTerrainRgb.d.ts +0 -30
- package/es/raster/models/rasterTerrainRgb.js +0 -118
- package/es/raster/shaders/raster/raster_2d_frag.glsl +0 -37
- package/es/raster/shaders/raster/raster_2d_vert.glsl +0 -21
- package/es/raster/shaders/rgb/raster_rgb_frag.glsl +0 -30
- package/es/raster/shaders/rgb/raster_rgb_vert.glsl +0 -21
- package/es/raster/shaders/terrain/terrain_rgb_frag.glsl +0 -40
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +0 -19
- package/es/shader/minify_frag.glsl +0 -11
- package/es/shader/minify_picking_frag.glsl +0 -10
- package/es/tile/core/BaseLayer.d.ts +0 -50
- package/es/tile/core/BaseLayer.js +0 -256
- package/es/tile/core/TileDebugLayer.d.ts +0 -15
- package/es/tile/core/TileDebugLayer.js +0 -23
- package/es/tile/interaction/getFeatureData.d.ts +0 -0
- package/es/tile/interaction/getFeatureData.js +0 -0
- package/es/tile/interaction/getRasterData.d.ts +0 -4
- package/es/tile/interaction/getRasterData.js +0 -45
- package/es/tile/interaction/utils.d.ts +0 -11
- package/es/tile/interaction/utils.js +0 -69
- package/es/tile/interface.d.ts +0 -29
- package/es/tile/interface.js +0 -1
- package/es/tile/service/TileLayerService.d.ts +0 -58
- package/es/tile/service/TileLayerService.js +0 -195
- package/es/tile/service/TilePickService.d.ts +0 -26
- package/es/tile/service/TilePickService.js +0 -126
- package/es/tile/service/TileSourceService.d.ts +0 -7
- package/es/tile/service/TileSourceService.js +0 -26
- package/es/tile/tile/DebugTile.d.ts +0 -16
- package/es/tile/tile/DebugTile.js +0 -47
- package/es/tile/tile/ImageTile.d.ts +0 -14
- package/es/tile/tile/ImageTile.js +0 -39
- package/es/tile/tile/MaskTile.d.ts +0 -18
- package/es/tile/tile/MaskTile.js +0 -54
- package/es/tile/tile/RasterRGBTile.d.ts +0 -11
- package/es/tile/tile/RasterRGBTile.js +0 -47
- package/es/tile/tile/RasterTerrainRGBTile.d.ts +0 -14
- package/es/tile/tile/RasterTerrainRGBTile.js +0 -39
- package/es/tile/tile/RasterTile.d.ts +0 -18
- package/es/tile/tile/RasterTile.js +0 -81
- package/es/tile/tile/Tile.d.ts +0 -112
- package/es/tile/tile/Tile.js +0 -166
- package/es/tile/tile/VectorTile.d.ts +0 -26
- package/es/tile/tile/VectorTile.js +0 -87
- package/es/tile/tile/index.d.ts +0 -12
- package/es/tile/tile/index.js +0 -44
- package/es/tile/tile/util.d.ts +0 -5
- package/es/tile/tile/util.js +0 -18
- package/es/tile/utils/constants.d.ts +0 -1
- package/es/tile/utils/constants.js +0 -8
- package/es/tile/utils/utils.d.ts +0 -8
- package/es/tile/utils/utils.js +0 -11
- package/es/utils/blend.d.ts +0 -2
- package/es/utils/blend.js +0 -57
- package/es/utils/collision-index.d.ts +0 -47
- package/es/utils/collision-index.js +0 -87
- package/es/utils/extrude_polyline.d.ts +0 -53
- package/es/utils/extrude_polyline.js +0 -319
- package/es/utils/grid-index.d.ts +0 -28
- package/es/utils/grid-index.js +0 -128
- package/es/utils/identityScale.d.ts +0 -8
- package/es/utils/identityScale.js +0 -26
- package/es/utils/load-image.d.ts +0 -1
- package/es/utils/load-image.js +0 -22
- package/es/utils/multiPassRender.d.ts +0 -16
- package/es/utils/multiPassRender.js +0 -37
- package/es/utils/polylineNormal.d.ts +0 -9
- package/es/utils/polylineNormal.js +0 -182
- package/es/utils/rampcolor_legend.d.ts +0 -6
- package/es/utils/rampcolor_legend.js +0 -12
- package/es/utils/scale.d.ts +0 -87
- package/es/utils/scale.js +0 -595
- package/es/utils/simpleLine.d.ts +0 -23
- package/es/utils/simpleLine.js +0 -76
- package/es/utils/stencil.d.ts +0 -7
- package/es/utils/stencil.js +0 -49
- package/es/utils/symbol-layout.d.ts +0 -43
- package/es/utils/symbol-layout.js +0 -251
- package/es/wind/index.d.ts +0 -11
- package/es/wind/index.js +0 -34
- package/es/wind/models/index.d.ts +0 -5
- package/es/wind/models/index.js +0 -5
- package/es/wind/models/utils.d.ts +0 -19
- package/es/wind/models/utils.js +0 -213
- package/es/wind/models/wind.d.ts +0 -38
- package/es/wind/models/wind.js +0 -240
- package/es/wind/models/windRender.d.ts +0 -104
- package/es/wind/models/windRender.js +0 -333
- package/es/wind/models/windShader.d.ts +0 -12
- package/es/wind/models/windShader.js +0 -151
- package/es/wind/shaders/wind_frag.glsl +0 -9
- package/es/wind/shaders/wind_vert.glsl +0 -14
- package/lib/canvas/index.d.ts +0 -18
- package/lib/canvas/index.js +0 -79
- package/lib/canvas/models/canvas.d.ts +0 -23
- package/lib/canvas/models/canvas.js +0 -149
- package/lib/canvas/models/constants.d.ts +0 -2
- package/lib/canvas/models/constants.js +0 -12
- package/lib/canvas/models/index.d.ts +0 -2
- package/lib/canvas/models/index.js +0 -27
- package/lib/citybuilding/building.d.ts +0 -7
- package/lib/citybuilding/building.js +0 -33
- package/lib/citybuilding/models/build.d.ts +0 -33
- package/lib/citybuilding/models/build.js +0 -168
- package/lib/citybuilding/shaders/build_frag.glsl +0 -123
- package/lib/citybuilding/shaders/build_vert.glsl +0 -58
- package/lib/core/BaseLayer.d.ts +0 -265
- package/lib/core/BaseLayer.js +0 -1317
- package/lib/core/BaseModel.d.ts +0 -95
- package/lib/core/BaseModel.js +0 -375
- package/lib/core/CommonStyleAttribute.d.ts +0 -16
- package/lib/core/CommonStyleAttribute.js +0 -120
- package/lib/core/LayerPickService.d.ts +0 -12
- package/lib/core/LayerPickService.js +0 -110
- package/lib/core/TextureService.d.ts +0 -15
- package/lib/core/TextureService.js +0 -73
- package/lib/core/constant.d.ts +0 -6
- package/lib/core/constant.js +0 -25
- package/lib/core/interface.d.ts +0 -284
- package/lib/core/interface.js +0 -34
- package/lib/core/line_trangluation.d.ts +0 -19
- package/lib/core/line_trangluation.js +0 -94
- package/lib/core/schema.d.ts +0 -27
- package/lib/core/schema.js +0 -31
- package/lib/core/shape/Path.d.ts +0 -40
- package/lib/core/shape/Path.js +0 -81
- package/lib/core/shape/arrow.d.ts +0 -25
- package/lib/core/shape/arrow.js +0 -158
- package/lib/core/shape/extrude.d.ts +0 -17
- package/lib/core/shape/extrude.js +0 -142
- package/lib/core/triangulation.d.ts +0 -136
- package/lib/core/triangulation.js +0 -628
- package/lib/core/utils.d.ts +0 -5
- package/lib/core/utils.js +0 -44
- package/lib/earth/index.d.ts +0 -22
- package/lib/earth/index.js +0 -62
- package/lib/earth/models/atmosphere.d.ts +0 -30
- package/lib/earth/models/atmosphere.js +0 -124
- package/lib/earth/models/base.d.ts +0 -37
- package/lib/earth/models/base.js +0 -180
- package/lib/earth/models/bloomsphere.d.ts +0 -30
- package/lib/earth/models/bloomsphere.js +0 -123
- package/lib/earth/shaders/atmosphere/atmosphere_frag.glsl +0 -17
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +0 -24
- package/lib/earth/shaders/base/base_frag.glsl +0 -11
- package/lib/earth/shaders/base/base_vert.glsl +0 -52
- package/lib/earth/shaders/bloomshpere/bloomsphere_frag.glsl +0 -15
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +0 -20
- package/lib/earth/utils.d.ts +0 -26
- package/lib/earth/utils.js +0 -107
- package/lib/geometry/index.d.ts +0 -22
- package/lib/geometry/index.js +0 -61
- package/lib/geometry/models/billboard.d.ts +0 -39
- package/lib/geometry/models/billboard.js +0 -183
- package/lib/geometry/models/index.d.ts +0 -5
- package/lib/geometry/models/index.js +0 -16
- package/lib/geometry/models/plane.d.ts +0 -58
- package/lib/geometry/models/plane.js +0 -316
- package/lib/geometry/models/sprite.d.ts +0 -48
- package/lib/geometry/models/sprite.js +0 -233
- package/lib/geometry/shaders/billboard_frag.glsl +0 -18
- package/lib/geometry/shaders/billboard_vert.glsl +0 -43
- package/lib/geometry/shaders/plane_frag.glsl +0 -23
- package/lib/geometry/shaders/plane_vert.glsl +0 -31
- package/lib/geometry/shaders/sprite_frag.glsl +0 -23
- package/lib/geometry/shaders/sprite_vert.glsl +0 -21
- package/lib/heatmap/index.d.ts +0 -13
- package/lib/heatmap/index.js +0 -95
- package/lib/heatmap/models/grid.d.ts +0 -29
- package/lib/heatmap/models/grid.js +0 -91
- package/lib/heatmap/models/grid3d.d.ts +0 -31
- package/lib/heatmap/models/grid3d.js +0 -130
- package/lib/heatmap/models/heatmap.d.ts +0 -46
- package/lib/heatmap/models/heatmap.js +0 -455
- package/lib/heatmap/models/hexagon.d.ts +0 -29
- package/lib/heatmap/models/hexagon.js +0 -91
- package/lib/heatmap/models/index.d.ts +0 -5
- package/lib/heatmap/models/index.js +0 -19
- package/lib/heatmap/shaders/grid/grid_frag.glsl +0 -9
- package/lib/heatmap/shaders/grid/grid_vert.glsl +0 -30
- package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +0 -17
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +0 -34
- package/lib/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +0 -23
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +0 -59
- package/lib/heatmap/shaders/heatmap/heatmap_frag.glsl +0 -40
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +0 -17
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +0 -36
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +0 -21
- package/lib/heatmap/shaders/hexagon/hexagon_frag.glsl +0 -8
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +0 -30
- package/lib/heatmap/triangulation.d.ts +0 -5
- package/lib/heatmap/triangulation.js +0 -39
- package/lib/image/index.d.ts +0 -9
- package/lib/image/index.js +0 -36
- package/lib/image/models/image.d.ts +0 -31
- package/lib/image/models/image.js +0 -121
- package/lib/image/models/index.d.ts +0 -5
- package/lib/image/models/index.js +0 -12
- package/lib/image/shaders/dataImage_frag.glsl +0 -32
- package/lib/image/shaders/image_frag.glsl +0 -38
- package/lib/image/shaders/image_vert.glsl +0 -20
- package/lib/index.d.ts +0 -18
- package/lib/index.js +0 -148
- package/lib/line/index.d.ts +0 -36
- package/lib/line/index.js +0 -98
- package/lib/line/models/arc.d.ts +0 -40
- package/lib/line/models/arc.js +0 -287
- package/lib/line/models/arc_3d.d.ts +0 -40
- package/lib/line/models/arc_3d.js +0 -277
- package/lib/line/models/flow.d.ts +0 -31
- package/lib/line/models/flow.js +0 -148
- package/lib/line/models/great_circle.d.ts +0 -34
- package/lib/line/models/great_circle.js +0 -248
- package/lib/line/models/index.d.ts +0 -5
- package/lib/line/models/index.js +0 -25
- package/lib/line/models/line.d.ts +0 -44
- package/lib/line/models/line.js +0 -281
- package/lib/line/models/simple_line.d.ts +0 -33
- package/lib/line/models/simple_line.js +0 -126
- package/lib/line/models/wall.d.ts +0 -34
- package/lib/line/models/wall.js +0 -231
- package/lib/line/shaders/arc/line_arc_frag.glsl +0 -92
- package/lib/line/shaders/arc/line_arc_vert.glsl +0 -156
- package/lib/line/shaders/arc3d/line_arc_3d_frag.glsl +0 -108
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +0 -177
- package/lib/line/shaders/flow/flow_line_frag.glsl +0 -13
- package/lib/line/shaders/flow/flow_line_vert.glsl +0 -76
- package/lib/line/shaders/greatCircle/line_arc_great_circle_frag.glsl +0 -99
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +0 -165
- package/lib/line/shaders/line/line_frag.glsl +0 -122
- package/lib/line/shaders/line/line_vert.glsl +0 -101
- package/lib/line/shaders/simple/simpleline_frag.glsl +0 -30
- package/lib/line/shaders/simple/simpleline_vert.glsl +0 -45
- package/lib/line/shaders/wall/wall_frag.glsl +0 -94
- package/lib/line/shaders/wall/wall_vert.glsl +0 -90
- package/lib/mask/index.d.ts +0 -16
- package/lib/mask/index.js +0 -29
- package/lib/mask/models/fill.d.ts +0 -18
- package/lib/mask/models/fill.js +0 -69
- package/lib/mask/models/index.d.ts +0 -5
- package/lib/mask/models/index.js +0 -12
- package/lib/mask/shaders/mask_vert.glsl +0 -14
- package/lib/plugins/DataMappingPlugin.d.ts +0 -12
- package/lib/plugins/DataMappingPlugin.js +0 -234
- package/lib/plugins/DataSourcePlugin.d.ts +0 -6
- package/lib/plugins/DataSourcePlugin.js +0 -83
- package/lib/plugins/FeatureScalePlugin.d.ts +0 -20
- package/lib/plugins/FeatureScalePlugin.js +0 -303
- package/lib/plugins/LayerAnimateStylePlugin.d.ts +0 -4
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -22
- package/lib/plugins/LayerMaskPlugin.d.ts +0 -7
- package/lib/plugins/LayerMaskPlugin.js +0 -26
- package/lib/plugins/LayerModelPlugin.d.ts +0 -10
- package/lib/plugins/LayerModelPlugin.js +0 -68
- package/lib/plugins/LayerStylePlugin.d.ts +0 -7
- package/lib/plugins/LayerStylePlugin.js +0 -25
- package/lib/plugins/LightingPlugin.d.ts +0 -35
- package/lib/plugins/LightingPlugin.js +0 -93
- package/lib/plugins/MultiPassRendererPlugin.d.ts +0 -22
- package/lib/plugins/MultiPassRendererPlugin.js +0 -59
- package/lib/plugins/PixelPickingPlugin.d.ts +0 -11
- package/lib/plugins/PixelPickingPlugin.js +0 -154
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +0 -10
- package/lib/plugins/RegisterStyleAttributePlugin.js +0 -78
- package/lib/plugins/ShaderUniformPlugin.d.ts +0 -17
- package/lib/plugins/ShaderUniformPlugin.js +0 -203
- package/lib/plugins/UpdateModelPlugin.d.ts +0 -7
- package/lib/plugins/UpdateModelPlugin.js +0 -27
- package/lib/plugins/UpdateStyleAttributePlugin.d.ts +0 -9
- package/lib/plugins/UpdateStyleAttributePlugin.js +0 -61
- package/lib/plugins/index.d.ts +0 -15
- package/lib/plugins/index.js +0 -26
- package/lib/point/index.d.ts +0 -35
- package/lib/point/index.js +0 -161
- package/lib/point/models/billboard_point.d.ts +0 -35
- package/lib/point/models/billboard_point.js +0 -104
- package/lib/point/models/earthExtrude.d.ts +0 -32
- package/lib/point/models/earthExtrude.js +0 -207
- package/lib/point/models/earthFill.d.ts +0 -31
- package/lib/point/models/earthFill.js +0 -166
- package/lib/point/models/extrude.d.ts +0 -32
- package/lib/point/models/extrude.js +0 -203
- package/lib/point/models/fill.d.ts +0 -47
- package/lib/point/models/fill.js +0 -188
- package/lib/point/models/fillImage.d.ts +0 -42
- package/lib/point/models/fillImage.js +0 -197
- package/lib/point/models/image.d.ts +0 -48
- package/lib/point/models/image.js +0 -301
- package/lib/point/models/index.d.ts +0 -5
- package/lib/point/models/index.js +0 -32
- package/lib/point/models/normal.d.ts +0 -36
- package/lib/point/models/normal.js +0 -98
- package/lib/point/models/radar.d.ts +0 -37
- package/lib/point/models/radar.js +0 -123
- package/lib/point/models/text.d.ts +0 -85
- package/lib/point/models/text.js +0 -512
- package/lib/point/shaders/billboard/billboard_point_frag.glsl +0 -48
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +0 -33
- package/lib/point/shaders/earthExtrude/earthExtrude_frag.glsl +0 -36
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +0 -118
- package/lib/point/shaders/earthFill/earthFill_frag.glsl +0 -79
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +0 -46
- package/lib/point/shaders/extrude/extrude_frag.glsl +0 -29
- package/lib/point/shaders/extrude/extrude_vert.glsl +0 -95
- package/lib/point/shaders/fill/fill_frag.glsl +0 -97
- package/lib/point/shaders/fill/fill_vert.glsl +0 -79
- package/lib/point/shaders/fillImage/fillImage_frag.glsl +0 -23
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +0 -46
- package/lib/point/shaders/image/image_frag.glsl +0 -45
- package/lib/point/shaders/image/image_vert.glsl +0 -47
- package/lib/point/shaders/normal/normal_frag.glsl +0 -5
- package/lib/point/shaders/normal/normal_vert.glsl +0 -22
- package/lib/point/shaders/radar/radar_frag.glsl +0 -52
- package/lib/point/shaders/radar/radar_vert.glsl +0 -53
- package/lib/point/shaders/text/text_frag.glsl +0 -47
- package/lib/point/shaders/text/text_vert.glsl +0 -65
- package/lib/point/shape/extrude.d.ts +0 -15
- package/lib/point/shape/extrude.js +0 -56
- package/lib/polygon/index.d.ts +0 -18
- package/lib/polygon/index.js +0 -79
- package/lib/polygon/models/extrude.d.ts +0 -41
- package/lib/polygon/models/extrude.js +0 -256
- package/lib/polygon/models/extrusion.d.ts +0 -40
- package/lib/polygon/models/extrusion.js +0 -145
- package/lib/polygon/models/fill.d.ts +0 -32
- package/lib/polygon/models/fill.js +0 -135
- package/lib/polygon/models/index.d.ts +0 -5
- package/lib/polygon/models/index.js +0 -33
- package/lib/polygon/models/ocean.d.ts +0 -37
- package/lib/polygon/models/ocean.js +0 -180
- package/lib/polygon/models/water.d.ts +0 -35
- package/lib/polygon/models/water.js +0 -158
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +0 -24
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +0 -49
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +0 -53
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +0 -74
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +0 -55
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +0 -54
- package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +0 -8
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +0 -24
- package/lib/polygon/shaders/fill/fill_frag.glsl +0 -8
- package/lib/polygon/shaders/fill/fill_linear_frag.glsl +0 -23
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +0 -36
- package/lib/polygon/shaders/fill/fill_vert.glsl +0 -35
- package/lib/polygon/shaders/ocean/ocean_frag.glsl +0 -277
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +0 -21
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +0 -78
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -22
- package/lib/raster/buffers/triangulation.d.ts +0 -6
- package/lib/raster/buffers/triangulation.js +0 -33
- package/lib/raster/index.d.ts +0 -11
- package/lib/raster/index.js +0 -63
- package/lib/raster/models/index.d.ts +0 -5
- package/lib/raster/models/index.js +0 -17
- package/lib/raster/models/raster.d.ts +0 -35
- package/lib/raster/models/raster.js +0 -164
- package/lib/raster/models/rasterRgb.d.ts +0 -35
- package/lib/raster/models/rasterRgb.js +0 -166
- package/lib/raster/models/rasterTerrainRgb.d.ts +0 -30
- package/lib/raster/models/rasterTerrainRgb.js +0 -126
- package/lib/raster/shaders/raster/raster_2d_frag.glsl +0 -37
- package/lib/raster/shaders/raster/raster_2d_vert.glsl +0 -21
- package/lib/raster/shaders/rgb/raster_rgb_frag.glsl +0 -30
- package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +0 -21
- package/lib/raster/shaders/terrain/terrain_rgb_frag.glsl +0 -40
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +0 -19
- package/lib/shader/minify_frag.glsl +0 -11
- package/lib/shader/minify_picking_frag.glsl +0 -10
- package/lib/tile/core/BaseLayer.d.ts +0 -50
- package/lib/tile/core/BaseLayer.js +0 -264
- package/lib/tile/core/TileDebugLayer.d.ts +0 -15
- package/lib/tile/core/TileDebugLayer.js +0 -31
- package/lib/tile/interaction/getFeatureData.d.ts +0 -0
- package/lib/tile/interaction/getFeatureData.js +0 -1
- package/lib/tile/interaction/getRasterData.d.ts +0 -4
- package/lib/tile/interaction/getRasterData.js +0 -52
- package/lib/tile/interaction/utils.d.ts +0 -11
- package/lib/tile/interaction/utils.js +0 -81
- package/lib/tile/interface.d.ts +0 -29
- package/lib/tile/interface.js +0 -5
- package/lib/tile/service/TileLayerService.d.ts +0 -58
- package/lib/tile/service/TileLayerService.js +0 -203
- package/lib/tile/service/TilePickService.d.ts +0 -26
- package/lib/tile/service/TilePickService.js +0 -134
- package/lib/tile/service/TileSourceService.d.ts +0 -7
- package/lib/tile/service/TileSourceService.js +0 -35
- package/lib/tile/tile/DebugTile.d.ts +0 -16
- package/lib/tile/tile/DebugTile.js +0 -55
- package/lib/tile/tile/ImageTile.d.ts +0 -14
- package/lib/tile/tile/ImageTile.js +0 -47
- package/lib/tile/tile/MaskTile.d.ts +0 -18
- package/lib/tile/tile/MaskTile.js +0 -62
- package/lib/tile/tile/RasterRGBTile.d.ts +0 -11
- package/lib/tile/tile/RasterRGBTile.js +0 -55
- package/lib/tile/tile/RasterTerrainRGBTile.d.ts +0 -14
- package/lib/tile/tile/RasterTerrainRGBTile.js +0 -47
- package/lib/tile/tile/RasterTile.d.ts +0 -18
- package/lib/tile/tile/RasterTile.js +0 -89
- package/lib/tile/tile/Tile.d.ts +0 -112
- package/lib/tile/tile/Tile.js +0 -174
- package/lib/tile/tile/VectorTile.d.ts +0 -26
- package/lib/tile/tile/VectorTile.js +0 -95
- package/lib/tile/tile/index.d.ts +0 -12
- package/lib/tile/tile/index.js +0 -76
- package/lib/tile/tile/util.d.ts +0 -5
- package/lib/tile/tile/util.js +0 -26
- package/lib/tile/utils/constants.d.ts +0 -1
- package/lib/tile/utils/constants.js +0 -14
- package/lib/tile/utils/utils.d.ts +0 -8
- package/lib/tile/utils/utils.js +0 -18
- package/lib/utils/blend.d.ts +0 -2
- package/lib/utils/blend.js +0 -63
- package/lib/utils/collision-index.d.ts +0 -47
- package/lib/utils/collision-index.js +0 -96
- package/lib/utils/extrude_polyline.d.ts +0 -53
- package/lib/utils/extrude_polyline.js +0 -331
- package/lib/utils/grid-index.d.ts +0 -28
- package/lib/utils/grid-index.js +0 -135
- package/lib/utils/identityScale.d.ts +0 -8
- package/lib/utils/identityScale.js +0 -32
- package/lib/utils/load-image.d.ts +0 -1
- package/lib/utils/load-image.js +0 -29
- package/lib/utils/multiPassRender.d.ts +0 -16
- package/lib/utils/multiPassRender.js +0 -44
- package/lib/utils/polylineNormal.d.ts +0 -9
- package/lib/utils/polylineNormal.js +0 -191
- package/lib/utils/rampcolor_legend.d.ts +0 -6
- package/lib/utils/rampcolor_legend.js +0 -18
- package/lib/utils/scale.d.ts +0 -87
- package/lib/utils/scale.js +0 -610
- package/lib/utils/simpleLine.d.ts +0 -23
- package/lib/utils/simpleLine.js +0 -85
- package/lib/utils/stencil.d.ts +0 -7
- package/lib/utils/stencil.js +0 -56
- package/lib/utils/symbol-layout.d.ts +0 -43
- package/lib/utils/symbol-layout.js +0 -258
- package/lib/wind/index.d.ts +0 -11
- package/lib/wind/index.js +0 -42
- package/lib/wind/models/index.d.ts +0 -5
- package/lib/wind/models/index.js +0 -12
- package/lib/wind/models/utils.d.ts +0 -19
- package/lib/wind/models/utils.js +0 -229
- package/lib/wind/models/wind.d.ts +0 -38
- package/lib/wind/models/wind.js +0 -248
- package/lib/wind/models/windRender.d.ts +0 -104
- package/lib/wind/models/windRender.js +0 -343
- package/lib/wind/models/windShader.d.ts +0 -12
- package/lib/wind/models/windShader.js +0 -157
- package/lib/wind/shaders/wind_frag.glsl +0 -9
- package/lib/wind/shaders/wind_vert.glsl +0 -14
package/es/wind/models/wind.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
|
-
import { FrequencyController } from '@antv/l7-utils';
|
|
5
|
-
import BaseModel from "../../core/BaseModel";
|
|
6
|
-
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
7
|
-
/* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
|
|
8
|
-
const WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
9
|
-
/* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
|
|
10
|
-
const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
11
|
-
import { Wind } from "./windRender";
|
|
12
|
-
const defaultRampColors = {
|
|
13
|
-
0.0: '#3288bd',
|
|
14
|
-
0.1: '#66c2a5',
|
|
15
|
-
0.2: '#abdda4',
|
|
16
|
-
0.3: '#e6f598',
|
|
17
|
-
0.4: '#fee08b',
|
|
18
|
-
0.5: '#fdae61',
|
|
19
|
-
0.6: '#f46d43',
|
|
20
|
-
1.0: '#d53e4f'
|
|
21
|
-
};
|
|
22
|
-
export default class WindModel extends BaseModel {
|
|
23
|
-
constructor(...args) {
|
|
24
|
-
super(...args);
|
|
25
|
-
_defineProperty(this, "texture", void 0);
|
|
26
|
-
_defineProperty(this, "colorModel", void 0);
|
|
27
|
-
_defineProperty(this, "wind", void 0);
|
|
28
|
-
_defineProperty(this, "imageCoords", void 0);
|
|
29
|
-
_defineProperty(this, "sizeScale", 0.5);
|
|
30
|
-
// https://mapbox.github.io/webgl-wind/demo/
|
|
31
|
-
// source: 'http://nomads.ncep.noaa.gov',
|
|
32
|
-
_defineProperty(this, "frequency", new FrequencyController(7.2));
|
|
33
|
-
_defineProperty(this, "cacheZoom", void 0);
|
|
34
|
-
}
|
|
35
|
-
get attributeLocation() {
|
|
36
|
-
return Object.assign(super.attributeLocation, {
|
|
37
|
-
MAX: super.attributeLocation.MAX,
|
|
38
|
-
UV: 9
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
render(options) {
|
|
42
|
-
this.drawColorMode(options);
|
|
43
|
-
// Tip: 控制风场的平均更新频率
|
|
44
|
-
this.frequency.run(() => {
|
|
45
|
-
this.drawWind();
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
getUninforms() {
|
|
49
|
-
throw new Error('Method not implemented.');
|
|
50
|
-
}
|
|
51
|
-
initModels() {
|
|
52
|
-
var _this = this;
|
|
53
|
-
return _asyncToGenerator(function* () {
|
|
54
|
-
var _source$data, _source$data2;
|
|
55
|
-
const {
|
|
56
|
-
uMin = -21.32,
|
|
57
|
-
uMax = 26.8,
|
|
58
|
-
vMin = -21.57,
|
|
59
|
-
vMax = 21.42,
|
|
60
|
-
fadeOpacity = 0.996,
|
|
61
|
-
speedFactor = 0.25,
|
|
62
|
-
dropRate = 0.003,
|
|
63
|
-
dropRateBump = 0.01,
|
|
64
|
-
rampColors = defaultRampColors,
|
|
65
|
-
sizeScale = 0.5
|
|
66
|
-
// mask
|
|
67
|
-
} = _this.layer.getLayerConfig();
|
|
68
|
-
const {
|
|
69
|
-
createTexture2D
|
|
70
|
-
} = _this.rendererService;
|
|
71
|
-
const source = _this.layer.getSource();
|
|
72
|
-
_this.texture = createTexture2D({
|
|
73
|
-
height: 0,
|
|
74
|
-
width: 0
|
|
75
|
-
});
|
|
76
|
-
_this.cacheZoom = Math.floor(_this.mapService.getZoom());
|
|
77
|
-
const glContext = _this.rendererService.getGLContext();
|
|
78
|
-
_this.imageCoords = (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.dataArray[0].coordinates;
|
|
79
|
-
(_source$data2 = source.data) === null || _source$data2 === void 0 || (_source$data2 = _source$data2.images) === null || _source$data2 === void 0 || _source$data2.then(imageData => {
|
|
80
|
-
var _this$texture;
|
|
81
|
-
_this.sizeScale = sizeScale * _this.getZoomScale();
|
|
82
|
-
const {
|
|
83
|
-
imageWidth,
|
|
84
|
-
imageHeight
|
|
85
|
-
} = _this.getWindSize();
|
|
86
|
-
const options = {
|
|
87
|
-
glContext,
|
|
88
|
-
imageWidth,
|
|
89
|
-
imageHeight,
|
|
90
|
-
fadeOpacity,
|
|
91
|
-
speedFactor,
|
|
92
|
-
dropRate,
|
|
93
|
-
dropRateBump,
|
|
94
|
-
rampColors
|
|
95
|
-
};
|
|
96
|
-
_this.wind = new Wind(options);
|
|
97
|
-
|
|
98
|
-
// imageData[0] 风场图
|
|
99
|
-
_this.wind.setWind({
|
|
100
|
-
uMin,
|
|
101
|
-
uMax,
|
|
102
|
-
vMin,
|
|
103
|
-
vMax,
|
|
104
|
-
image: imageData[0]
|
|
105
|
-
});
|
|
106
|
-
(_this$texture = _this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
107
|
-
_this.texture = createTexture2D({
|
|
108
|
-
width: imageWidth,
|
|
109
|
-
height: imageHeight
|
|
110
|
-
});
|
|
111
|
-
_this.layerService.reRender();
|
|
112
|
-
});
|
|
113
|
-
const model = yield _this.layer.buildLayerModel({
|
|
114
|
-
moduleName: 'wind',
|
|
115
|
-
vertexShader: WindVert,
|
|
116
|
-
fragmentShader: WindFrag,
|
|
117
|
-
defines: _this.getDefines(),
|
|
118
|
-
triangulation: RasterImageTriangulation,
|
|
119
|
-
primitive: gl.TRIANGLES,
|
|
120
|
-
depth: {
|
|
121
|
-
enable: false
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
_this.colorModel = model;
|
|
125
|
-
return [model];
|
|
126
|
-
})();
|
|
127
|
-
}
|
|
128
|
-
getWindSize() {
|
|
129
|
-
const p1 = this.mapService.lngLatToPixel(this.imageCoords[0]);
|
|
130
|
-
const p2 = this.mapService.lngLatToPixel(this.imageCoords[1]);
|
|
131
|
-
const imageWidth = Math.min(Math.floor((p2.x - p1.x) * this.sizeScale), 2048);
|
|
132
|
-
const imageHeight = Math.min(Math.floor((p1.y - p2.y) * this.sizeScale), 2048);
|
|
133
|
-
return {
|
|
134
|
-
imageWidth,
|
|
135
|
-
imageHeight
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
buildModels() {
|
|
139
|
-
var _this2 = this;
|
|
140
|
-
return _asyncToGenerator(function* () {
|
|
141
|
-
return _this2.initModels();
|
|
142
|
-
})();
|
|
143
|
-
}
|
|
144
|
-
clearModels() {
|
|
145
|
-
var _this$texture2, _this$wind;
|
|
146
|
-
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
147
|
-
(_this$wind = this.wind) === null || _this$wind === void 0 || _this$wind.destroy();
|
|
148
|
-
}
|
|
149
|
-
registerBuiltinAttributes() {
|
|
150
|
-
// point layer size;
|
|
151
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
152
|
-
name: 'uv',
|
|
153
|
-
type: AttributeType.Attribute,
|
|
154
|
-
descriptor: {
|
|
155
|
-
name: 'a_Uv',
|
|
156
|
-
shaderLocation: this.attributeLocation.UV,
|
|
157
|
-
buffer: {
|
|
158
|
-
// give the WebGL driver a hint that this buffer may change
|
|
159
|
-
usage: gl.DYNAMIC_DRAW,
|
|
160
|
-
data: [],
|
|
161
|
-
type: gl.FLOAT
|
|
162
|
-
},
|
|
163
|
-
size: 2,
|
|
164
|
-
update: (feature, featureIdx, vertex) => {
|
|
165
|
-
return [vertex[3], vertex[4]];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
getZoomScale() {
|
|
171
|
-
return Math.min((this.cacheZoom + 4) / 30 * 2, 2);
|
|
172
|
-
}
|
|
173
|
-
drawWind() {
|
|
174
|
-
if (this.wind) {
|
|
175
|
-
const {
|
|
176
|
-
uMin = -21.32,
|
|
177
|
-
uMax = 26.8,
|
|
178
|
-
vMin = -21.57,
|
|
179
|
-
vMax = 21.42,
|
|
180
|
-
numParticles = 65535,
|
|
181
|
-
fadeOpacity = 0.996,
|
|
182
|
-
speedFactor = 0.25,
|
|
183
|
-
dropRate = 0.003,
|
|
184
|
-
dropRateBump = 0.01,
|
|
185
|
-
rampColors = defaultRampColors,
|
|
186
|
-
sizeScale = 0.5
|
|
187
|
-
} = this.layer.getLayerConfig();
|
|
188
|
-
let newNumParticles = numParticles;
|
|
189
|
-
const currentZoom = Math.floor(this.mapService.getZoom());
|
|
190
|
-
if (typeof sizeScale === 'number' && sizeScale !== this.sizeScale || currentZoom !== this.cacheZoom) {
|
|
191
|
-
const zoomScale = this.getZoomScale();
|
|
192
|
-
this.sizeScale = sizeScale;
|
|
193
|
-
newNumParticles *= zoomScale;
|
|
194
|
-
const {
|
|
195
|
-
imageWidth,
|
|
196
|
-
imageHeight
|
|
197
|
-
} = this.getWindSize();
|
|
198
|
-
this.wind.reSize(imageWidth, imageHeight);
|
|
199
|
-
this.cacheZoom = currentZoom;
|
|
200
|
-
}
|
|
201
|
-
this.wind.updateWindDir(uMin, uMax, vMin, vMax);
|
|
202
|
-
this.wind.updateParticelNum(newNumParticles);
|
|
203
|
-
this.wind.updateColorRampTexture(rampColors);
|
|
204
|
-
this.wind.fadeOpacity = fadeOpacity;
|
|
205
|
-
this.wind.speedFactor = speedFactor;
|
|
206
|
-
this.wind.dropRate = dropRate;
|
|
207
|
-
this.wind.dropRateBump = dropRateBump;
|
|
208
|
-
const {
|
|
209
|
-
d,
|
|
210
|
-
w,
|
|
211
|
-
h
|
|
212
|
-
} = this.wind.draw();
|
|
213
|
-
// 恢复 L7 渲染流程中 gl 状态
|
|
214
|
-
this.rendererService.setBaseState();
|
|
215
|
-
this.texture.update({
|
|
216
|
-
data: d,
|
|
217
|
-
width: w,
|
|
218
|
-
height: h
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
drawColorMode(options = {}) {
|
|
223
|
-
var _this$colorModel;
|
|
224
|
-
const {
|
|
225
|
-
opacity
|
|
226
|
-
} = this.layer.getLayerConfig();
|
|
227
|
-
this.layerService.beforeRenderData(this.layer);
|
|
228
|
-
this.layer.hooks.beforeRender.call();
|
|
229
|
-
this.layerService.renderMask(this.layer.masks);
|
|
230
|
-
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
|
|
231
|
-
uniforms: {
|
|
232
|
-
u_opacity: opacity || 1.0,
|
|
233
|
-
u_texture: this.texture
|
|
234
|
-
},
|
|
235
|
-
blend: this.getBlend(),
|
|
236
|
-
stencil: this.getStencil(options)
|
|
237
|
-
});
|
|
238
|
-
this.layer.hooks.afterRender.call();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export interface IWindData {
|
|
2
|
-
uMin: number;
|
|
3
|
-
uMax: number;
|
|
4
|
-
vMin: number;
|
|
5
|
-
vMax: number;
|
|
6
|
-
image: HTMLImageElement;
|
|
7
|
-
}
|
|
8
|
-
export interface IWind {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
fadeOpacity: number;
|
|
12
|
-
speedFactor: number;
|
|
13
|
-
dropRate: number;
|
|
14
|
-
dropRateBump: number;
|
|
15
|
-
setWind: (windData: IWindData) => void;
|
|
16
|
-
draw: () => {
|
|
17
|
-
d: Uint8Array;
|
|
18
|
-
w: number;
|
|
19
|
-
h: number;
|
|
20
|
-
};
|
|
21
|
-
updateParticelNum: (num: number) => void;
|
|
22
|
-
updateWindDir: (uMin: number, uMax: number, vMin: number, vMax: number) => void;
|
|
23
|
-
updateColorRampTexture: (rampColors: {
|
|
24
|
-
[key: number]: string;
|
|
25
|
-
}) => void;
|
|
26
|
-
reSize: (width: number, height: number) => void;
|
|
27
|
-
destroy: () => void;
|
|
28
|
-
}
|
|
29
|
-
export interface IWindProps {
|
|
30
|
-
glContext: WebGLRenderingContext;
|
|
31
|
-
imageWidth: number;
|
|
32
|
-
imageHeight: number;
|
|
33
|
-
fadeOpacity: number;
|
|
34
|
-
speedFactor: number;
|
|
35
|
-
dropRate: number;
|
|
36
|
-
dropRateBump: number;
|
|
37
|
-
rampColors: {
|
|
38
|
-
[key: number]: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export declare class Wind {
|
|
42
|
-
width: number;
|
|
43
|
-
height: number;
|
|
44
|
-
pixels: Uint8Array;
|
|
45
|
-
fadeOpacity: number;
|
|
46
|
-
speedFactor: number;
|
|
47
|
-
dropRate: number;
|
|
48
|
-
dropRateBump: number;
|
|
49
|
-
private gl;
|
|
50
|
-
private drawProgram;
|
|
51
|
-
private fullScreenProgram;
|
|
52
|
-
private updateProgram;
|
|
53
|
-
private rampColors;
|
|
54
|
-
private numParticles;
|
|
55
|
-
private numParticlesSize;
|
|
56
|
-
private particleStateResolution;
|
|
57
|
-
private quadBuffer;
|
|
58
|
-
private particleIndexBuffer;
|
|
59
|
-
private framebuffer;
|
|
60
|
-
private colorRampTexture;
|
|
61
|
-
private backgroundTexture;
|
|
62
|
-
private screenTexture;
|
|
63
|
-
private particleStateTexture0;
|
|
64
|
-
private particleStateTexture1;
|
|
65
|
-
private windTexture;
|
|
66
|
-
private windData;
|
|
67
|
-
constructor(options: IWindProps);
|
|
68
|
-
init(): void;
|
|
69
|
-
setWind(windData: IWindData): void;
|
|
70
|
-
/**
|
|
71
|
-
* 更新风场粒子数量
|
|
72
|
-
* @param num
|
|
73
|
-
*/
|
|
74
|
-
updateParticelNum(num: number): void;
|
|
75
|
-
/**
|
|
76
|
-
* 更新风场风向风速
|
|
77
|
-
* @param uMin
|
|
78
|
-
* @param uMax
|
|
79
|
-
* @param vMin
|
|
80
|
-
* @param vMax
|
|
81
|
-
*/
|
|
82
|
-
updateWindDir(uMin: number, uMax: number, vMin: number, vMax: number): void;
|
|
83
|
-
/**
|
|
84
|
-
* update rampColors
|
|
85
|
-
* @param rampColors
|
|
86
|
-
*/
|
|
87
|
-
updateColorRampTexture(rampColors: {
|
|
88
|
-
[key: number]: string;
|
|
89
|
-
}): void;
|
|
90
|
-
isColorChanged(rampColors: {
|
|
91
|
-
[key: number]: string;
|
|
92
|
-
}): boolean;
|
|
93
|
-
reSize(width: number, height: number): void;
|
|
94
|
-
draw(): {
|
|
95
|
-
d: Uint8Array;
|
|
96
|
-
w: number;
|
|
97
|
-
h: number;
|
|
98
|
-
};
|
|
99
|
-
drawScreen(): void;
|
|
100
|
-
drawFullTexture(texture: any, opacity: number): void;
|
|
101
|
-
drawParticles(): void;
|
|
102
|
-
updateParticles(): void;
|
|
103
|
-
destroy(): void;
|
|
104
|
-
}
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import * as glUtils from "./utils";
|
|
3
|
-
import { drawFrag, drawVert, fullScreenFrag, fullScreenVert, updateFrag, updateVert } from "./windShader";
|
|
4
|
-
function getColorRamp(colors) {
|
|
5
|
-
let canvas = document.createElement('canvas');
|
|
6
|
-
const ctx = canvas.getContext('2d');
|
|
7
|
-
canvas.width = 256;
|
|
8
|
-
canvas.height = 1;
|
|
9
|
-
const gradient = ctx.createLinearGradient(0, 0, 256, 0);
|
|
10
|
-
for (const stop of Object.keys(colors)) {
|
|
11
|
-
gradient.addColorStop(+stop, colors[+stop]);
|
|
12
|
-
}
|
|
13
|
-
ctx.fillStyle = gradient;
|
|
14
|
-
ctx.fillRect(0, 0, 256, 1);
|
|
15
|
-
|
|
16
|
-
// @ts-ignore dispose canvas element
|
|
17
|
-
canvas = null;
|
|
18
|
-
return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);
|
|
19
|
-
}
|
|
20
|
-
function bindAttribute(gl, buffer, attribute, numComponents) {
|
|
21
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
22
|
-
gl.enableVertexAttribArray(attribute);
|
|
23
|
-
gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);
|
|
24
|
-
}
|
|
25
|
-
function bindFramebuffer(gl, framebuffer, texture) {
|
|
26
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
27
|
-
if (texture) {
|
|
28
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export class Wind {
|
|
32
|
-
constructor(options) {
|
|
33
|
-
_defineProperty(this, "width", 512);
|
|
34
|
-
_defineProperty(this, "height", 512);
|
|
35
|
-
_defineProperty(this, "pixels", void 0);
|
|
36
|
-
_defineProperty(this, "fadeOpacity", void 0);
|
|
37
|
-
_defineProperty(this, "speedFactor", void 0);
|
|
38
|
-
_defineProperty(this, "dropRate", void 0);
|
|
39
|
-
_defineProperty(this, "dropRateBump", void 0);
|
|
40
|
-
_defineProperty(this, "gl", void 0);
|
|
41
|
-
_defineProperty(this, "drawProgram", void 0);
|
|
42
|
-
_defineProperty(this, "fullScreenProgram", void 0);
|
|
43
|
-
_defineProperty(this, "updateProgram", void 0);
|
|
44
|
-
_defineProperty(this, "rampColors", void 0);
|
|
45
|
-
_defineProperty(this, "numParticles", 65536);
|
|
46
|
-
_defineProperty(this, "numParticlesSize", void 0);
|
|
47
|
-
_defineProperty(this, "particleStateResolution", void 0);
|
|
48
|
-
_defineProperty(this, "quadBuffer", void 0);
|
|
49
|
-
_defineProperty(this, "particleIndexBuffer", void 0);
|
|
50
|
-
_defineProperty(this, "framebuffer", void 0);
|
|
51
|
-
_defineProperty(this, "colorRampTexture", void 0);
|
|
52
|
-
_defineProperty(this, "backgroundTexture", void 0);
|
|
53
|
-
_defineProperty(this, "screenTexture", void 0);
|
|
54
|
-
_defineProperty(this, "particleStateTexture0", void 0);
|
|
55
|
-
_defineProperty(this, "particleStateTexture1", void 0);
|
|
56
|
-
_defineProperty(this, "windTexture", void 0);
|
|
57
|
-
_defineProperty(this, "windData", void 0);
|
|
58
|
-
this.gl = options.glContext;
|
|
59
|
-
this.width = options.imageWidth;
|
|
60
|
-
this.height = options.imageHeight;
|
|
61
|
-
this.fadeOpacity = options.fadeOpacity;
|
|
62
|
-
this.speedFactor = options.speedFactor;
|
|
63
|
-
this.dropRate = options.dropRate;
|
|
64
|
-
this.dropRateBump = options.dropRateBump;
|
|
65
|
-
this.rampColors = options.rampColors;
|
|
66
|
-
this.init();
|
|
67
|
-
}
|
|
68
|
-
init() {
|
|
69
|
-
const gl = this.gl;
|
|
70
|
-
this.fadeOpacity = 0.996; // how fast the particle trails fade on each frame
|
|
71
|
-
this.speedFactor = 0.25; // how fast the particles move
|
|
72
|
-
this.dropRate = 0.003; // how often the particles move to a random place
|
|
73
|
-
this.dropRateBump = 0.01; // drop rate increase relative to individual particle speed
|
|
74
|
-
|
|
75
|
-
this.drawProgram = glUtils.createProgram(gl, drawVert, drawFrag);
|
|
76
|
-
this.fullScreenProgram = glUtils.createProgram(gl, fullScreenVert, fullScreenFrag);
|
|
77
|
-
this.updateProgram = glUtils.createProgram(gl, updateVert, updateFrag);
|
|
78
|
-
this.quadBuffer = glUtils.createBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]));
|
|
79
|
-
this.framebuffer = gl.createFramebuffer();
|
|
80
|
-
this.colorRampTexture = glUtils.createTexture(this.gl, this.gl.LINEAR, getColorRamp(this.rampColors), 16, 16);
|
|
81
|
-
const emptyPixels = new Uint8Array(this.width * this.height * 4);
|
|
82
|
-
|
|
83
|
-
// screen textures to hold the drawn screen for the previous and the current frame
|
|
84
|
-
|
|
85
|
-
this.backgroundTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height);
|
|
86
|
-
this.screenTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height);
|
|
87
|
-
|
|
88
|
-
// we create a square texture where each pixel will hold a particle position encoded as RGBA
|
|
89
|
-
const particleRes = this.particleStateResolution = Math.ceil(Math.sqrt(this.numParticles));
|
|
90
|
-
// particleRes size
|
|
91
|
-
this.numParticlesSize = particleRes * particleRes;
|
|
92
|
-
const particleState = new Uint8Array(this.numParticlesSize * 4);
|
|
93
|
-
for (let i = 0; i < particleState.length; i++) {
|
|
94
|
-
particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions
|
|
95
|
-
}
|
|
96
|
-
// textures to hold the particle state for the current and the next frame
|
|
97
|
-
this.particleStateTexture0 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
98
|
-
this.particleStateTexture1 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
99
|
-
const particleIndices = new Float32Array(this.numParticlesSize);
|
|
100
|
-
for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {
|
|
101
|
-
particleIndices[i$1] = i$1;
|
|
102
|
-
}
|
|
103
|
-
this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);
|
|
104
|
-
}
|
|
105
|
-
setWind(windData) {
|
|
106
|
-
this.windData = windData;
|
|
107
|
-
this.windTexture = glUtils.createDataTexture(this.gl, this.gl.LINEAR, windData.image);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 更新风场粒子数量
|
|
112
|
-
* @param num
|
|
113
|
-
*/
|
|
114
|
-
updateParticelNum(num) {
|
|
115
|
-
const gl = this.gl;
|
|
116
|
-
if (num !== this.numParticles) {
|
|
117
|
-
this.numParticles = num; // params number
|
|
118
|
-
|
|
119
|
-
// we create a square texture where each pixel will hold a particle position encoded as RGBA
|
|
120
|
-
const particleRes = this.particleStateResolution = Math.ceil(Math.sqrt(this.numParticles));
|
|
121
|
-
this.numParticlesSize = particleRes * particleRes;
|
|
122
|
-
const particleState = new Uint8Array(this.numParticlesSize * 4);
|
|
123
|
-
for (let i = 0; i < particleState.length; i++) {
|
|
124
|
-
particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions
|
|
125
|
-
}
|
|
126
|
-
// textures to hold the particle state for the current and the next frame
|
|
127
|
-
this.particleStateTexture0 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
128
|
-
this.particleStateTexture1 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
|
|
129
|
-
const particleIndices = new Float32Array(this.numParticlesSize);
|
|
130
|
-
for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {
|
|
131
|
-
particleIndices[i$1] = i$1;
|
|
132
|
-
}
|
|
133
|
-
this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 更新风场风向风速
|
|
139
|
-
* @param uMin
|
|
140
|
-
* @param uMax
|
|
141
|
-
* @param vMin
|
|
142
|
-
* @param vMax
|
|
143
|
-
*/
|
|
144
|
-
updateWindDir(uMin, uMax, vMin, vMax) {
|
|
145
|
-
this.windData.uMin = uMin;
|
|
146
|
-
this.windData.uMax = uMax;
|
|
147
|
-
this.windData.vMin = vMin;
|
|
148
|
-
this.windData.vMax = vMax;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* update rampColors
|
|
153
|
-
* @param rampColors
|
|
154
|
-
*/
|
|
155
|
-
updateColorRampTexture(rampColors) {
|
|
156
|
-
if (this.isColorChanged(rampColors)) {
|
|
157
|
-
this.rampColors = rampColors;
|
|
158
|
-
const gl = this.gl;
|
|
159
|
-
gl.deleteTexture(this.colorRampTexture);
|
|
160
|
-
this.colorRampTexture = glUtils.createTexture(gl, gl.LINEAR, getColorRamp(rampColors), 16, 16);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
isColorChanged(rampColors) {
|
|
164
|
-
const keys = Object.keys(rampColors);
|
|
165
|
-
for (const item of keys) {
|
|
166
|
-
const key = Number(item);
|
|
167
|
-
// exist new key -> color need update
|
|
168
|
-
if (!this.rampColors[key]) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
// value changed -> color need update
|
|
172
|
-
if (this.rampColors[key] && this.rampColors[key] !== rampColors[key]) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
reSize(width, height) {
|
|
179
|
-
if (width !== this.width || height !== this.height) {
|
|
180
|
-
const gl = this.gl;
|
|
181
|
-
gl.deleteTexture(this.backgroundTexture);
|
|
182
|
-
gl.deleteTexture(this.screenTexture);
|
|
183
|
-
this.width = width;
|
|
184
|
-
this.height = height;
|
|
185
|
-
const emptyPixels = new Uint8Array(width * height * 4);
|
|
186
|
-
// screen textures to hold the drawn screen for the previous and the current frame
|
|
187
|
-
this.backgroundTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, width, height);
|
|
188
|
-
this.screenTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, width, height);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
draw() {
|
|
192
|
-
var _this$windData;
|
|
193
|
-
if ((_this$windData = this.windData) !== null && _this$windData !== void 0 && _this$windData.image) {
|
|
194
|
-
const gl = this.gl;
|
|
195
|
-
glUtils.bindTexture(gl, this.windTexture, 0);
|
|
196
|
-
glUtils.bindTexture(gl, this.particleStateTexture0, 1);
|
|
197
|
-
this.drawScreen(); // draw Particles into framebuffer
|
|
198
|
-
this.updateParticles();
|
|
199
|
-
return {
|
|
200
|
-
d: this.pixels,
|
|
201
|
-
w: this.width,
|
|
202
|
-
h: this.height
|
|
203
|
-
};
|
|
204
|
-
} else {
|
|
205
|
-
return {
|
|
206
|
-
d: new Uint8Array([0, 0, 0, 0]),
|
|
207
|
-
w: 1,
|
|
208
|
-
h: 1
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
drawScreen() {
|
|
213
|
-
const gl = this.gl;
|
|
214
|
-
|
|
215
|
-
// draw the screen into a temporary framebuffer to retain it as the background on the next frame
|
|
216
|
-
bindFramebuffer(gl, this.framebuffer, this.screenTexture);
|
|
217
|
-
gl.viewport(0, 0, this.width, this.height);
|
|
218
|
-
gl.disable(gl.BLEND);
|
|
219
|
-
this.drawFullTexture(this.backgroundTexture, this.fadeOpacity);
|
|
220
|
-
this.drawParticles();
|
|
221
|
-
this.pixels = new Uint8Array(4 * this.width * this.height);
|
|
222
|
-
gl.readPixels(0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.pixels);
|
|
223
|
-
bindFramebuffer(gl, null, null);
|
|
224
|
-
gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
|
|
225
|
-
|
|
226
|
-
// save the current screen as the background for the next frame
|
|
227
|
-
const temp = this.backgroundTexture;
|
|
228
|
-
this.backgroundTexture = this.screenTexture;
|
|
229
|
-
this.screenTexture = temp;
|
|
230
|
-
}
|
|
231
|
-
drawFullTexture(texture, opacity) {
|
|
232
|
-
const gl = this.gl;
|
|
233
|
-
const program = this.fullScreenProgram;
|
|
234
|
-
gl.useProgram(program);
|
|
235
|
-
|
|
236
|
-
// bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
|
|
237
|
-
|
|
238
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.quadBuffer);
|
|
239
|
-
gl.vertexAttribPointer(program.a_pos, 2, gl.FLOAT, false, 0, 0);
|
|
240
|
-
gl.enableVertexAttribArray(program.a_pos);
|
|
241
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
242
|
-
glUtils.bindTexture(gl, texture, 2);
|
|
243
|
-
gl.uniform1i(program.u_screen, 2);
|
|
244
|
-
gl.uniform1f(program.u_opacity, opacity);
|
|
245
|
-
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
246
|
-
// gl.drawArrays(gl.POINTS, 0, 6);
|
|
247
|
-
}
|
|
248
|
-
drawParticles() {
|
|
249
|
-
const gl = this.gl;
|
|
250
|
-
const program = this.drawProgram;
|
|
251
|
-
gl.useProgram(program);
|
|
252
|
-
bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);
|
|
253
|
-
glUtils.bindTexture(gl, this.colorRampTexture, 2);
|
|
254
|
-
gl.uniform1i(program.u_wind, 0);
|
|
255
|
-
gl.uniform1i(program.u_particles, 1);
|
|
256
|
-
gl.uniform1i(program.u_color_ramp, 2);
|
|
257
|
-
gl.uniform1f(program.u_particles_res, this.particleStateResolution);
|
|
258
|
-
gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);
|
|
259
|
-
gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);
|
|
260
|
-
gl.drawArrays(gl.POINTS, 0, this.numParticlesSize);
|
|
261
|
-
}
|
|
262
|
-
updateParticles() {
|
|
263
|
-
const gl = this.gl;
|
|
264
|
-
bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);
|
|
265
|
-
gl.viewport(0, 0, this.particleStateResolution, this.particleStateResolution);
|
|
266
|
-
const program = this.updateProgram;
|
|
267
|
-
gl.useProgram(program);
|
|
268
|
-
bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
|
|
269
|
-
gl.uniform1i(program.u_wind, 0);
|
|
270
|
-
gl.uniform1i(program.u_particles, 1);
|
|
271
|
-
gl.uniform1f(program.u_rand_seed, Math.random());
|
|
272
|
-
gl.uniform2f(program.u_wind_res, this.windData.image.width * 2, this.windData.image.height * 2);
|
|
273
|
-
gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);
|
|
274
|
-
gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);
|
|
275
|
-
gl.uniform1f(program.u_speed_factor, this.speedFactor);
|
|
276
|
-
gl.uniform1f(program.u_drop_rate, this.dropRate);
|
|
277
|
-
gl.uniform1f(program.u_drop_rate_bump, this.dropRateBump);
|
|
278
|
-
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
279
|
-
|
|
280
|
-
// swap the particle state textures so the new one becomes the current one
|
|
281
|
-
const temp = this.particleStateTexture0;
|
|
282
|
-
this.particleStateTexture0 = this.particleStateTexture1;
|
|
283
|
-
this.particleStateTexture1 = temp;
|
|
284
|
-
bindFramebuffer(gl, null, null);
|
|
285
|
-
|
|
286
|
-
// gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
|
|
287
|
-
}
|
|
288
|
-
destroy() {
|
|
289
|
-
// private drawProgram: WebGLProgram;
|
|
290
|
-
// private fullScreenProgram: WebGLProgram;
|
|
291
|
-
// private updateProgram: WebGLProgram;
|
|
292
|
-
|
|
293
|
-
// private quadBuffer: WebGLBuffer | null;
|
|
294
|
-
// private particleIndexBuffer: WebGLBuffer | null;
|
|
295
|
-
|
|
296
|
-
// private framebuffer: WebGLFramebuffer | null;
|
|
297
|
-
|
|
298
|
-
// private colorRampTexture: WebGLTexture | null;
|
|
299
|
-
// private backgroundTexture: WebGLTexture | null;
|
|
300
|
-
// private screenTexture: WebGLTexture | null;
|
|
301
|
-
// private particleStateTexture0: WebGLTexture | null;
|
|
302
|
-
// private particleStateTexture1: WebGLTexture | null;
|
|
303
|
-
// private windTexture: WebGLTexture | null;
|
|
304
|
-
|
|
305
|
-
this.gl.deleteBuffer(this.quadBuffer);
|
|
306
|
-
this.gl.deleteBuffer(this.particleIndexBuffer);
|
|
307
|
-
this.gl.deleteFramebuffer(this.framebuffer);
|
|
308
|
-
|
|
309
|
-
// @ts-ignore
|
|
310
|
-
this.gl.deleteShader(this.drawProgram.vertexShader);
|
|
311
|
-
// @ts-ignore
|
|
312
|
-
this.gl.deleteShader(this.drawProgram.fragmentShader);
|
|
313
|
-
this.gl.deleteProgram(this.drawProgram);
|
|
314
|
-
|
|
315
|
-
// @ts-ignore
|
|
316
|
-
this.gl.deleteShader(this.fullScreenProgram.vertexShader);
|
|
317
|
-
// @ts-ignore
|
|
318
|
-
this.gl.deleteShader(this.fullScreenProgram.fragmentShader);
|
|
319
|
-
this.gl.deleteProgram(this.fullScreenProgram);
|
|
320
|
-
|
|
321
|
-
// @ts-ignore
|
|
322
|
-
this.gl.deleteShader(this.updateProgram.vertexShader);
|
|
323
|
-
// @ts-ignore
|
|
324
|
-
this.gl.deleteShader(this.updateProgram.fragmentShader);
|
|
325
|
-
this.gl.deleteProgram(this.updateProgram);
|
|
326
|
-
this.gl.deleteTexture(this.colorRampTexture);
|
|
327
|
-
this.gl.deleteTexture(this.backgroundTexture);
|
|
328
|
-
this.gl.deleteTexture(this.screenTexture);
|
|
329
|
-
this.gl.deleteTexture(this.particleStateTexture0);
|
|
330
|
-
this.gl.deleteTexture(this.particleStateTexture1);
|
|
331
|
-
this.gl.deleteTexture(this.windTexture);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* drawProgram drawVert drawFrag
|
|
3
|
-
* screenProgram screenVert screenFrag
|
|
4
|
-
* updateProgram updateVert updateFrag
|
|
5
|
-
* fullScreenProgram fullScreenVert fullScreenFrag
|
|
6
|
-
*/
|
|
7
|
-
export declare const drawVert = "\n precision mediump float;\n\n attribute float a_index;\n\n uniform sampler2D u_particles;\n uniform float u_particles_res;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec4 color = texture2D(u_particles, vec2(\n fract(a_index / u_particles_res),\n floor(a_index / u_particles_res) / u_particles_res)\n );\n\n // decode current particle position from the pixel's RGBA value\n v_particle_pos = vec2( color.r / 255.0 + color.b, color.g / 255.0 + color.a);\n\n gl_PointSize = 1.0;\n gl_Position = vec4(2.0 * v_particle_pos.x - 1.0, 1.0 - 2.0 * v_particle_pos.y, 0, 1);\n }";
|
|
8
|
-
export declare const drawFrag = "\n precision mediump float;\n\n uniform sampler2D u_wind;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform sampler2D u_color_ramp;\n\n varying vec2 v_particle_pos;\n\n void main() {\n vec2 velocity = mix(u_wind_min, u_wind_max, texture2D(u_wind, v_particle_pos).rg);\n float speed_t = length(velocity) / length(u_wind_max);\n\n // color ramp is encoded in a 16x16 texture\n vec2 ramp_pos = vec2( fract(16.0 * speed_t), floor(16.0 * speed_t) / 16.0);\n\n gl_FragColor = texture2D(u_color_ramp, ramp_pos);\n }";
|
|
9
|
-
export declare const updateVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0, 1);\n // framebuffer \u59CB\u7EC8\u7528\u94FA\u6EE1\u5C4F\u5E55\u7684 texture\n }";
|
|
10
|
-
export declare const updateFrag = "\n precision highp float;\n\n uniform sampler2D u_particles;\n uniform sampler2D u_wind;\n uniform vec2 u_wind_res;\n uniform vec2 u_wind_min;\n uniform vec2 u_wind_max;\n uniform float u_rand_seed;\n uniform float u_speed_factor;\n uniform float u_drop_rate;\n uniform float u_drop_rate_bump;\n\n varying vec2 v_tex_pos;\n\n // pseudo-random generator\n const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);\n float rand(const vec2 co) {\n float t = dot(rand_constants.xy, co);\n return fract(sin(t) * (rand_constants.z + t));\n }\n\n // wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation\n vec2 lookup_wind(const vec2 uv) {\n // return texture2D(u_wind, uv).rg; // lower-res hardware filtering\n vec2 px = 1.0 / u_wind_res;\n vec2 vc = (floor(uv * u_wind_res)) * px;\n vec2 f = fract(uv * u_wind_res);\n vec2 tl = texture2D(u_wind, vc).rg;\n vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;\n vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;\n vec2 br = texture2D(u_wind, vc + px).rg;\n return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\n }\n\n void main() {\n vec4 color = texture2D(u_particles, v_tex_pos);\n vec2 pos = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a); // decode particle position from pixel RGBA\n vec2 velocity = mix(u_wind_min, u_wind_max, lookup_wind(pos));\n float speed_t = length(velocity) / length(u_wind_max);\n\n // take EPSG:4236 distortion into account for calculating where the particle moved\n float distortion = cos(radians(pos.y * 180.0 - 90.0));\n vec2 offset = vec2(velocity.x / distortion, -velocity.y) * 0.0001 * u_speed_factor;\n\n // update particle position, wrapping around the date line\n pos = fract(1.0 + pos + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (pos + v_tex_pos) * u_rand_seed;\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float drop_rate = u_drop_rate + speed_t * u_drop_rate_bump;\n float drop = step(1.0 - drop_rate, rand(seed));\n\n vec2 random_pos = vec2(\n rand(seed + 1.3),\n rand(seed + 2.1));\n pos = mix(pos, random_pos, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(pos * 255.0),\n floor(pos * 255.0) / 255.0);\n }";
|
|
11
|
-
export declare const fullScreenVert = "\n precision mediump float;\n\n attribute vec2 a_pos;\n\n varying vec2 v_tex_pos;\n\n void main() {\n v_tex_pos = a_pos;\n gl_Position = vec4(1.0 - 2.0 * a_pos, 0.0, 1.0);\n gl_PointSize = 100.0;\n }";
|
|
12
|
-
export declare const fullScreenFrag = "\n precision mediump float;\n\n uniform sampler2D u_screen;\n uniform float u_opacity;\n varying vec2 v_tex_pos;\n\n void main() {\n vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);\n\n // a hack to guarantee opacity fade out even with a value close to 1.0\n gl_FragColor = vec4(floor(255.0 * color * u_opacity) / 255.0);\n }";
|