@antv/l7-layers 2.20.13 → 2.20.14
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/core/BaseLayer.d.ts +0 -1
- package/es/core/BaseLayer.js +8 -5
- package/es/core/LayerPickService.d.ts +1 -1
- package/es/core/LayerPickService.js +28 -10
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/models/grid.js +2 -2
- package/es/heatmap/models/grid3d.js +4 -4
- package/es/heatmap/models/heatmap.js +10 -6
- package/es/heatmap/shaders/grid/grid_frag.glsl +1 -0
- package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +9 -0
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +4 -8
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +2 -1
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +3 -1
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -0
- package/es/image/models/image.js +6 -8
- package/es/line/models/arc.js +1 -1
- package/es/line/models/line.js +10 -45
- package/es/line/shaders/arc/line_arc_frag.glsl +2 -1
- package/es/line/shaders/line/line_frag.glsl +2 -2
- package/es/line/shaders/line/line_vert.glsl +10 -7
- package/es/plugins/ShaderUniformPlugin.js +3 -2
- package/es/point/models/extrude.js +2 -2
- package/es/point/models/fill.js +1 -1
- package/es/point/models/fillImage.js +3 -5
- package/es/point/models/text.js +2 -2
- package/es/point/shaders/extrude/extrude_frag.glsl +1 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +0 -1
- package/es/point/shaders/fill/fill_frag.glsl +1 -1
- package/es/point/shaders/fillImage/fillImage_frag.glsl +1 -2
- package/es/point/shaders/text/text_frag.glsl +3 -2
- package/es/point/shaders/text/text_vert.glsl +0 -2
- package/es/polygon/models/extrude.js +30 -39
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/fill.js +3 -3
- package/es/polygon/models/water.js +6 -4
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -3
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +7 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +1 -2
- package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +1 -0
- package/es/polygon/shaders/fill/fill_frag.glsl +1 -0
- package/es/polygon/shaders/fill/fill_linear_frag.glsl +4 -3
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +5 -8
- package/es/raster/models/rasterTerrainRgb.d.ts +8 -2
- package/es/raster/models/rasterTerrainRgb.js +20 -14
- package/es/raster/shaders/terrain/terrain_rgb_frag.glsl +18 -16
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +13 -5
- package/es/tile/service/TilePickService.d.ts +1 -1
- package/es/tile/service/TilePickService.js +36 -13
- package/es/tile/tile/Tile.js +4 -3
- package/es/utils/load-image.d.ts +1 -0
- package/es/utils/load-image.js +46 -0
- package/lib/core/BaseLayer.js +8 -5
- package/lib/core/LayerPickService.js +28 -10
- package/lib/geometry/models/sprite.js +2 -2
- package/lib/heatmap/models/grid.js +2 -2
- package/lib/heatmap/models/grid3d.js +4 -4
- package/lib/heatmap/models/heatmap.js +10 -6
- package/lib/heatmap/shaders/grid/grid_frag.glsl +1 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +9 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +4 -8
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +2 -1
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +3 -1
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -0
- package/lib/image/models/image.js +6 -8
- package/lib/line/models/arc.js +1 -1
- package/lib/line/models/line.js +10 -45
- package/lib/line/shaders/arc/line_arc_frag.glsl +2 -1
- package/lib/line/shaders/line/line_frag.glsl +2 -2
- package/lib/line/shaders/line/line_vert.glsl +10 -7
- package/lib/plugins/ShaderUniformPlugin.js +3 -2
- package/lib/point/models/extrude.js +2 -2
- package/lib/point/models/fill.js +1 -1
- package/lib/point/models/fillImage.js +3 -5
- package/lib/point/models/text.js +2 -2
- package/lib/point/shaders/extrude/extrude_frag.glsl +1 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +0 -1
- package/lib/point/shaders/fill/fill_frag.glsl +1 -1
- package/lib/point/shaders/fillImage/fillImage_frag.glsl +1 -2
- package/lib/point/shaders/text/text_frag.glsl +3 -2
- package/lib/point/shaders/text/text_vert.glsl +0 -2
- package/lib/polygon/models/extrude.js +29 -38
- package/lib/polygon/models/extrusion.js +1 -1
- package/lib/polygon/models/fill.js +3 -3
- package/lib/polygon/models/water.js +6 -4
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -3
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +7 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +1 -2
- package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +1 -0
- package/lib/polygon/shaders/fill/fill_frag.glsl +1 -0
- package/lib/polygon/shaders/fill/fill_linear_frag.glsl +4 -3
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +5 -8
- package/lib/raster/models/rasterTerrainRgb.js +20 -14
- package/lib/raster/shaders/terrain/terrain_rgb_frag.glsl +18 -16
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +13 -5
- package/lib/tile/service/TilePickService.js +36 -13
- package/lib/tile/tile/Tile.js +4 -3
- package/lib/utils/load-image.js +53 -0
- package/package.json +7 -7
|
@@ -19,20 +19,21 @@ var _l7Utils = require("@antv/l7-utils");
|
|
|
19
19
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
20
20
|
var _triangulation = require("../../core/triangulation");
|
|
21
21
|
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
22
|
+
var _loadImage = require("../../utils/load-image");
|
|
22
23
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
24
|
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; } }
|
|
24
25
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
25
|
-
var polygonExtrudeFrag = "layout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n outputColor = v_Color;\n \n outputColor = filterColor(outputColor);\n}\n";
|
|
26
|
+
var polygonExtrudeFrag = "layout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n outputColor = v_Color;\n \n outputColor = filterColor(outputColor);\n}\n";
|
|
26
27
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
27
28
|
var polygonExtrudeVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \nfloat isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n // if(u_sidesurface < 1.0) {\n // discard;\n // }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
|
|
28
29
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
29
|
-
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n outputColor = v_Color;\n }\n } else {\n
|
|
30
|
+
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n\n outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if (isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if (u_sidesurface < 1.0) {\n discard;\n }\n\n if (u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n outputColor = v_Color;\n }\n } else {\n // top face\n if (u_topsurface < 1.0) {\n discard;\n }\n }\n \n outputColor.a *= opacity;\n outputColor = filterColor(outputColor);\n}\n"; // texture
|
|
30
31
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
|
|
31
|
-
var polygonExtrudeTexVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\
|
|
32
|
+
var polygonExtrudeTexVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_uvs = a_uvs;\n v_Color = a_Color;\n v_Color.a *= opacity;\n \n v_texture_data = vec2(a_Position.z, lightWeight);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
|
|
32
33
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
|
|
33
|
-
var polygonExtrudePickLightFrag = "\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n // side notuse linear\n outputColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n outputColor = v_Color;\n }\n\n outputColor = filterColorAlpha(outputColor, lightWeight);\n}\n";
|
|
34
|
+
var polygonExtrudePickLightFrag = "\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\nout vec4 outputColor;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nvoid main() {\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n // side notuse linear\n outputColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n outputColor = v_Color;\n }\n\n outputColor = filterColorAlpha(outputColor, lightWeight);\n}\n";
|
|
34
35
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
35
|
-
var polygonExtrudePickLightVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout
|
|
36
|
+
var polygonExtrudePickLightVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
36
37
|
var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
37
38
|
(0, _inherits2.default)(ExtrudeModel, _BaseModel);
|
|
38
39
|
var _super = _createSuper(ExtrudeModel);
|
|
@@ -52,6 +53,7 @@ var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
52
53
|
key: "getCommonUniformsInfo",
|
|
53
54
|
value: function getCommonUniformsInfo() {
|
|
54
55
|
var _ref = this.layer.getLayerConfig(),
|
|
56
|
+
mapTexture = _ref.mapTexture,
|
|
55
57
|
_ref$heightfixed = _ref.heightfixed,
|
|
56
58
|
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
57
59
|
_ref$raisingHeight = _ref.raisingHeight,
|
|
@@ -80,12 +82,11 @@ var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
80
82
|
u_topsurface: Number(topsurface),
|
|
81
83
|
u_sidesurface: Number(sidesurface),
|
|
82
84
|
u_heightfixed: Number(heightfixed),
|
|
83
|
-
u_raisingHeight: Number(raisingHeight)
|
|
84
|
-
// 渐变色支持参数
|
|
85
|
-
u_texture: this.texture // 纹理
|
|
85
|
+
u_raisingHeight: Number(raisingHeight)
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if (mapTexture && this.texture) {
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
commonOptions.u_texture = this.texture;
|
|
89
90
|
this.textures = [this.texture];
|
|
90
91
|
}
|
|
91
92
|
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
@@ -269,44 +270,34 @@ var ExtrudeModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
269
270
|
key: "loadTexture",
|
|
270
271
|
value: function () {
|
|
271
272
|
var _loadTexture = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
272
|
-
var
|
|
273
|
-
var _ref3, mapTexture, createTexture2D;
|
|
273
|
+
var _ref3, mapTexture, createTexture2D, image;
|
|
274
274
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
275
275
|
while (1) switch (_context3.prev = _context3.next) {
|
|
276
276
|
case 0:
|
|
277
277
|
_ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
|
|
278
278
|
createTexture2D = this.rendererService.createTexture2D;
|
|
279
279
|
this.texture = createTexture2D({
|
|
280
|
-
height:
|
|
281
|
-
width:
|
|
280
|
+
height: 1,
|
|
281
|
+
width: 1
|
|
282
282
|
});
|
|
283
283
|
if (!mapTexture) {
|
|
284
|
-
_context3.next =
|
|
284
|
+
_context3.next = 8;
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return resolve(null);
|
|
302
|
-
// this.layerService.reRender();
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
image.onerror = function () {
|
|
306
|
-
reject(new Error('image load error'));
|
|
307
|
-
};
|
|
308
|
-
}));
|
|
309
|
-
case 5:
|
|
287
|
+
_context3.next = 6;
|
|
288
|
+
return (0, _loadImage.loadImage)(mapTexture);
|
|
289
|
+
case 6:
|
|
290
|
+
image = _context3.sent;
|
|
291
|
+
this.texture = createTexture2D({
|
|
292
|
+
data: image,
|
|
293
|
+
width: image.width,
|
|
294
|
+
height: image.height,
|
|
295
|
+
wrapS: _l7Core.gl.CLAMP_TO_EDGE,
|
|
296
|
+
wrapT: _l7Core.gl.CLAMP_TO_EDGE,
|
|
297
|
+
min: _l7Core.gl.LINEAR,
|
|
298
|
+
mag: _l7Core.gl.LINEAR
|
|
299
|
+
});
|
|
300
|
+
case 8:
|
|
310
301
|
case "end":
|
|
311
302
|
return _context3.stop();
|
|
312
303
|
}
|
|
@@ -20,7 +20,7 @@ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
21
|
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; } }
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
|
|
23
|
-
var polygonExtrudeFrag = "\nin vec4 v_Color;\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_Color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
23
|
+
var polygonExtrudeFrag = "\nin vec4 v_Color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_Color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
|
|
25
25
|
var polygonExtrudeVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n\n vec4 project_pos = project_position(pos);\n float lightWeight = calc_lighting(project_pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
26
26
|
var ExtrusionModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -21,11 +21,11 @@ var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
|
21
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
22
22
|
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; } }
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
|
|
24
|
-
var polygon_frag = "in vec4 v_color;\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
24
|
+
var polygon_frag = "in vec4 v_color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
25
25
|
/* babel-plugin-inline-import '../shaders/fill/fill_linear_frag.glsl' */
|
|
26
|
-
var polygon_linear_frag = "\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nin vec3 v_linear;\nin vec2 v_pos;\
|
|
26
|
+
var polygon_linear_frag = "\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nin vec4 v_color;\nin vec3 v_linear;\nin vec2 v_pos;\nout vec4 outputColor;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nvoid main() {\n outputColor = v_color;\n if (u_opacitylinear > 0.0) {\n outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n outputColor = filterColor(outputColor);\n}\n";
|
|
27
27
|
/* babel-plugin-inline-import '../shaders/fill/fill_linear_vert.glsl' */
|
|
28
|
-
var polygon_linear_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 15) in vec3 a_linear;\n\
|
|
28
|
+
var polygon_linear_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 15) in vec3 a_linear;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nout vec4 v_color;\nout vec3 v_linear;\nout vec2 v_pos;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n if (u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
|
|
29
29
|
/* babel-plugin-inline-import '../shaders/fill/fill_vert.glsl' */
|
|
30
30
|
var polygon_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n};\n\n\nout vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
31
31
|
var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -17,8 +17,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
17
17
|
var _l7Core = require("@antv/l7-core");
|
|
18
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
19
19
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
20
|
-
var _triangulation = require("../../core/triangulation");
|
|
21
20
|
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
21
|
+
var _triangulation = require("../../core/triangulation");
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
23
|
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; } }
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/water/polygon_water_frag.glsl' */
|
|
@@ -104,7 +104,9 @@ var WaterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
104
104
|
primitive: _l7Core.gl.TRIANGLES,
|
|
105
105
|
depth: {
|
|
106
106
|
enable: false
|
|
107
|
-
}
|
|
107
|
+
},
|
|
108
|
+
pickingEnabled: false,
|
|
109
|
+
diagnosticDerivativeUniformityEnabled: false
|
|
108
110
|
});
|
|
109
111
|
case 3:
|
|
110
112
|
model = _context2.sent;
|
|
@@ -168,8 +170,8 @@ var WaterModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
168
170
|
waterTexture = _ref2.waterTexture;
|
|
169
171
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
170
172
|
this.texture = createTexture2D({
|
|
171
|
-
height:
|
|
172
|
-
width:
|
|
173
|
+
height: 1,
|
|
174
|
+
width: 1
|
|
173
175
|
});
|
|
174
176
|
var image = new Image();
|
|
175
177
|
image.crossOrigin = '';
|
|
@@ -15,10 +15,9 @@ layout(std140) uniform commonUniforms {
|
|
|
15
15
|
float u_raisingHeight;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
out vec2 v_texture_data;
|
|
19
|
-
out vec3 v_uvs;
|
|
20
18
|
out vec4 v_Color;
|
|
21
|
-
|
|
19
|
+
out vec3 v_uvs;
|
|
20
|
+
out vec2 v_texture_data;
|
|
22
21
|
|
|
23
22
|
#pragma include "projection"
|
|
24
23
|
#pragma include "light"
|
|
@@ -14,7 +14,7 @@ in vec4 v_Color;
|
|
|
14
14
|
in vec3 v_uvs;
|
|
15
15
|
in vec2 v_texture_data;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
#pragma include "scene_uniforms"
|
|
18
18
|
#pragma include "picking"
|
|
19
19
|
|
|
20
20
|
out vec4 outputColor;
|
|
@@ -26,14 +26,16 @@ void main() {
|
|
|
26
26
|
float topU = v_uvs[0];
|
|
27
27
|
float topV = 1.0 - v_uvs[1];
|
|
28
28
|
float sidey = v_uvs[2];
|
|
29
|
+
|
|
30
|
+
outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));
|
|
29
31
|
// Tip: 部分机型 GPU 计算精度兼容
|
|
30
|
-
if(isSide < 0.999) {// 是否是边缘
|
|
32
|
+
if (isSide < 0.999) {// 是否是边缘
|
|
31
33
|
// side face
|
|
32
|
-
if(u_sidesurface < 1.0) {
|
|
34
|
+
if (u_sidesurface < 1.0) {
|
|
33
35
|
discard;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
if(u_linearColor == 1.0) {
|
|
38
|
+
if (u_linearColor == 1.0) {
|
|
37
39
|
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
|
|
38
40
|
linearColor.rgb *= lightWeight;
|
|
39
41
|
outputColor = linearColor;
|
|
@@ -41,16 +43,12 @@ void main() {
|
|
|
41
43
|
outputColor = v_Color;
|
|
42
44
|
}
|
|
43
45
|
} else {
|
|
44
|
-
|
|
45
46
|
// top face
|
|
46
|
-
if(u_topsurface < 1.0) {
|
|
47
|
+
if (u_topsurface < 1.0) {
|
|
47
48
|
discard;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
outputColor.a *= opacity;
|
|
55
53
|
outputColor = filterColor(outputColor);
|
|
56
54
|
}
|
|
@@ -5,15 +5,16 @@ layout(std140) uniform commonUniforms {
|
|
|
5
5
|
float u_dir;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
in vec4 v_color;
|
|
8
9
|
in vec3 v_linear;
|
|
9
10
|
in vec2 v_pos;
|
|
10
|
-
in vec4 v_color;
|
|
11
11
|
out vec4 outputColor;
|
|
12
|
+
#pragma include "scene_uniforms"
|
|
12
13
|
#pragma include "picking"
|
|
13
14
|
|
|
14
15
|
void main() {
|
|
15
|
-
|
|
16
|
-
if(u_opacitylinear > 0.0) {
|
|
16
|
+
outputColor = v_color;
|
|
17
|
+
if (u_opacitylinear > 0.0) {
|
|
17
18
|
outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
|
|
18
19
|
}
|
|
19
20
|
outputColor = filterColor(outputColor);
|
|
@@ -2,24 +2,21 @@ layout(location = 0) in vec3 a_Position;
|
|
|
2
2
|
layout(location = 1) in vec4 a_Color;
|
|
3
3
|
layout(location = 15) in vec3 a_linear;
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
layout(std140) uniform commonUniforms {
|
|
7
6
|
float u_raisingHeight;
|
|
8
7
|
float u_opacitylinear;
|
|
9
8
|
float u_dir;
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
out vec4 v_color;
|
|
12
|
+
out vec3 v_linear;
|
|
13
|
+
out vec2 v_pos;
|
|
14
14
|
|
|
15
15
|
#pragma include "projection"
|
|
16
16
|
#pragma include "picking"
|
|
17
17
|
|
|
18
|
-
out vec3 v_linear;
|
|
19
|
-
out vec2 v_pos;
|
|
20
|
-
|
|
21
18
|
void main() {
|
|
22
|
-
if(u_opacitylinear > 0.0) {
|
|
19
|
+
if (u_opacitylinear > 0.0) {
|
|
23
20
|
v_linear = a_linear;
|
|
24
21
|
v_pos = a_Position.xy;
|
|
25
22
|
}
|
|
@@ -27,12 +24,12 @@ void main() {
|
|
|
27
24
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
28
25
|
project_pos.z += u_raisingHeight;
|
|
29
26
|
|
|
30
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
27
|
+
if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
31
28
|
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
32
29
|
project_pos.z *= mapboxZoomScale;
|
|
33
30
|
project_pos.z += u_raisingHeight * mapboxZoomScale;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
|
|
37
34
|
setPickingColor(a_PickingColor);
|
|
38
35
|
}
|
|
@@ -16,12 +16,13 @@ var _l7Core = require("@antv/l7-core");
|
|
|
16
16
|
var _l7Utils = require("@antv/l7-utils");
|
|
17
17
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
18
18
|
var _triangulation = require("../../core/triangulation");
|
|
19
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
19
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
21
|
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; } }
|
|
21
22
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_frag.glsl' */
|
|
22
|
-
var Raster_terrainFrag = "
|
|
23
|
+
var Raster_terrainFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture(SAMPLER_2D(u_colorTexture), coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n outputColor = getColor(value);\n outputColor.a = outputColor.a * u_opacity ;\n if(outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
23
24
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
|
|
24
|
-
var Raster_terrainVert = "
|
|
25
|
+
var Raster_terrainVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n bool u_clampLow;\n bool u_clampHigh;\n\n};\nout vec2 v_texCoord;\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
25
26
|
var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
27
|
(0, _inherits2.default)(RasterTerrainRGB, _BaseModel);
|
|
27
28
|
var _super = _createSuper(RasterTerrainRGB);
|
|
@@ -30,8 +31,8 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
30
31
|
return _super.apply(this, arguments);
|
|
31
32
|
}
|
|
32
33
|
(0, _createClass2.default)(RasterTerrainRGB, [{
|
|
33
|
-
key: "
|
|
34
|
-
value: function
|
|
34
|
+
key: "getCommonUniformsInfo",
|
|
35
|
+
value: function getCommonUniformsInfo() {
|
|
35
36
|
var _ref = this.layer.getLayerConfig(),
|
|
36
37
|
opacity = _ref.opacity,
|
|
37
38
|
_ref$clampLow = _ref.clampLow,
|
|
@@ -58,16 +59,19 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
58
59
|
} else {
|
|
59
60
|
this.layer.textureService.setColorTexture(colorTexture, rampColors, newdomain);
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
u_texture: this.texture,
|
|
62
|
+
var commonOptions = {
|
|
63
|
+
u_unpack: [rScaler, gScaler, bScaler, offset],
|
|
64
64
|
u_domain: newdomain,
|
|
65
|
+
u_opacity: opacity || 1,
|
|
66
|
+
u_noDataValue: noDataValue,
|
|
65
67
|
u_clampLow: clampLow,
|
|
66
68
|
u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
|
|
67
|
-
|
|
68
|
-
u_unpack: [rScaler, gScaler, bScaler, offset],
|
|
69
|
+
u_texture: this.texture,
|
|
69
70
|
u_colorTexture: texture
|
|
70
71
|
};
|
|
72
|
+
this.textures = [this.texture, texture];
|
|
73
|
+
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
74
|
+
return commonBufferInfo;
|
|
71
75
|
}
|
|
72
76
|
}, {
|
|
73
77
|
key: "initModels",
|
|
@@ -77,11 +81,12 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
77
81
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
78
82
|
while (1) switch (_context.prev = _context.next) {
|
|
79
83
|
case 0:
|
|
84
|
+
this.initUniformsBuffer();
|
|
80
85
|
source = this.layer.getSource();
|
|
81
86
|
createTexture2D = this.rendererService.createTexture2D;
|
|
82
|
-
_context.next =
|
|
87
|
+
_context.next = 5;
|
|
83
88
|
return source.data.images;
|
|
84
|
-
case
|
|
89
|
+
case 5:
|
|
85
90
|
imageData = _context.sent;
|
|
86
91
|
this.texture = createTexture2D({
|
|
87
92
|
data: imageData[0],
|
|
@@ -90,7 +95,7 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
90
95
|
min: _l7Core.gl.LINEAR,
|
|
91
96
|
mag: _l7Core.gl.LINEAR
|
|
92
97
|
});
|
|
93
|
-
_context.next =
|
|
98
|
+
_context.next = 9;
|
|
94
99
|
return this.layer.buildLayerModel({
|
|
95
100
|
moduleName: 'RasterTileDataImage',
|
|
96
101
|
vertexShader: Raster_terrainVert,
|
|
@@ -101,10 +106,10 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
101
106
|
enable: false
|
|
102
107
|
}
|
|
103
108
|
});
|
|
104
|
-
case
|
|
109
|
+
case 9:
|
|
105
110
|
model = _context.sent;
|
|
106
111
|
return _context.abrupt("return", [model]);
|
|
107
|
-
case
|
|
112
|
+
case 11:
|
|
108
113
|
case "end":
|
|
109
114
|
return _context.stop();
|
|
110
115
|
}
|
|
@@ -148,6 +153,7 @@ var RasterTerrainRGB = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
148
153
|
type: _l7Core.AttributeType.Attribute,
|
|
149
154
|
descriptor: {
|
|
150
155
|
name: 'a_Uv',
|
|
156
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
151
157
|
buffer: {
|
|
152
158
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
153
159
|
data: [],
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
precision mediump float;
|
|
2
|
-
uniform float u_opacity: 1.0;
|
|
3
|
-
|
|
4
1
|
uniform sampler2D u_texture;
|
|
5
2
|
uniform sampler2D u_colorTexture;
|
|
6
3
|
|
|
7
|
-
|
|
4
|
+
layout(std140) uniform commonUniforms {
|
|
5
|
+
vec4 u_unpack;
|
|
6
|
+
vec2 u_domain;
|
|
7
|
+
float u_opacity;
|
|
8
|
+
float u_noDataValue;
|
|
9
|
+
bool u_clampLow;
|
|
10
|
+
bool u_clampHigh;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
in vec2 v_texCoord;
|
|
14
|
+
out vec4 outputColor;
|
|
8
15
|
|
|
9
|
-
uniform vec2 u_domain;
|
|
10
|
-
uniform float u_noDataValue;
|
|
11
|
-
uniform bool u_clampLow: true;
|
|
12
|
-
uniform bool u_clampHigh: true;
|
|
13
|
-
uniform vec4 u_unpack;
|
|
14
16
|
|
|
15
17
|
float getElevation(vec2 coord, float bias) {
|
|
16
18
|
// Convert encoded elevation value to meters
|
|
17
|
-
vec4 data =
|
|
19
|
+
vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;
|
|
18
20
|
data.a = -1.0;
|
|
19
21
|
return dot(data, u_unpack);
|
|
20
22
|
}
|
|
@@ -22,20 +24,20 @@ float getElevation(vec2 coord, float bias) {
|
|
|
22
24
|
vec4 getColor(float value) {
|
|
23
25
|
float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);
|
|
24
26
|
vec2 coord = vec2(normalisedValue, 0);
|
|
25
|
-
return
|
|
27
|
+
return texture(SAMPLER_2D(u_colorTexture), coord);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
void main() {
|
|
29
31
|
float value = getElevation(v_texCoord,0.0);
|
|
30
32
|
if (value == u_noDataValue) {
|
|
31
|
-
|
|
33
|
+
outputColor = vec4(0.0, 0, 0, 0.0);
|
|
32
34
|
} else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {
|
|
33
|
-
|
|
35
|
+
outputColor = vec4(0.0, 0, 0, 0.0);
|
|
34
36
|
} else {
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if(
|
|
38
|
+
outputColor = getColor(value);
|
|
39
|
+
outputColor.a = outputColor.a * u_opacity ;
|
|
40
|
+
if(outputColor.a < 0.01)
|
|
39
41
|
discard;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 14) in vec2 a_Uv;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
layout(std140) uniform commonUniforms {
|
|
5
|
+
vec4 u_unpack;
|
|
6
|
+
vec2 u_domain;
|
|
7
|
+
float u_opacity;
|
|
8
|
+
float u_noDataValue;
|
|
9
|
+
bool u_clampLow;
|
|
10
|
+
bool u_clampHigh;
|
|
11
|
+
|
|
12
|
+
};
|
|
13
|
+
out vec2 v_texCoord;
|
|
7
14
|
#pragma include "projection"
|
|
15
|
+
|
|
8
16
|
void main() {
|
|
9
17
|
v_texCoord = a_Uv;
|
|
10
18
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.TilePickService = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -40,20 +42,41 @@ var TilePickService = exports.TilePickService = /*#__PURE__*/function () {
|
|
|
40
42
|
}
|
|
41
43
|
}, {
|
|
42
44
|
key: "pick",
|
|
43
|
-
value: function
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
value: function () {
|
|
46
|
+
var _pick = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer, target) {
|
|
47
|
+
var container, pickingService, tile, pickLayer;
|
|
48
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
49
|
+
while (1) switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
container = this.parent.getContainer();
|
|
52
|
+
pickingService = container.get(_l7Core.TYPES.IPickingService);
|
|
53
|
+
if (!(layer.type === 'RasterLayer')) {
|
|
54
|
+
_context.next = 8;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
58
|
+
if (!(tile && tile.getMainLayer() !== undefined)) {
|
|
59
|
+
_context.next = 7;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
pickLayer = tile.getMainLayer();
|
|
63
|
+
return _context.abrupt("return", pickLayer.layerPickService.pickRasterLayer(pickLayer, target, this.parent));
|
|
64
|
+
case 7:
|
|
65
|
+
return _context.abrupt("return", false);
|
|
66
|
+
case 8:
|
|
67
|
+
this.pickRender(target);
|
|
68
|
+
return _context.abrupt("return", pickingService.pickFromPickingFBO(layer, target));
|
|
69
|
+
case 10:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
72
|
+
}
|
|
73
|
+
}, _callee, this);
|
|
74
|
+
}));
|
|
75
|
+
function pick(_x, _x2) {
|
|
76
|
+
return _pick.apply(this, arguments);
|
|
53
77
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
78
|
+
return pick;
|
|
79
|
+
}()
|
|
57
80
|
}, {
|
|
58
81
|
key: "selectFeature",
|
|
59
82
|
value: function selectFeature(pickedColors) {
|