@antv/l7-layers 2.23.3-beta.3 → 2.24.1
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/citybuilding/models/build.js +6 -3
- package/es/citybuilding/shaders/build_frag.glsl +3 -0
- package/es/citybuilding/shaders/build_vert.glsl +8 -5
- package/es/core/BaseLayer.js +2 -2
- package/es/plugins/index.d.ts +1 -1
- package/es/point/models/fill.js +1 -1
- package/es/tile/tile/Tile.d.ts +1 -1
- package/es/tile/tile/index.d.ts +1 -1
- package/lib/citybuilding/models/build.js +6 -3
- package/lib/citybuilding/shaders/build_frag.glsl +3 -0
- package/lib/citybuilding/shaders/build_vert.glsl +8 -5
- package/lib/core/BaseLayer.js +2 -2
- package/lib/plugins/index.d.ts +1 -1
- package/lib/point/models/fill.js +1 -1
- package/lib/tile/tile/Tile.d.ts +1 -1
- package/lib/tile/tile/index.d.ts +1 -1
- package/package.json +6 -6
|
@@ -5,9 +5,9 @@ import { rgb2arr } from '@antv/l7-utils';
|
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
6
|
import { PolygonExtrudeTriangulation } from "../../core/triangulation";
|
|
7
7
|
/* babel-plugin-inline-import '../shaders/build_frag.glsl' */
|
|
8
|
-
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
8
|
+
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n float u_padding1;\n float u_padding2;\n float u_padding3;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
9
9
|
/* babel-plugin-inline-import '../shaders/build_vert.glsl' */
|
|
10
|
-
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor
|
|
10
|
+
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n float u_padding1;\n float u_padding2;\n float u_padding3;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
11
11
|
export default class CityBuildModel extends BaseModel {
|
|
12
12
|
constructor(...args) {
|
|
13
13
|
super(...args);
|
|
@@ -49,7 +49,10 @@ export default class CityBuildModel extends BaseModel {
|
|
|
49
49
|
u_opacity: opacity,
|
|
50
50
|
u_near: 0,
|
|
51
51
|
u_far: 1,
|
|
52
|
-
u_time: this.layer.getLayerAnimateTime() || time
|
|
52
|
+
u_time: this.layer.getLayerAnimateTime() || time,
|
|
53
|
+
u_padding1: 0,
|
|
54
|
+
u_padding2: 0,
|
|
55
|
+
u_padding3: 0
|
|
53
56
|
};
|
|
54
57
|
const commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
55
58
|
return commonBufferInfo;
|
|
@@ -15,18 +15,21 @@ out vec4 v_Color;
|
|
|
15
15
|
out float v_worldDis;
|
|
16
16
|
|
|
17
17
|
layout(std140) uniform commonUniforms {
|
|
18
|
-
vec4 u_baseColor
|
|
19
|
-
vec4 u_brightColor
|
|
20
|
-
vec4 u_windowColor
|
|
18
|
+
vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];
|
|
19
|
+
vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];
|
|
20
|
+
vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];
|
|
21
21
|
vec4 u_circleSweepColor;
|
|
22
22
|
vec2 u_cityCenter;
|
|
23
23
|
float u_circleSweep;
|
|
24
24
|
float u_cityMinSize;
|
|
25
25
|
float u_circleSweepSpeed;
|
|
26
26
|
float u_opacity: 1.0;
|
|
27
|
-
float u_near
|
|
28
|
-
float u_far
|
|
27
|
+
float u_near: 0;
|
|
28
|
+
float u_far: 1;
|
|
29
29
|
float u_time;
|
|
30
|
+
float u_padding1;
|
|
31
|
+
float u_padding2;
|
|
32
|
+
float u_padding3;
|
|
30
33
|
};
|
|
31
34
|
#pragma include "projection"
|
|
32
35
|
#pragma include "light"
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -164,7 +164,7 @@ export default class BaseLayer extends EventEmitter {
|
|
|
164
164
|
*/
|
|
165
165
|
_defineProperty(this, "pendingStyleAttributes", []);
|
|
166
166
|
_defineProperty(this, "scaleOptions", {});
|
|
167
|
-
_defineProperty(this, "animateStartTime",
|
|
167
|
+
_defineProperty(this, "animateStartTime", 0);
|
|
168
168
|
_defineProperty(this, "animateStatus", false);
|
|
169
169
|
_defineProperty(this, "isDestroyed", false);
|
|
170
170
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
@@ -1232,7 +1232,7 @@ export default class BaseLayer extends EventEmitter {
|
|
|
1232
1232
|
*/
|
|
1233
1233
|
processRelativeCoordinates() {
|
|
1234
1234
|
const layerConfig = this.getLayerConfig();
|
|
1235
|
-
const enableRelativeCoordinates = layerConfig.enableRelativeCoordinates;
|
|
1235
|
+
const enableRelativeCoordinates = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.enableRelativeCoordinates;
|
|
1236
1236
|
if (!enableRelativeCoordinates || !this.layerSource || !this.layerSource.data) {
|
|
1237
1237
|
return;
|
|
1238
1238
|
}
|
package/es/plugins/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ import RegisterStyleAttributePlugin from './RegisterStyleAttributePlugin';
|
|
|
12
12
|
import ShaderUniformPlugin from './ShaderUniformPlugin';
|
|
13
13
|
import UpdateModelPlugin from './UpdateModelPlugin';
|
|
14
14
|
import UpdateStyleAttributePlugin from './UpdateStyleAttributePlugin';
|
|
15
|
-
export declare function createPlugins(): (
|
|
15
|
+
export declare function createPlugins(): (DataSourcePlugin | RegisterStyleAttributePlugin | FeatureScalePlugin | DataMappingPlugin | LayerStylePlugin | LayerMaskPlugin | UpdateStyleAttributePlugin | UpdateModelPlugin | MultiPassRendererPlugin | ShaderUniformPlugin | LayerAnimateStylePlugin | LightingPlugin | PixelPickingPlugin | LayerModelPlugin)[];
|
package/es/point/models/fill.js
CHANGED
|
@@ -50,7 +50,7 @@ export default class FillModel extends BaseModel {
|
|
|
50
50
|
} = this.layer.getLayerConfig();
|
|
51
51
|
return {
|
|
52
52
|
u_animate: this.animateOption2Array(animateOption),
|
|
53
|
-
u_time: this.layer.getLayerAnimateTime()
|
|
53
|
+
u_time: animateOption.enable ? this.layer.getLayerAnimateTime() : -1.0
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
getAttribute() {
|
package/es/tile/tile/Tile.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
47
47
|
enablePropagation?: boolean | undefined;
|
|
48
48
|
fitBoundsOptions?: unknown;
|
|
49
49
|
name?: string | undefined;
|
|
50
|
-
blend?: "
|
|
50
|
+
blend?: "normal" | "additive" | "subtractive" | "min" | "max" | "none" | undefined;
|
|
51
51
|
depth?: boolean | undefined;
|
|
52
52
|
pickedFeatureID?: number | undefined;
|
|
53
53
|
enableMultiPassRenderer?: boolean | undefined;
|
package/es/tile/tile/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import RasterTerrainRGBTile from './RasterTerrainRGBTile';
|
|
|
7
7
|
import RasterTile from './RasterTile';
|
|
8
8
|
import VectorTile from './VectorTile';
|
|
9
9
|
export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
|
|
10
|
-
export declare function getTileFactory(layer: ILayer): typeof DebugTile | typeof ImageTile | typeof
|
|
10
|
+
export declare function getTileFactory(layer: ILayer): typeof DebugTile | typeof ImageTile | typeof VectorTile | typeof MaskLayer | typeof RasterRGBTile | typeof RasterTile | typeof RasterTerrainRGBTile;
|
|
11
11
|
export * from '../interface';
|
|
12
12
|
export * from './Tile';
|
|
@@ -12,9 +12,9 @@ var _l7Utils = require("@antv/l7-utils");
|
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
13
|
var _triangulation = require("../../core/triangulation");
|
|
14
14
|
/* babel-plugin-inline-import '../shaders/build_frag.glsl' */
|
|
15
|
-
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
15
|
+
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n float u_padding1;\n float u_padding2;\n float u_padding3;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
16
16
|
/* babel-plugin-inline-import '../shaders/build_vert.glsl' */
|
|
17
|
-
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor
|
|
17
|
+
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n float u_padding1;\n float u_padding2;\n float u_padding3;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
18
|
class CityBuildModel extends _BaseModel.default {
|
|
19
19
|
constructor(...args) {
|
|
20
20
|
super(...args);
|
|
@@ -56,7 +56,10 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
56
56
|
u_opacity: opacity,
|
|
57
57
|
u_near: 0,
|
|
58
58
|
u_far: 1,
|
|
59
|
-
u_time: this.layer.getLayerAnimateTime() || time
|
|
59
|
+
u_time: this.layer.getLayerAnimateTime() || time,
|
|
60
|
+
u_padding1: 0,
|
|
61
|
+
u_padding2: 0,
|
|
62
|
+
u_padding3: 0
|
|
60
63
|
};
|
|
61
64
|
const commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
62
65
|
return commonBufferInfo;
|
|
@@ -15,18 +15,21 @@ out vec4 v_Color;
|
|
|
15
15
|
out float v_worldDis;
|
|
16
16
|
|
|
17
17
|
layout(std140) uniform commonUniforms {
|
|
18
|
-
vec4 u_baseColor
|
|
19
|
-
vec4 u_brightColor
|
|
20
|
-
vec4 u_windowColor
|
|
18
|
+
vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];
|
|
19
|
+
vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];
|
|
20
|
+
vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];
|
|
21
21
|
vec4 u_circleSweepColor;
|
|
22
22
|
vec2 u_cityCenter;
|
|
23
23
|
float u_circleSweep;
|
|
24
24
|
float u_cityMinSize;
|
|
25
25
|
float u_circleSweepSpeed;
|
|
26
26
|
float u_opacity: 1.0;
|
|
27
|
-
float u_near
|
|
28
|
-
float u_far
|
|
27
|
+
float u_near: 0;
|
|
28
|
+
float u_far: 1;
|
|
29
29
|
float u_time;
|
|
30
|
+
float u_padding1;
|
|
31
|
+
float u_padding2;
|
|
32
|
+
float u_padding3;
|
|
30
33
|
};
|
|
31
34
|
#pragma include "projection"
|
|
32
35
|
#pragma include "light"
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -170,7 +170,7 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
170
170
|
*/
|
|
171
171
|
(0, _defineProperty2.default)(this, "pendingStyleAttributes", []);
|
|
172
172
|
(0, _defineProperty2.default)(this, "scaleOptions", {});
|
|
173
|
-
(0, _defineProperty2.default)(this, "animateStartTime",
|
|
173
|
+
(0, _defineProperty2.default)(this, "animateStartTime", 0);
|
|
174
174
|
(0, _defineProperty2.default)(this, "animateStatus", false);
|
|
175
175
|
(0, _defineProperty2.default)(this, "isDestroyed", false);
|
|
176
176
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
@@ -1238,7 +1238,7 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
1238
1238
|
*/
|
|
1239
1239
|
processRelativeCoordinates() {
|
|
1240
1240
|
const layerConfig = this.getLayerConfig();
|
|
1241
|
-
const enableRelativeCoordinates = layerConfig.enableRelativeCoordinates;
|
|
1241
|
+
const enableRelativeCoordinates = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.enableRelativeCoordinates;
|
|
1242
1242
|
if (!enableRelativeCoordinates || !this.layerSource || !this.layerSource.data) {
|
|
1243
1243
|
return;
|
|
1244
1244
|
}
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ import RegisterStyleAttributePlugin from './RegisterStyleAttributePlugin';
|
|
|
12
12
|
import ShaderUniformPlugin from './ShaderUniformPlugin';
|
|
13
13
|
import UpdateModelPlugin from './UpdateModelPlugin';
|
|
14
14
|
import UpdateStyleAttributePlugin from './UpdateStyleAttributePlugin';
|
|
15
|
-
export declare function createPlugins(): (
|
|
15
|
+
export declare function createPlugins(): (DataSourcePlugin | RegisterStyleAttributePlugin | FeatureScalePlugin | DataMappingPlugin | LayerStylePlugin | LayerMaskPlugin | UpdateStyleAttributePlugin | UpdateModelPlugin | MultiPassRendererPlugin | ShaderUniformPlugin | LayerAnimateStylePlugin | LightingPlugin | PixelPickingPlugin | LayerModelPlugin)[];
|
package/lib/point/models/fill.js
CHANGED
|
@@ -57,7 +57,7 @@ class FillModel extends _BaseModel.default {
|
|
|
57
57
|
} = this.layer.getLayerConfig();
|
|
58
58
|
return {
|
|
59
59
|
u_animate: this.animateOption2Array(animateOption),
|
|
60
|
-
u_time: this.layer.getLayerAnimateTime()
|
|
60
|
+
u_time: animateOption.enable ? this.layer.getLayerAnimateTime() : -1.0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
getAttribute() {
|
package/lib/tile/tile/Tile.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
47
47
|
enablePropagation?: boolean | undefined;
|
|
48
48
|
fitBoundsOptions?: unknown;
|
|
49
49
|
name?: string | undefined;
|
|
50
|
-
blend?: "
|
|
50
|
+
blend?: "normal" | "additive" | "subtractive" | "min" | "max" | "none" | undefined;
|
|
51
51
|
depth?: boolean | undefined;
|
|
52
52
|
pickedFeatureID?: number | undefined;
|
|
53
53
|
enableMultiPassRenderer?: boolean | undefined;
|
package/lib/tile/tile/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import RasterTerrainRGBTile from './RasterTerrainRGBTile';
|
|
|
7
7
|
import RasterTile from './RasterTile';
|
|
8
8
|
import VectorTile from './VectorTile';
|
|
9
9
|
export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
|
|
10
|
-
export declare function getTileFactory(layer: ILayer): typeof DebugTile | typeof ImageTile | typeof
|
|
10
|
+
export declare function getTileFactory(layer: ILayer): typeof DebugTile | typeof ImageTile | typeof VectorTile | typeof MaskLayer | typeof RasterRGBTile | typeof RasterTile | typeof RasterTerrainRGBTile;
|
|
11
11
|
export * from '../interface';
|
|
12
12
|
export * from './Tile';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.1",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "https://github.com/orgs/antvis/people",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"earcut": "^2.2.1",
|
|
27
27
|
"eventemitter3": "^4.0.0",
|
|
28
28
|
"gl-matrix": "^3.1.0",
|
|
29
|
-
"@antv/l7-
|
|
30
|
-
"@antv/l7-source": "2.
|
|
31
|
-
"@antv/l7-
|
|
32
|
-
"@antv/l7-
|
|
29
|
+
"@antv/l7-core": "2.24.1",
|
|
30
|
+
"@antv/l7-source": "2.24.1",
|
|
31
|
+
"@antv/l7-utils": "2.24.1",
|
|
32
|
+
"@antv/l7-maps": "2.24.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/earcut": "^2.1.0",
|
|
36
36
|
"@types/gl-matrix": "^2.4.5",
|
|
37
|
-
"@antv/l7-test-utils": "^2.
|
|
37
|
+
"@antv/l7-test-utils": "^2.24.1"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public",
|