@antv/l7-layers 2.9.27-alpha.2 → 2.9.27-alpha.4
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 +6 -2
- package/es/Geometry/models/billboard.js +3 -7
- package/es/Geometry/models/plane.js +5 -7
- package/es/Geometry/models/sprite.js +4 -7
- package/es/canvas/index.d.ts +4 -0
- package/es/canvas/index.js +38 -2
- package/es/citybuliding/building.js +6 -2
- package/es/citybuliding/models/build.js +2 -3
- package/es/core/BaseLayer.d.ts +20 -12
- package/es/core/BaseLayer.js +61 -85
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +22 -19
- package/es/core/interface.d.ts +20 -1
- package/es/core/triangulation.d.ts +6 -0
- package/es/core/triangulation.js +64 -2
- package/es/earth/index.js +3 -1
- package/es/earth/models/atmosphere.js +4 -7
- package/es/earth/models/base.js +12 -18
- package/es/earth/models/bloomsphere.js +4 -8
- package/es/earth/shaders/atmosphere_frag.glsl +1 -1
- package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/es/heatmap/index.d.ts +2 -2
- package/es/heatmap/index.js +7 -5
- package/es/heatmap/models/grid.js +1 -3
- package/es/heatmap/models/grid3d.js +4 -11
- package/es/heatmap/models/heatmap.js +8 -9
- package/es/heatmap/models/hexagon.js +2 -6
- package/es/heatmap/triangulation.js +0 -1
- package/es/image/index.d.ts +1 -1
- package/es/image/index.js +10 -3
- package/es/image/models/dataImage.d.ts +1 -1
- package/es/image/models/dataImage.js +14 -39
- package/es/image/models/image.js +5 -10
- package/es/image/models/index.d.ts +1 -1
- package/es/image/models/index.js +3 -1
- package/es/image/models/tileDataImage.d.ts +19 -0
- package/es/image/models/tileDataImage.js +174 -0
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +8 -2
- package/es/line/models/arc.js +10 -10
- package/es/line/models/arc_3d.js +8 -10
- package/es/line/models/earthArc_3d.js +8 -10
- package/es/line/models/great_circle.js +7 -7
- package/es/line/models/half.js +3 -4
- package/es/line/models/line.js +10 -9
- package/es/line/models/linearline.js +3 -4
- package/es/line/models/simpleLine.js +5 -4
- package/es/line/models/simpleTileLine.d.ts +9 -0
- package/es/line/models/simpleTileLine.js +100 -0
- package/es/line/models/tile.d.ts +1 -4
- package/es/line/models/tile.js +50 -223
- package/es/line/models/wall.js +11 -47
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/es/line/shaders/line_arc2d_vert.glsl +2 -2
- package/es/line/shaders/line_arc_3d_frag.glsl +10 -10
- package/es/line/shaders/line_arc_3d_vert.glsl +5 -6
- package/es/line/shaders/line_arc_frag.glsl +9 -10
- package/es/line/shaders/line_arc_great_circle_frag.glsl +6 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +2 -3
- package/es/line/shaders/line_arc_vert.glsl +6 -4
- package/es/line/shaders/line_bezier_vert.glsl +2 -2
- package/es/line/shaders/line_frag.glsl +5 -6
- package/es/line/shaders/line_vert.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
- package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
- package/es/line/shaders/wall/wall_vert.glsl +77 -0
- package/es/mask/index.d.ts +1 -0
- package/es/mask/index.js +80 -5
- package/es/mask/models/fill.d.ts +2 -1
- package/es/mask/models/fill.js +13 -10
- package/es/mask/shaders/mask_vert.glsl +0 -6
- package/es/plugins/DataMappingPlugin.d.ts +4 -3
- package/es/plugins/DataMappingPlugin.js +129 -58
- package/es/plugins/DataSourcePlugin.js +3 -2
- package/es/plugins/FeatureScalePlugin.d.ts +0 -2
- package/es/plugins/FeatureScalePlugin.js +8 -51
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
- package/es/plugins/LayerAnimateStylePlugin.js +7 -27
- package/es/plugins/LayerModelPlugin.js +2 -6
- package/es/plugins/LightingPlugin.js +1 -7
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +4 -16
- package/es/plugins/PixelPickingPlugin.d.ts +1 -1
- package/es/plugins/PixelPickingPlugin.js +8 -28
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/es/point/index.js +9 -6
- package/es/point/models/earthExtrude.d.ts +1 -1
- package/es/point/models/earthExtrude.js +9 -14
- package/es/point/models/earthFill.js +2 -2
- package/es/point/models/extrude.d.ts +1 -1
- package/es/point/models/extrude.js +9 -12
- package/es/point/models/fill.d.ts +1 -1
- package/es/point/models/fill.js +8 -9
- package/es/point/models/fillmage.js +5 -6
- package/es/point/models/image.js +3 -3
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +3 -3
- package/es/point/models/normal.d.ts +0 -1
- package/es/point/models/normal.js +9 -62
- package/es/point/models/radar.js +5 -70
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +2 -11
- package/es/point/models/text.js +7 -10
- package/es/point/models/tile.d.ts +0 -7
- package/es/point/models/tile.js +24 -158
- package/es/point/models/tileText.d.ts +0 -4
- package/es/point/models/tileText.js +99 -188
- package/es/point/shaders/animate/wave_frag.glsl +4 -4
- package/es/point/shaders/earth/fill_vert.glsl +0 -1
- package/es/point/shaders/fill_vert.glsl +0 -1
- package/es/point/shaders/normal_frag.glsl +1 -10
- package/es/point/shaders/normal_vert.glsl +5 -60
- package/es/point/shaders/radar/radar_frag.glsl +4 -15
- package/es/point/shaders/radar/radar_vert.glsl +4 -54
- package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/es/point/shaders/tile/text_frag.glsl +33 -0
- package/es/point/shaders/tile/text_map_frag.glsl +31 -0
- package/es/point/shaders/tile/text_map_vert.glsl +38 -0
- package/es/point/shaders/tile/text_vert.glsl +48 -0
- package/es/polygon/index.js +6 -2
- package/es/polygon/models/extrude.js +4 -8
- package/es/polygon/models/fill.js +3 -4
- package/es/polygon/models/ocean.d.ts +0 -2
- package/es/polygon/models/ocean.js +13 -47
- package/es/polygon/models/tile.d.ts +1 -4
- package/es/polygon/models/tile.js +25 -57
- package/es/polygon/models/water.d.ts +0 -2
- package/es/polygon/models/water.js +13 -47
- package/es/polygon/shaders/polygon_frag.glsl +2 -2
- package/es/polygon/shaders/polygon_vert.glsl +2 -2
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/es/raster/buffers/triangulation.js +1 -4
- package/es/raster/index.js +6 -2
- package/es/raster/models/raster.d.ts +1 -1
- package/es/raster/models/raster.js +6 -5
- package/es/shader/minify_frag.glsl +7 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
- package/es/tile/manager/baseMapTileLayerManager.js +207 -0
- package/es/tile/manager/tileLayerManager.d.ts +2 -2
- package/es/tile/manager/tileLayerManager.js +12 -2
- package/es/tile/manager/tilePickerManager.d.ts +2 -3
- package/es/tile/manager/tilePickerManager.js +1 -2
- package/es/tile/models/tileModel.d.ts +1 -0
- package/es/tile/models/tileModel.js +18 -2
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +58 -33
- package/es/tile/tileFactory/line.js +3 -0
- package/es/tile/tileFactory/point.js +3 -0
- package/es/tile/tileFactory/polygon.js +3 -0
- package/es/tile/tileFactory/raster.js +3 -0
- package/es/tile/tileFactory/rasterData.js +3 -0
- package/es/tile/tileFactory/rasterDataLayer.js +6 -2
- package/es/tile/tileFactory/test.js +26 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
- package/es/tile/tileFactory/vectorLayer.js +110 -7
- package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
- package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
- package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
- package/es/tile/tileLayer/baseTileLayer.js +46 -75
- package/es/tile/tileTest.d.ts +1 -0
- package/es/tile/tileTest.js +3 -2
- package/es/tile/tmsMapTileLayer.d.ts +9 -0
- package/es/tile/tmsMapTileLayer.js +119 -0
- package/es/tile/tmsTileLayer.d.ts +2 -0
- package/es/tile/tmsTileLayer.js +24 -2
- package/es/tile/utils.d.ts +4 -0
- package/es/tile/utils.js +30 -0
- package/es/utils/dataMappingStyle.js +3 -0
- package/es/utils/layerData.js +2 -2
- package/es/utils/updateShape.js +2 -2
- package/es/wind/index.js +6 -2
- package/es/wind/models/wind.js +8 -8
- package/es/wind/shaders/wind_vert.glsl +1 -1
- package/lib/Geometry/index.js +6 -2
- package/lib/Geometry/models/billboard.js +3 -7
- package/lib/Geometry/models/plane.js +5 -7
- package/lib/Geometry/models/sprite.js +4 -7
- package/lib/canvas/index.js +37 -2
- package/lib/citybuliding/building.js +6 -2
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +61 -85
- package/lib/core/BaseModel.js +22 -19
- package/lib/core/triangulation.js +66 -2
- package/lib/earth/index.js +3 -1
- package/lib/earth/models/atmosphere.js +4 -7
- package/lib/earth/models/base.js +12 -18
- package/lib/earth/models/bloomsphere.js +4 -8
- package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
- package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/lib/heatmap/index.js +7 -5
- package/lib/heatmap/models/grid.js +1 -3
- package/lib/heatmap/models/grid3d.js +4 -11
- package/lib/heatmap/models/heatmap.js +8 -9
- package/lib/heatmap/models/hexagon.js +2 -6
- package/lib/heatmap/triangulation.js +0 -1
- package/lib/image/index.js +10 -3
- package/lib/image/models/dataImage.js +13 -38
- package/lib/image/models/image.js +5 -10
- package/lib/image/models/index.js +4 -1
- package/lib/image/models/tileDataImage.js +188 -0
- package/lib/line/index.js +7 -2
- package/lib/line/models/arc.js +10 -10
- package/lib/line/models/arc_3d.js +8 -10
- package/lib/line/models/earthArc_3d.js +8 -10
- package/lib/line/models/great_circle.js +7 -7
- package/lib/line/models/half.js +3 -4
- package/lib/line/models/line.js +10 -9
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +5 -4
- package/lib/line/models/simpleTileLine.js +115 -0
- package/lib/line/models/tile.js +50 -224
- package/lib/line/models/wall.js +11 -47
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/lib/line/shaders/line_arc2d_vert.glsl +2 -2
- package/lib/line/shaders/line_arc_3d_frag.glsl +10 -10
- package/lib/line/shaders/line_arc_3d_vert.glsl +5 -6
- package/lib/line/shaders/line_arc_frag.glsl +9 -10
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +2 -3
- package/lib/line/shaders/line_arc_vert.glsl +6 -4
- package/lib/line/shaders/line_bezier_vert.glsl +2 -2
- package/lib/line/shaders/line_frag.glsl +5 -6
- package/lib/line/shaders/line_vert.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
- package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
- package/lib/line/shaders/wall/wall_vert.glsl +77 -0
- package/lib/mask/index.js +82 -5
- package/lib/mask/models/fill.js +14 -10
- package/lib/mask/shaders/mask_vert.glsl +0 -6
- package/lib/plugins/DataMappingPlugin.js +127 -57
- package/lib/plugins/DataSourcePlugin.js +3 -2
- package/lib/plugins/FeatureScalePlugin.js +6 -50
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
- package/lib/plugins/LayerModelPlugin.js +2 -6
- package/lib/plugins/LightingPlugin.js +1 -7
- package/lib/plugins/MultiPassRendererPlugin.js +3 -19
- package/lib/plugins/PixelPickingPlugin.js +8 -28
- package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/lib/point/index.js +9 -6
- package/lib/point/models/earthExtrude.js +9 -14
- package/lib/point/models/earthFill.js +2 -2
- package/lib/point/models/extrude.js +9 -12
- package/lib/point/models/fill.js +8 -9
- package/lib/point/models/fillmage.js +5 -6
- package/lib/point/models/image.js +3 -3
- package/lib/point/models/index.js +1 -1
- package/lib/point/models/normal.js +8 -61
- package/lib/point/models/radar.js +5 -70
- package/lib/point/models/simplePoint.js +1 -10
- package/lib/point/models/text.js +7 -10
- package/lib/point/models/tile.js +23 -159
- package/lib/point/models/tileText.js +98 -187
- package/lib/point/shaders/animate/wave_frag.glsl +4 -4
- package/lib/point/shaders/earth/fill_vert.glsl +0 -1
- package/lib/point/shaders/fill_vert.glsl +0 -1
- package/lib/point/shaders/normal_frag.glsl +1 -10
- package/lib/point/shaders/normal_vert.glsl +5 -60
- package/lib/point/shaders/radar/radar_frag.glsl +4 -15
- package/lib/point/shaders/radar/radar_vert.glsl +4 -54
- package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/lib/point/shaders/tile/text_frag.glsl +33 -0
- package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
- package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
- package/lib/point/shaders/tile/text_vert.glsl +48 -0
- package/lib/polygon/index.js +6 -2
- package/lib/polygon/models/extrude.js +4 -8
- package/lib/polygon/models/fill.js +3 -4
- package/lib/polygon/models/ocean.js +14 -47
- package/lib/polygon/models/tile.js +24 -57
- package/lib/polygon/models/water.js +14 -47
- package/lib/polygon/shaders/polygon_frag.glsl +2 -2
- package/lib/polygon/shaders/polygon_vert.glsl +2 -2
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/lib/raster/buffers/triangulation.js +1 -4
- package/lib/raster/index.js +6 -2
- package/lib/raster/models/raster.js +6 -5
- package/lib/shader/minify_frag.glsl +7 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
- package/lib/tile/manager/tileLayerManager.js +12 -2
- package/lib/tile/manager/tilePickerManager.js +1 -2
- package/lib/tile/models/tileModel.js +19 -2
- package/lib/tile/tileFactory/base.js +60 -33
- package/lib/tile/tileFactory/line.js +3 -0
- package/lib/tile/tileFactory/point.js +3 -0
- package/lib/tile/tileFactory/polygon.js +3 -0
- package/lib/tile/tileFactory/raster.js +3 -0
- package/lib/tile/tileFactory/rasterData.js +3 -0
- package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
- package/lib/tile/tileFactory/test.js +26 -5
- package/lib/tile/tileFactory/vectorLayer.js +112 -8
- package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
- package/lib/tile/tileLayer/baseTileLayer.js +46 -75
- package/lib/tile/tileTest.js +3 -2
- package/lib/tile/tmsMapTileLayer.js +136 -0
- package/lib/tile/tmsTileLayer.js +25 -2
- package/lib/tile/utils.js +38 -0
- package/lib/utils/dataMappingStyle.js +3 -0
- package/lib/utils/layerData.js +2 -2
- package/lib/utils/updateShape.js +2 -2
- package/lib/wind/index.js +6 -2
- package/lib/wind/models/wind.js +7 -7
- package/lib/wind/shaders/wind_vert.glsl +1 -1
- package/package.json +8 -7
- package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/es/line/shaders/wall_vert.glsl +0 -111
- package/es/mask/shaders/mask_frag.glsl +0 -7
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
- package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/lib/line/shaders/wall_vert.glsl +0 -111
- package/lib/mask/shaders/mask_frag.glsl +0 -7
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
|
@@ -21,6 +21,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _l7Core = require("@antv/l7-core");
|
|
23
23
|
|
|
24
|
+
var _l7Maps = require("@antv/l7-maps");
|
|
25
|
+
|
|
24
26
|
var _l7Utils = require("@antv/l7-utils");
|
|
25
27
|
|
|
26
28
|
var _lodash = require("lodash");
|
|
@@ -34,10 +36,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
34
36
|
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; } }
|
|
35
37
|
|
|
36
38
|
/* babel-plugin-inline-import '../shaders/water/polygon_ocean_frag.glsl' */
|
|
37
|
-
var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\
|
|
39
|
+
var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\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 = u_opacity;\n gl_FragColor = vec4(col, opacity); \n}\n";
|
|
38
40
|
|
|
39
41
|
/* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
|
|
40
|
-
var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\
|
|
42
|
+
var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 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";
|
|
41
43
|
|
|
42
44
|
var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
43
45
|
(0, _inherits2.default)(OceanModel, _BaseModel);
|
|
@@ -60,47 +62,12 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
60
62
|
_ref$watercolor2 = _ref.watercolor2,
|
|
61
63
|
watercolor2 = _ref$watercolor2 === void 0 ? '#0F121C' : _ref$watercolor2;
|
|
62
64
|
|
|
63
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
64
|
-
opacity: opacity
|
|
65
|
-
})) {
|
|
66
|
-
this.judgeStyleAttributes({
|
|
67
|
-
opacity: opacity
|
|
68
|
-
});
|
|
69
|
-
var encodeData = this.layer.getEncodedData();
|
|
70
|
-
|
|
71
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
72
|
-
data = _this$calDataFrame.data,
|
|
73
|
-
width = _this$calDataFrame.width,
|
|
74
|
-
height = _this$calDataFrame.height;
|
|
75
|
-
|
|
76
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
77
|
-
|
|
78
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
79
|
-
flipY: true,
|
|
80
|
-
data: data,
|
|
81
|
-
format: _l7Core.gl.LUMINANCE,
|
|
82
|
-
type: _l7Core.gl.FLOAT,
|
|
83
|
-
width: width,
|
|
84
|
-
height: height
|
|
85
|
-
}) : this.createTexture2D({
|
|
86
|
-
flipY: true,
|
|
87
|
-
data: [1],
|
|
88
|
-
format: _l7Core.gl.LUMINANCE,
|
|
89
|
-
type: _l7Core.gl.FLOAT,
|
|
90
|
-
width: 1,
|
|
91
|
-
height: 1
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
65
|
return {
|
|
96
66
|
u_texture1: this.texture1,
|
|
97
67
|
u_texture2: this.texture2,
|
|
98
68
|
u_texture3: this.texture3,
|
|
99
69
|
u_watercolor: (0, _l7Utils.rgb2arr)(watercolor),
|
|
100
70
|
u_watercolor2: (0, _l7Utils.rgb2arr)(watercolor2),
|
|
101
|
-
u_dataTexture: this.dataTexture,
|
|
102
|
-
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
103
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
104
71
|
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
|
|
105
72
|
};
|
|
106
73
|
}
|
|
@@ -135,7 +102,8 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
135
102
|
depth: {
|
|
136
103
|
enable: false
|
|
137
104
|
},
|
|
138
|
-
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
105
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside),
|
|
106
|
+
pick: false
|
|
139
107
|
}).then(function (model) {
|
|
140
108
|
callbackModel([model]);
|
|
141
109
|
}).catch(function (err) {
|
|
@@ -146,12 +114,11 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
146
114
|
}, {
|
|
147
115
|
key: "clearModels",
|
|
148
116
|
value: function clearModels() {
|
|
149
|
-
var _this$texture, _this$texture2, _this$texture3
|
|
117
|
+
var _this$texture, _this$texture2, _this$texture3;
|
|
150
118
|
|
|
151
119
|
(_this$texture = this.texture1) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
152
120
|
(_this$texture2 = this.texture2) === null || _this$texture2 === void 0 ? void 0 : _this$texture2.destroy();
|
|
153
121
|
(_this$texture3 = this.texture3) === null || _this$texture3 === void 0 ? void 0 : _this$texture3.destroy();
|
|
154
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
155
122
|
}
|
|
156
123
|
}, {
|
|
157
124
|
key: "registerBuiltinAttributes",
|
|
@@ -178,10 +145,12 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
178
145
|
type: _l7Core.gl.FLOAT
|
|
179
146
|
},
|
|
180
147
|
size: 2,
|
|
181
|
-
update: function update(feature, featureIdx, vertex, attributeIdx
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
148
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
149
|
+
var v = feature.version === _l7Maps.Version['GAODE2.x'] ? feature.originCoordinates[0][attributeIdx] : vertex;
|
|
150
|
+
|
|
151
|
+
var _v = (0, _slicedToArray2.default)(v, 2),
|
|
152
|
+
lng = _v[0],
|
|
153
|
+
lat = _v[1];
|
|
185
154
|
|
|
186
155
|
return [(lng - minLng) / lngLen, (lat - minLat) / latLen];
|
|
187
156
|
}
|
|
@@ -208,9 +177,7 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
208
177
|
_this.texture2 = initTex(images[1]);
|
|
209
178
|
_this.texture3 = initTex(images[2]);
|
|
210
179
|
|
|
211
|
-
_this.layerService.
|
|
212
|
-
|
|
213
|
-
_this.layerService.renderLayers();
|
|
180
|
+
_this.layerService.reRender();
|
|
214
181
|
});
|
|
215
182
|
|
|
216
183
|
function initImage(callback) {
|
|
@@ -17,8 +17,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
17
17
|
|
|
18
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
19
|
|
|
20
|
-
var _l7Core = require("@antv/l7-core");
|
|
21
|
-
|
|
22
20
|
var _l7Utils = require("@antv/l7-utils");
|
|
23
21
|
|
|
24
22
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
@@ -29,11 +27,17 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
29
27
|
|
|
30
28
|
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; } }
|
|
31
29
|
|
|
32
|
-
/* babel-plugin-inline-import '
|
|
33
|
-
var polygon_tile_frag = "uniform float u_opacity: 1.0;\nvarying vec4
|
|
30
|
+
/* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
|
|
31
|
+
var polygon_tile_frag = "uniform float u_opacity : 1.0;\nvarying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
34
32
|
|
|
35
33
|
/* babel-plugin-inline-import '../shaders/tile/polygon_tile_vert.glsl' */
|
|
36
|
-
var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\
|
|
34
|
+
var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nvarying vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n // if(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 // 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 = a_Position.xy * 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 setPickingColor(a_PickingColor);\n}\n\n";
|
|
35
|
+
|
|
36
|
+
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
37
|
+
var polygon_tile_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
38
|
+
|
|
39
|
+
/* babel-plugin-inline-import '../shaders/tile/polygon_tile_map_vert.glsl' */
|
|
40
|
+
var polygon_tile_map_vert = "attribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 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}";
|
|
37
41
|
|
|
38
42
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
39
43
|
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
@@ -51,49 +55,15 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
51
55
|
var _ref = this.layer.getLayerConfig(),
|
|
52
56
|
_ref$opacity = _ref.opacity,
|
|
53
57
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
54
|
-
|
|
55
|
-
_ref$
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
59
|
-
opacity: opacity
|
|
60
|
-
})) {
|
|
61
|
-
this.judgeStyleAttributes({
|
|
62
|
-
opacity: opacity
|
|
63
|
-
});
|
|
64
|
-
var encodeData = this.layer.getEncodedData();
|
|
65
|
-
|
|
66
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
67
|
-
data = _this$calDataFrame.data,
|
|
68
|
-
width = _this$calDataFrame.width,
|
|
69
|
-
height = _this$calDataFrame.height;
|
|
70
|
-
|
|
71
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
72
|
-
|
|
73
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
74
|
-
flipY: true,
|
|
75
|
-
data: data,
|
|
76
|
-
format: _l7Core.gl.LUMINANCE,
|
|
77
|
-
type: _l7Core.gl.FLOAT,
|
|
78
|
-
width: width,
|
|
79
|
-
height: height
|
|
80
|
-
}) : this.createTexture2D({
|
|
81
|
-
flipY: true,
|
|
82
|
-
data: [1],
|
|
83
|
-
format: _l7Core.gl.LUMINANCE,
|
|
84
|
-
type: _l7Core.gl.FLOAT,
|
|
85
|
-
width: 1,
|
|
86
|
-
height: 1
|
|
87
|
-
});
|
|
88
|
-
}
|
|
58
|
+
usage = _ref.usage,
|
|
59
|
+
_ref$color = _ref.color,
|
|
60
|
+
color = _ref$color === void 0 ? '#fff' : _ref$color;
|
|
89
61
|
|
|
90
62
|
return {
|
|
91
|
-
u_tileOrigin: tileOrigin || [0, 0],
|
|
92
|
-
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
96
|
-
u_opacity: opacity
|
|
63
|
+
// u_tileOrigin: tileOrigin || [0, 0],
|
|
64
|
+
// u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
65
|
+
u_opacity: opacity,
|
|
66
|
+
u_color: usage === 'basemap' ? (0, _l7Utils.rgb2arr)(color) : [0, 0, 0, 0]
|
|
97
67
|
};
|
|
98
68
|
}
|
|
99
69
|
}, {
|
|
@@ -108,20 +78,21 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
108
78
|
_ref2$mask = _ref2.mask,
|
|
109
79
|
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
110
80
|
_ref2$maskInside = _ref2.maskInside,
|
|
111
|
-
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside
|
|
81
|
+
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
|
|
82
|
+
usage = _ref2.usage;
|
|
112
83
|
|
|
113
84
|
this.layer.triangulation = _triangulation.polygonTriangulation;
|
|
114
85
|
this.layer.buildLayerModel({
|
|
115
|
-
moduleName: '
|
|
116
|
-
vertexShader: polygon_tile_vert,
|
|
117
|
-
fragmentShader: polygon_tile_frag,
|
|
86
|
+
moduleName: 'polygonTile_' + usage,
|
|
87
|
+
vertexShader: usage === 'basemap' ? polygon_tile_map_vert : polygon_tile_vert,
|
|
88
|
+
fragmentShader: usage === 'basemap' ? polygon_tile_map_frag : polygon_tile_frag,
|
|
118
89
|
triangulation: _triangulation.polygonTriangulation,
|
|
119
|
-
primitive: _l7Core.gl.TRIANGLES,
|
|
120
90
|
depth: {
|
|
121
91
|
enable: false
|
|
122
92
|
},
|
|
123
93
|
blend: this.getBlend(),
|
|
124
|
-
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
94
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside),
|
|
95
|
+
pick: usage !== 'basemap'
|
|
125
96
|
}).then(function (model) {
|
|
126
97
|
callbackModel([model]);
|
|
127
98
|
}).catch(function (err) {
|
|
@@ -131,11 +102,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
131
102
|
}
|
|
132
103
|
}, {
|
|
133
104
|
key: "clearModels",
|
|
134
|
-
value: function clearModels() {
|
|
135
|
-
var _this$dataTexture;
|
|
136
|
-
|
|
137
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
138
|
-
}
|
|
105
|
+
value: function clearModels() {}
|
|
139
106
|
}, {
|
|
140
107
|
key: "registerBuiltinAttributes",
|
|
141
108
|
value: function registerBuiltinAttributes() {//
|
|
@@ -21,6 +21,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _l7Core = require("@antv/l7-core");
|
|
23
23
|
|
|
24
|
+
var _l7Maps = require("@antv/l7-maps");
|
|
25
|
+
|
|
24
26
|
var _l7Utils = require("@antv/l7-utils");
|
|
25
27
|
|
|
26
28
|
var _lodash = require("lodash");
|
|
@@ -34,10 +36,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
34
36
|
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; } }
|
|
35
37
|
|
|
36
38
|
/* babel-plugin-inline-import '../shaders/water/polygon_water_frag.glsl' */
|
|
37
|
-
var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nuniform float u_speed: 1.0;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\
|
|
39
|
+
var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nuniform float u_speed: 1.0;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\n\nfloat rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }\n\nfloat water(vec3 p) {\n float t = u_time * u_speed;\n p.z += t * 2.; p.x += t * 2.;\n vec3 c1 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 3.; p.x += t * 0.52;\n vec3 c2 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 4.; p.x += t * 0.8;\n vec3 c3 = texture2D(u_texture, p.xz / 30.).xyz;\n c1 += c2 - c3;\n float z = (c1.x + c1.y + c1.z) / 3.;\n return p.y + z / 4.;\n}\n\nfloat map(vec3 p) {\n float d = 100.0;\n d = water(p);\n return d;\n}\n\nfloat intersect(vec3 ro, vec3 rd) {\n float d = 0.0;\n for (int i = 0; i <= 100; i++) {\n float h = map(ro + rd * d);\n if (h < 0.1) return d;\n d += h;\n }\n return 0.0;\n}\n\nvec3 norm(vec3 p) {\n float eps = .1;\n return normalize(vec3(\n map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),\n map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),\n map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))\n ));\n} \n\nfloat calSpc() {\n vec3 l1 = normalize(vec3(1, 1, 1));\n vec3 ro = vec3(-3, 20, -8);\n vec3 rc = vec3(0, 0, 0);\n vec3 ww = normalize(rc - ro);\n vec3 uu = normalize(cross(vec3(0,1,0), ww));\n vec3 vv = normalize(cross(rc - ro, uu));\n vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);\n float d = intersect(ro, rd);\n vec3 p = ro + rd * d;\n vec3 n = norm(p);\n float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);\n return spc;\n}\n\nvoid main() {\n float opacity = u_opacity;\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n\n float spc = calSpc();\n gl_FragColor += spc * 0.4;\n}\n";
|
|
38
40
|
|
|
39
41
|
/* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
|
|
40
|
-
var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\
|
|
42
|
+
var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 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";
|
|
41
43
|
|
|
42
44
|
var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
43
45
|
(0, _inherits2.default)(WaterModel, _BaseModel);
|
|
@@ -58,43 +60,8 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
58
60
|
_ref$speed = _ref.speed,
|
|
59
61
|
speed = _ref$speed === void 0 ? 0.5 : _ref$speed;
|
|
60
62
|
|
|
61
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
62
|
-
opacity: opacity
|
|
63
|
-
})) {
|
|
64
|
-
this.judgeStyleAttributes({
|
|
65
|
-
opacity: opacity
|
|
66
|
-
});
|
|
67
|
-
var encodeData = this.layer.getEncodedData();
|
|
68
|
-
|
|
69
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
70
|
-
data = _this$calDataFrame.data,
|
|
71
|
-
width = _this$calDataFrame.width,
|
|
72
|
-
height = _this$calDataFrame.height;
|
|
73
|
-
|
|
74
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
75
|
-
|
|
76
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
77
|
-
flipY: true,
|
|
78
|
-
data: data,
|
|
79
|
-
format: _l7Core.gl.LUMINANCE,
|
|
80
|
-
type: _l7Core.gl.FLOAT,
|
|
81
|
-
width: width,
|
|
82
|
-
height: height
|
|
83
|
-
}) : this.createTexture2D({
|
|
84
|
-
flipY: true,
|
|
85
|
-
data: [1],
|
|
86
|
-
format: _l7Core.gl.LUMINANCE,
|
|
87
|
-
type: _l7Core.gl.FLOAT,
|
|
88
|
-
width: 1,
|
|
89
|
-
height: 1
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
63
|
return {
|
|
94
64
|
u_texture: this.texture,
|
|
95
|
-
u_dataTexture: this.dataTexture,
|
|
96
|
-
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
97
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
98
65
|
u_speed: speed,
|
|
99
66
|
u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
|
|
100
67
|
};
|
|
@@ -130,7 +97,8 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
130
97
|
depth: {
|
|
131
98
|
enable: false
|
|
132
99
|
},
|
|
133
|
-
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
100
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside),
|
|
101
|
+
pick: false
|
|
134
102
|
}).then(function (model) {
|
|
135
103
|
callbackModel([model]);
|
|
136
104
|
}).catch(function (err) {
|
|
@@ -141,10 +109,9 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
109
|
}, {
|
|
142
110
|
key: "clearModels",
|
|
143
111
|
value: function clearModels() {
|
|
144
|
-
var _this$texture
|
|
112
|
+
var _this$texture;
|
|
145
113
|
|
|
146
114
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
147
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
148
115
|
}
|
|
149
116
|
}, {
|
|
150
117
|
key: "registerBuiltinAttributes",
|
|
@@ -171,10 +138,12 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
171
138
|
type: _l7Core.gl.FLOAT
|
|
172
139
|
},
|
|
173
140
|
size: 2,
|
|
174
|
-
update: function update(feature, featureIdx, vertex, attributeIdx
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
141
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
142
|
+
var v = feature.version === _l7Maps.Version['GAODE2.x'] ? feature.originCoordinates[0][attributeIdx] : vertex;
|
|
143
|
+
|
|
144
|
+
var _v = (0, _slicedToArray2.default)(v, 2),
|
|
145
|
+
lng = _v[0],
|
|
146
|
+
lat = _v[1];
|
|
178
147
|
|
|
179
148
|
return [(lng - minLng) / lngLen, (lat - minLat) / latLen];
|
|
180
149
|
}
|
|
@@ -217,9 +186,7 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
217
186
|
mag: _l7Core.gl.LINEAR
|
|
218
187
|
});
|
|
219
188
|
|
|
220
|
-
_this.layerService.
|
|
221
|
-
|
|
222
|
-
_this.layerService.renderLayers();
|
|
189
|
+
_this.layerService.reRender();
|
|
223
190
|
};
|
|
224
191
|
}
|
|
225
192
|
}]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
uniform float u_opacity: 1.0;
|
|
2
|
-
varying vec4
|
|
2
|
+
varying vec4 v_color;
|
|
3
3
|
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
4
4
|
|
|
5
5
|
#pragma include "picking"
|
|
6
6
|
|
|
7
7
|
void main() {
|
|
8
8
|
float opacity = styleMappingMat[0][0];
|
|
9
|
-
gl_FragColor =
|
|
9
|
+
gl_FragColor = v_color;
|
|
10
10
|
gl_FragColor.a *= opacity;
|
|
11
11
|
gl_FragColor = filterColor(gl_FragColor);
|
|
12
12
|
}
|
|
@@ -7,7 +7,7 @@ uniform mat4 u_Mvp;
|
|
|
7
7
|
uniform float u_opacity: 1.0;
|
|
8
8
|
uniform float u_raisingHeight: 0.0;
|
|
9
9
|
|
|
10
|
-
varying vec4
|
|
10
|
+
varying vec4 v_color;
|
|
11
11
|
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
12
12
|
|
|
13
13
|
#pragma include "styleMapping"
|
|
@@ -43,7 +43,7 @@ styleMappingMat = mat4(
|
|
|
43
43
|
textureOffset = opacityAndOffset.g;
|
|
44
44
|
// cal style mapping - 数据纹理映射部分的计算
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
v_color = a_Color;
|
|
47
47
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
48
48
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
49
49
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
attribute vec3 a_Position;
|
|
2
|
+
|
|
3
|
+
uniform mat4 u_ModelMatrix;
|
|
4
|
+
uniform mat4 u_Mvp;
|
|
5
|
+
|
|
6
|
+
#pragma include "projection"
|
|
7
|
+
|
|
8
|
+
void main() {
|
|
9
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
10
|
+
|
|
11
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
12
|
+
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
13
|
+
} else {
|
|
14
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -4,78 +4,38 @@ attribute vec3 a_Position;
|
|
|
4
4
|
uniform mat4 u_ModelMatrix;
|
|
5
5
|
uniform mat4 u_Mvp;
|
|
6
6
|
|
|
7
|
-
uniform
|
|
7
|
+
// uniform vec2 u_tileOrigin;
|
|
8
|
+
// uniform float u_coord;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
uniform float u_coord;
|
|
11
|
-
|
|
12
|
-
varying vec4 v_Color;
|
|
13
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
14
|
-
|
|
15
|
-
#pragma include "styleMapping"
|
|
16
|
-
#pragma include "styleMappingCalOpacity"
|
|
10
|
+
varying vec4 v_color;
|
|
17
11
|
|
|
18
12
|
#pragma include "projection"
|
|
19
13
|
#pragma include "picking"
|
|
20
14
|
|
|
21
15
|
void main() {
|
|
22
|
-
|
|
23
|
-
styleMappingMat = mat4(
|
|
24
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
25
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
26
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
27
|
-
0.0, 0.0, 0.0, 0.0
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
31
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
32
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
33
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
34
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
35
|
-
float id = a_vertexId; // 第n个顶点
|
|
36
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
37
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
38
|
-
|
|
39
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
40
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
41
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
42
|
-
|
|
43
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
44
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
45
|
-
textureOffset = opacityAndOffset.g;
|
|
46
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
47
|
-
|
|
48
|
-
v_Color = a_Color;
|
|
16
|
+
v_color = a_Color;
|
|
49
17
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
50
18
|
|
|
19
|
+
// if(u_coord > 0.0) {
|
|
20
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
21
|
+
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
22
|
+
} else {
|
|
23
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
24
|
+
}
|
|
25
|
+
// } else {
|
|
26
|
+
// vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
54
|
-
project_pos.z *= mapboxZoomScale;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if(u_coord > 0.0) {
|
|
58
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
59
|
-
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
60
|
-
} else {
|
|
61
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
vec2 pointPos = a_Position.xy;
|
|
65
|
-
vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
|
|
66
|
-
|
|
67
|
-
vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
|
|
28
|
+
// vec2 pointOffset = a_Position.xy * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
|
|
68
29
|
|
|
69
|
-
|
|
30
|
+
// world.xy += pointOffset;
|
|
70
31
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;
|
|
77
|
-
}
|
|
32
|
+
// if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
33
|
+
// // Needs to be divided with project_uCommonUnitsPerMeter
|
|
34
|
+
// world.w *= u_PixelsPerMeter.z;
|
|
35
|
+
// }
|
|
78
36
|
|
|
37
|
+
// gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;
|
|
38
|
+
// }
|
|
79
39
|
|
|
80
40
|
setPickingColor(a_PickingColor);
|
|
81
41
|
}
|
|
@@ -3,7 +3,6 @@ uniform float u_time: 0.0;
|
|
|
3
3
|
uniform float u_opacity: 1.0;
|
|
4
4
|
|
|
5
5
|
varying vec2 v_uv;
|
|
6
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
7
6
|
|
|
8
7
|
float coast2water_fadedepth = 0.10;
|
|
9
8
|
float large_waveheight = .750; // change to adjust the "heavy" waves
|
|
@@ -243,6 +242,6 @@ void main() {
|
|
|
243
242
|
}
|
|
244
243
|
|
|
245
244
|
|
|
246
|
-
float opacity =
|
|
245
|
+
float opacity = u_opacity;
|
|
247
246
|
gl_FragColor = vec4(col, opacity);
|
|
248
247
|
}
|
|
@@ -4,44 +4,13 @@ uniform mat4 u_ModelMatrix;
|
|
|
4
4
|
uniform mat4 u_Mvp;
|
|
5
5
|
|
|
6
6
|
varying vec2 v_uv;
|
|
7
|
-
uniform float u_opacity: 1.0;
|
|
8
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
9
|
-
|
|
10
|
-
#pragma include "styleMapping"
|
|
11
|
-
#pragma include "styleMappingCalOpacity"
|
|
12
7
|
|
|
13
8
|
#pragma include "projection"
|
|
14
9
|
|
|
15
10
|
void main() {
|
|
16
11
|
v_uv = a_uv;
|
|
17
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
18
|
-
styleMappingMat = mat4(
|
|
19
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
20
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
21
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
22
|
-
0.0, 0.0, 0.0, 0.0
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
26
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
27
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
28
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
29
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
30
|
-
float id = a_vertexId; // 第n个顶点
|
|
31
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
32
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
33
|
-
|
|
34
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
35
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
36
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
37
|
-
|
|
38
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
39
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
40
|
-
textureOffset = opacityAndOffset.g;
|
|
41
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
42
12
|
|
|
43
13
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
44
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
45
14
|
|
|
46
15
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
47
16
|
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|