@deck.gl/extensions 8.10.0-alpha.1 → 8.10.0-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/LICENSE +1 -1
- package/dist/dist.dev.js +7 -4
- package/dist/es5/path-style/shaders.glsl.js +2 -2
- package/dist/es5/path-style/shaders.glsl.js.map +1 -1
- package/dist/es5/terrain/terrain-pass.js +1 -0
- package/dist/es5/terrain/terrain-pass.js.map +1 -1
- package/dist/esm/path-style/shaders.glsl.js +2 -2
- package/dist/esm/path-style/shaders.glsl.js.map +1 -1
- package/dist/esm/terrain/terrain-pass.js +1 -0
- package/dist/esm/terrain/terrain-pass.js.map +1 -1
- package/dist.min.js +41 -38
- package/package.json +3 -2
- package/src/path-style/shaders.glsl.ts +6 -4
- package/src/terrain/terrain-pass.ts +1 -0
- package/typed/path-style/shaders.glsl.d.ts +1 -1
- package/typed/path-style/shaders.glsl.d.ts.map +1 -1
- package/typed/terrain/terrain-pass.d.ts.map +1 -1
- package/typed/brushing/brushing.d.ts +0 -39
- package/typed/brushing/brushing.d.ts.map +0 -1
- package/typed/brushing/brushing.js +0 -83
- package/typed/brushing/shader-module.js +0 -116
- package/typed/clip/clip.d.ts +0 -32
- package/typed/clip/clip.d.ts.map +0 -1
- package/typed/clip/clip.js +0 -114
- package/typed/collide/collide-effect.d.ts +0 -28
- package/typed/collide/collide-effect.d.ts.map +0 -1
- package/typed/collide/collide-pass.d.ts +0 -14
- package/typed/collide/collide-pass.d.ts.map +0 -1
- package/typed/collide/collide.d.ts +0 -41
- package/typed/collide/collide.d.ts.map +0 -1
- package/typed/collide/shader-module.d.ts +0 -4
- package/typed/collide/shader-module.d.ts.map +0 -1
- package/typed/collision-filter/collision-filter.d.ts +0 -41
- package/typed/collision-filter/collision-filter.d.ts.map +0 -1
- package/typed/common/projection-utils.d.ts +0 -27
- package/typed/common/projection-utils.d.ts.map +0 -1
- package/typed/data-filter/aggregator.js +0 -98
- package/typed/data-filter/data-filter.d.ts +0 -90
- package/typed/data-filter/data-filter.d.ts.map +0 -1
- package/typed/data-filter/data-filter.js +0 -159
- package/typed/data-filter/shader-module.js +0 -152
- package/typed/fill-style/fill-style.d.ts +0 -86
- package/typed/fill-style/fill-style.d.ts.map +0 -1
- package/typed/fill-style/fill-style.js +0 -152
- package/typed/fill-style/shaders.glsl.js +0 -95
- package/typed/fp64/fp64.d.ts +0 -8
- package/typed/fp64/fp64.d.ts.map +0 -1
- package/typed/fp64/fp64.js +0 -34
- package/typed/fp64/project64.glsl.js +0 -100
- package/typed/fp64/project64.js +0 -50
- package/typed/index.js +0 -9
- package/typed/mask/mask.d.ts +0 -30
- package/typed/mask/mask.d.ts.map +0 -1
- package/typed/mask/mask.js +0 -48
- package/typed/mask/shader-module.js +0 -73
- package/typed/mask/utils.d.ts +0 -13
- package/typed/mask/utils.d.ts.map +0 -1
- package/typed/path-style/path-style.d.ts +0 -66
- package/typed/path-style/path-style.d.ts.map +0 -1
- package/typed/path-style/path-style.js +0 -107
- package/typed/path-style/shaders.glsl.js +0 -93
- package/typed/terrain/height-map.d.ts +0 -27
- package/typed/terrain/height-map.d.ts.map +0 -1
- package/typed/terrain/shader-module-offset.d.ts +0 -4
- package/typed/terrain/shader-module-offset.d.ts.map +0 -1
- package/typed/terrain/shader-module-source.d.ts +0 -4
- package/typed/terrain/shader-module-source.d.ts.map +0 -1
- package/typed/terrain/terrain.d.ts +0 -21
- package/typed/terrain/terrain.d.ts.map +0 -1
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
-
import { Texture2D } from '@luma.gl/core';
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
4
|
-
import { patternShaders } from './shaders.glsl';
|
|
5
|
-
const defaultProps = {
|
|
6
|
-
fillPatternEnabled: true,
|
|
7
|
-
fillPatternAtlas: null,
|
|
8
|
-
fillPatternMapping: null,
|
|
9
|
-
fillPatternMask: true,
|
|
10
|
-
getFillPattern: { type: 'accessor', value: d => d.pattern },
|
|
11
|
-
getFillPatternScale: { type: 'accessor', value: 1 },
|
|
12
|
-
getFillPatternOffset: { type: 'accessor', value: [0, 0] }
|
|
13
|
-
};
|
|
14
|
-
const DEFAULT_TEXTURE_PARAMETERS = {
|
|
15
|
-
[GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
|
|
16
|
-
// GL.LINEAR is the default value but explicitly set it here
|
|
17
|
-
[GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
18
|
-
// for texture boundary artifact
|
|
19
|
-
[GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
20
|
-
[GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
|
|
21
|
-
};
|
|
22
|
-
export default class FillStyleExtension extends LayerExtension {
|
|
23
|
-
constructor({ pattern = false } = {}) {
|
|
24
|
-
super({ pattern });
|
|
25
|
-
}
|
|
26
|
-
isEnabled(layer) {
|
|
27
|
-
return layer.getAttributeManager() && !layer.state.pathTesselator;
|
|
28
|
-
}
|
|
29
|
-
getShaders(extension) {
|
|
30
|
-
if (!extension.isEnabled(this)) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
modules: [extension.opts.pattern && patternShaders].filter(Boolean)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
initializeState(context, extension) {
|
|
38
|
-
if (!extension.isEnabled(this)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const attributeManager = this.getAttributeManager();
|
|
42
|
-
if (extension.opts.pattern) {
|
|
43
|
-
attributeManager.add({
|
|
44
|
-
fillPatternFrames: {
|
|
45
|
-
size: 4,
|
|
46
|
-
accessor: 'getFillPattern',
|
|
47
|
-
transform: extension.getPatternFrame.bind(this),
|
|
48
|
-
shaderAttributes: {
|
|
49
|
-
fillPatternFrames: {
|
|
50
|
-
divisor: 0
|
|
51
|
-
},
|
|
52
|
-
instanceFillPatternFrames: {
|
|
53
|
-
divisor: 1
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
fillPatternScales: {
|
|
58
|
-
size: 1,
|
|
59
|
-
accessor: 'getFillPatternScale',
|
|
60
|
-
defaultValue: 1,
|
|
61
|
-
shaderAttributes: {
|
|
62
|
-
fillPatternScales: {
|
|
63
|
-
divisor: 0
|
|
64
|
-
},
|
|
65
|
-
instanceFillPatternScales: {
|
|
66
|
-
divisor: 1
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
fillPatternOffsets: {
|
|
71
|
-
size: 2,
|
|
72
|
-
accessor: 'getFillPatternOffset',
|
|
73
|
-
shaderAttributes: {
|
|
74
|
-
fillPatternOffsets: {
|
|
75
|
-
divisor: 0
|
|
76
|
-
},
|
|
77
|
-
instanceFillPatternOffsets: {
|
|
78
|
-
divisor: 1
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
this.setState({
|
|
85
|
-
emptyTexture: new Texture2D(this.context.gl, {
|
|
86
|
-
data: new Uint8Array(4),
|
|
87
|
-
width: 1,
|
|
88
|
-
height: 1
|
|
89
|
-
})
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
updateState({ props, oldProps }, extension) {
|
|
93
|
-
if (!extension.isEnabled(this)) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (props.fillPatternAtlas && props.fillPatternAtlas !== oldProps.fillPatternAtlas) {
|
|
97
|
-
extension.loadPatternAtlas.call(this, props);
|
|
98
|
-
}
|
|
99
|
-
if (props.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) {
|
|
100
|
-
extension.loadPatternMapping.call(this, props);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
draw(params, extension) {
|
|
104
|
-
if (!extension.isEnabled(this)) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const { patternTexture } = this.state;
|
|
108
|
-
this.setModuleParameters({
|
|
109
|
-
fillPatternTexture: patternTexture || this.state.emptyTexture
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
finalizeState() {
|
|
113
|
-
const { patternTexture, emptyTexture } = this.state;
|
|
114
|
-
patternTexture?.delete();
|
|
115
|
-
emptyTexture?.delete();
|
|
116
|
-
}
|
|
117
|
-
async loadPatternAtlas({ fillPatternAtlas, fetch }) {
|
|
118
|
-
this.state.patternTexture?.delete();
|
|
119
|
-
this.setState({ patternTexture: null });
|
|
120
|
-
let image = fillPatternAtlas;
|
|
121
|
-
if (typeof image === 'string') {
|
|
122
|
-
image = await fetch(image, { propName: 'fillPatternAtlas', layer: this });
|
|
123
|
-
}
|
|
124
|
-
const patternTexture = image instanceof Texture2D
|
|
125
|
-
? image
|
|
126
|
-
: new Texture2D(this.context.gl, {
|
|
127
|
-
data: image,
|
|
128
|
-
parameters: DEFAULT_TEXTURE_PARAMETERS
|
|
129
|
-
});
|
|
130
|
-
this.setState({ patternTexture });
|
|
131
|
-
}
|
|
132
|
-
async loadPatternMapping({ fillPatternMapping, fetch }) {
|
|
133
|
-
this.setState({ patternMapping: null });
|
|
134
|
-
let patternMapping = fillPatternMapping;
|
|
135
|
-
if (typeof patternMapping === 'string') {
|
|
136
|
-
patternMapping = await fetch(patternMapping, {
|
|
137
|
-
propName: 'fillPatternMapping',
|
|
138
|
-
layer: this
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
this.setState({ patternMapping });
|
|
142
|
-
this.getAttributeManager().invalidate('getFillPattern');
|
|
143
|
-
this.setNeedsUpdate();
|
|
144
|
-
}
|
|
145
|
-
getPatternFrame(name) {
|
|
146
|
-
const { patternMapping } = this.state;
|
|
147
|
-
const def = patternMapping && patternMapping[name];
|
|
148
|
-
return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
FillStyleExtension.extensionName = 'FillStyleExtension';
|
|
152
|
-
FillStyleExtension.defaultProps = defaultProps;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { project, COORDINATE_SYSTEM } from '@deck.gl/core';
|
|
2
|
-
/*
|
|
3
|
-
* fill pattern shader module
|
|
4
|
-
*/
|
|
5
|
-
const patternVs = `
|
|
6
|
-
#ifdef NON_INSTANCED_MODEL
|
|
7
|
-
#define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
|
|
8
|
-
#define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
|
|
9
|
-
#define FILL_PATTERN_OFFSET_ATTRIB fillPatternOffsets
|
|
10
|
-
#else
|
|
11
|
-
#define FILL_PATTERN_FRAME_ATTRIB instanceFillPatternFrames
|
|
12
|
-
#define FILL_PATTERN_SCALE_ATTRIB instanceFillPatternScales
|
|
13
|
-
#define FILL_PATTERN_OFFSET_ATTRIB instanceFillPatternOffsets
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
attribute vec4 FILL_PATTERN_FRAME_ATTRIB;
|
|
17
|
-
attribute float FILL_PATTERN_SCALE_ATTRIB;
|
|
18
|
-
attribute vec2 FILL_PATTERN_OFFSET_ATTRIB;
|
|
19
|
-
|
|
20
|
-
uniform bool fill_patternEnabled;
|
|
21
|
-
uniform vec2 fill_patternTextureSize;
|
|
22
|
-
|
|
23
|
-
varying vec2 fill_uv;
|
|
24
|
-
varying vec4 fill_patternBounds;
|
|
25
|
-
varying vec3 fill_patternPlacement;
|
|
26
|
-
`;
|
|
27
|
-
const patternFs = `
|
|
28
|
-
uniform bool fill_patternEnabled;
|
|
29
|
-
uniform bool fill_patternMask;
|
|
30
|
-
uniform sampler2D fill_patternTexture;
|
|
31
|
-
uniform vec2 fill_uvCoordinateOrigin;
|
|
32
|
-
|
|
33
|
-
varying vec4 fill_patternBounds;
|
|
34
|
-
varying vec3 fill_patternPlacement;
|
|
35
|
-
varying vec2 fill_uv;
|
|
36
|
-
|
|
37
|
-
const float FILL_UV_SCALE = 512.0 / 40000000.0;
|
|
38
|
-
`;
|
|
39
|
-
const inject = {
|
|
40
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
41
|
-
fill_uv = geometry.position.xy;
|
|
42
|
-
`,
|
|
43
|
-
'vs:DECKGL_FILTER_COLOR': `
|
|
44
|
-
if (fill_patternEnabled) {
|
|
45
|
-
fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
|
|
46
|
-
fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
|
|
47
|
-
fill_patternPlacement.z = FILL_PATTERN_SCALE_ATTRIB * FILL_PATTERN_FRAME_ATTRIB.w;
|
|
48
|
-
}
|
|
49
|
-
`,
|
|
50
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
51
|
-
if (fill_patternEnabled) {
|
|
52
|
-
float scale = FILL_UV_SCALE * fill_patternPlacement.z;
|
|
53
|
-
vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uv, scale) / scale;
|
|
54
|
-
patternUV = mod(fill_patternPlacement.xy + patternUV, 1.0);
|
|
55
|
-
|
|
56
|
-
vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV;
|
|
57
|
-
|
|
58
|
-
vec4 patternColor = texture2D(fill_patternTexture, texCoords);
|
|
59
|
-
color.a *= patternColor.a;
|
|
60
|
-
if (!fill_patternMask) {
|
|
61
|
-
color.rgb = patternColor.rgb;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`
|
|
65
|
-
};
|
|
66
|
-
function getPatternUniforms(opts = {}, uniforms) {
|
|
67
|
-
if ('fillPatternTexture' in opts) {
|
|
68
|
-
const { fillPatternTexture } = opts;
|
|
69
|
-
return {
|
|
70
|
-
fill_patternTexture: fillPatternTexture,
|
|
71
|
-
fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height]
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
if (opts.viewport) {
|
|
75
|
-
const { viewport, fillPatternMask = true, fillPatternEnabled = true } = opts;
|
|
76
|
-
const { project_uCoordinateOrigin, project_uCoordinateSystem } = uniforms;
|
|
77
|
-
const coordinateOriginCommon = project_uCoordinateSystem === COORDINATE_SYSTEM.CARTESIAN
|
|
78
|
-
? project_uCoordinateOrigin
|
|
79
|
-
: viewport.projectPosition(project_uCoordinateOrigin);
|
|
80
|
-
return {
|
|
81
|
-
fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2),
|
|
82
|
-
fill_patternMask: fillPatternMask,
|
|
83
|
-
fill_patternEnabled: fillPatternEnabled
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return {};
|
|
87
|
-
}
|
|
88
|
-
export const patternShaders = {
|
|
89
|
-
name: 'fill-pattern',
|
|
90
|
-
vs: patternVs,
|
|
91
|
-
fs: patternFs,
|
|
92
|
-
inject,
|
|
93
|
-
dependencies: [project],
|
|
94
|
-
getUniforms: getPatternUniforms
|
|
95
|
-
};
|
package/typed/fp64/fp64.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LayerExtension } from '@deck.gl/core/typed';
|
|
2
|
-
import type { Layer } from '@deck.gl/core/typed';
|
|
3
|
-
/** @deprecated Adds the legacy 64-bit precision to geospatial layers. */
|
|
4
|
-
export default class Fp64Extension extends LayerExtension {
|
|
5
|
-
static extensionName: string;
|
|
6
|
-
getShaders(this: Layer): any;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=fp64.d.ts.map
|
package/typed/fp64/fp64.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fp64.d.ts","sourceRoot":"","sources":["../../src/fp64/fp64.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,cAAc,EAAoB,MAAM,eAAe,CAAC;AAGhE,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEzC,yEAAyE;AACzE,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAC,aAAa,SAAmB;IAEvC,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG;CAa7B"}
|
package/typed/fp64/fp64.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
import { LayerExtension, COORDINATE_SYSTEM } from '@deck.gl/core';
|
|
21
|
-
import project64 from './project64';
|
|
22
|
-
export default class Fp64Extension extends LayerExtension {
|
|
23
|
-
getShaders(opts) {
|
|
24
|
-
const { coordinateSystem } = this.props;
|
|
25
|
-
if (coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&
|
|
26
|
-
coordinateSystem !== COORDINATE_SYSTEM.DEFAULT) {
|
|
27
|
-
throw new Error('fp64: coordinateSystem must be LNGLAT');
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
modules: [project64]
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
Fp64Extension.extensionName = 'Fp64Extension';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
export default `\
|
|
21
|
-
|
|
22
|
-
const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
23
|
-
|
|
24
|
-
uniform vec2 project_uViewProjectionMatrixFP64[16];
|
|
25
|
-
|
|
26
|
-
// longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw
|
|
27
|
-
void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
|
|
28
|
-
|
|
29
|
-
#if defined(NVIDIA_FP64_WORKAROUND)
|
|
30
|
-
out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);
|
|
31
|
-
#else
|
|
32
|
-
out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);
|
|
33
|
-
#endif
|
|
34
|
-
out_val[1] = sum_fp64(PI_FP64,
|
|
35
|
-
log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
void project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {
|
|
40
|
-
vec2 pos_fp64[2];
|
|
41
|
-
mercatorProject_fp64(position_fp64, pos_fp64);
|
|
42
|
-
out_val[0] = mul_fp64(pos_fp64[0], WORLD_SCALE_FP64);
|
|
43
|
-
out_val[1] = mul_fp64(pos_fp64[1], WORLD_SCALE_FP64);
|
|
44
|
-
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
void project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) {
|
|
49
|
-
vec4 position64xy = vec4(
|
|
50
|
-
position.x, position64xyLow.x,
|
|
51
|
-
position.y, position64xyLow.y);
|
|
52
|
-
|
|
53
|
-
project_position_fp64(position64xy, out_val);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
vec4 project_common_position_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {
|
|
57
|
-
vec2 vertex_pos_clipspace[4];
|
|
58
|
-
mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,
|
|
59
|
-
vertex_pos_clipspace);
|
|
60
|
-
return vec4(
|
|
61
|
-
vertex_pos_clipspace[0].x,
|
|
62
|
-
vertex_pos_clipspace[1].x,
|
|
63
|
-
vertex_pos_clipspace[2].x,
|
|
64
|
-
vertex_pos_clipspace[3].x
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
vec4 project_position_to_clipspace(
|
|
69
|
-
vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition
|
|
70
|
-
) {
|
|
71
|
-
// This is the local offset to the instance position
|
|
72
|
-
vec2 offset64[4];
|
|
73
|
-
vec4_fp64(vec4(offset, 0.0), offset64);
|
|
74
|
-
|
|
75
|
-
float z = project_size(position.z);
|
|
76
|
-
|
|
77
|
-
// Apply web mercator projection (depends on coordinate system imn use)
|
|
78
|
-
vec2 projectedPosition64xy[2];
|
|
79
|
-
project_position_fp64(position.xy, position64xyLow.xy, projectedPosition64xy);
|
|
80
|
-
|
|
81
|
-
vec2 commonPosition64[4];
|
|
82
|
-
commonPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]);
|
|
83
|
-
commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);
|
|
84
|
-
commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));
|
|
85
|
-
commonPosition64[3] = vec2(1.0, 0.0);
|
|
86
|
-
|
|
87
|
-
commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);
|
|
88
|
-
|
|
89
|
-
return project_common_position_to_clipspace_fp64(commonPosition64);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
vec4 project_position_to_clipspace(
|
|
93
|
-
vec3 position, vec3 position64xyLow, vec3 offset
|
|
94
|
-
) {
|
|
95
|
-
vec4 commonPosition;
|
|
96
|
-
return project_position_to_clipspace(
|
|
97
|
-
position, position64xyLow, offset, commonPosition
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
`;
|
package/typed/fp64/project64.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
import { fp64 } from '@luma.gl/shadertools';
|
|
21
|
-
const { fp64ify, fp64ifyMatrix4 } = fp64;
|
|
22
|
-
import { project, _memoize as memoize } from '@deck.gl/core';
|
|
23
|
-
import project64Shader from './project64.glsl';
|
|
24
|
-
export default {
|
|
25
|
-
name: 'project64',
|
|
26
|
-
dependencies: [project, fp64],
|
|
27
|
-
vs: project64Shader,
|
|
28
|
-
getUniforms
|
|
29
|
-
};
|
|
30
|
-
// TODO - this module should calculate the 64 bit uniforms
|
|
31
|
-
// It is currently done by project to minimize duplicated work
|
|
32
|
-
const DEFAULT_MODULE_OPTIONS = {};
|
|
33
|
-
const getMemoizedUniforms = memoize(calculateUniforms);
|
|
34
|
-
function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
|
|
35
|
-
if (opts.viewport) {
|
|
36
|
-
const { viewProjectionMatrix, scale } = opts.viewport;
|
|
37
|
-
// We only need to update fp64 uniforms if fp32 projection is being updated
|
|
38
|
-
return getMemoizedUniforms({ viewProjectionMatrix, scale });
|
|
39
|
-
}
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
function calculateUniforms({ viewProjectionMatrix, scale }) {
|
|
43
|
-
const glViewProjectionMatrixFP64 = fp64ifyMatrix4(viewProjectionMatrix);
|
|
44
|
-
const scaleFP64 = fp64ify(scale);
|
|
45
|
-
return {
|
|
46
|
-
project_uViewProjectionMatrixFP64: glViewProjectionMatrixFP64,
|
|
47
|
-
project64_uViewProjectionMatrix: glViewProjectionMatrixFP64,
|
|
48
|
-
project64_uScale: scaleFP64
|
|
49
|
-
};
|
|
50
|
-
}
|
package/typed/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as BrushingExtension } from './brushing/brushing-extension';
|
|
2
|
-
export { default as DataFilterExtension } from './data-filter/data-filter-extension';
|
|
3
|
-
export { default as Fp64Extension } from './fp64/fp64-extension';
|
|
4
|
-
export { default as PathStyleExtension } from './path-style/path-style-extension';
|
|
5
|
-
export { default as FillStyleExtension } from './fill-style/fill-style';
|
|
6
|
-
export { default as ClipExtension } from './clip/clip-extension';
|
|
7
|
-
export { default as MaskExtension } from './mask/mask';
|
|
8
|
-
// Shader module
|
|
9
|
-
export { default as project64 } from './fp64/project64';
|
package/typed/mask/mask.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Layer, LayerExtension } from '@deck.gl/core/typed';
|
|
2
|
-
export declare type MaskExtensionProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Id of the layer that defines the mask. The mask layer must use the prop `operation: 'mask'`.
|
|
5
|
-
* Masking is disabled if `maskId` is empty or no valid mask layer with the specified id is found.
|
|
6
|
-
*/
|
|
7
|
-
maskId?: string;
|
|
8
|
-
/**
|
|
9
|
-
* controls whether an object is clipped by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).
|
|
10
|
-
* If not specified, it is automatically deduced from the layer.
|
|
11
|
-
*/
|
|
12
|
-
maskByInstance?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Inverts the masking operation
|
|
15
|
-
*/
|
|
16
|
-
maskInverted?: boolean;
|
|
17
|
-
};
|
|
18
|
-
/** Allows layers to show/hide objects by a geofence. */
|
|
19
|
-
export default class MaskExtension extends LayerExtension {
|
|
20
|
-
static defaultProps: {
|
|
21
|
-
maskId: string;
|
|
22
|
-
maskByInstance: undefined;
|
|
23
|
-
maskInverted: boolean;
|
|
24
|
-
};
|
|
25
|
-
static extensionName: string;
|
|
26
|
-
initializeState(this: Layer<MaskExtensionProps>): void;
|
|
27
|
-
getShaders(this: Layer<MaskExtensionProps>): any;
|
|
28
|
-
draw(this: Layer<Required<MaskExtensionProps>>, { uniforms, context, moduleParameters }: any): void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=mask.d.ts.map
|
package/typed/mask/mask.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/mask/mask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,cAAc,EAAM,MAAM,eAAe,CAAC;AAU5E,oBAAY,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wDAAwD;AACxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAC,YAAY;;;;MAAgB;IACnC,MAAM,CAAC,aAAa,SAAmB;IAEvC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC;IAI/C,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,GAAG;IAehD,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAC,EAAE,GAAG;CA4B3F"}
|
package/typed/mask/mask.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { COORDINATE_SYSTEM, LayerExtension, log } from '@deck.gl/core';
|
|
2
|
-
import mask from './shader-module';
|
|
3
|
-
const defaultProps = {
|
|
4
|
-
maskId: ''
|
|
5
|
-
};
|
|
6
|
-
export default class MaskExtension extends LayerExtension {
|
|
7
|
-
getShaders() {
|
|
8
|
-
// Infer by geometry if 'maskByInstance' prop isn't explictly set
|
|
9
|
-
let maskByInstance = 'instancePositions' in this.getAttributeManager().attributes;
|
|
10
|
-
// Users can override by setting the `maskByInstance` prop
|
|
11
|
-
if ('maskByInstance' in this.props) {
|
|
12
|
-
maskByInstance = this.props.maskByInstance;
|
|
13
|
-
}
|
|
14
|
-
this.state.maskByInstance = maskByInstance;
|
|
15
|
-
return {
|
|
16
|
-
modules: [mask]
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
draw({ uniforms, context, moduleParameters }) {
|
|
20
|
-
uniforms.mask_maskByInstance = this.state.maskByInstance;
|
|
21
|
-
const { maskId } = this.props;
|
|
22
|
-
const { maskChannels } = moduleParameters;
|
|
23
|
-
const { viewport } = context;
|
|
24
|
-
if (maskChannels && maskChannels[maskId]) {
|
|
25
|
-
const { index, bounds, coordinateOrigin: fromCoordinateOrigin } = maskChannels[maskId];
|
|
26
|
-
let { coordinateSystem: fromCoordinateSystem } = maskChannels[maskId];
|
|
27
|
-
uniforms.mask_enabled = true;
|
|
28
|
-
uniforms.mask_channel = index;
|
|
29
|
-
if (fromCoordinateSystem === COORDINATE_SYSTEM.DEFAULT) {
|
|
30
|
-
fromCoordinateSystem = viewport.isGeospatial
|
|
31
|
-
? COORDINATE_SYSTEM.LNGLAT
|
|
32
|
-
: COORDINATE_SYSTEM.CARTESIAN;
|
|
33
|
-
}
|
|
34
|
-
const opts = { modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem };
|
|
35
|
-
const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
|
|
36
|
-
const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);
|
|
37
|
-
uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
if (maskId) {
|
|
41
|
-
log.warn(`Could not find a mask layer with id: ${maskId}`)();
|
|
42
|
-
}
|
|
43
|
-
uniforms.mask_enabled = false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
MaskExtension.extensionName = 'MaskExtension';
|
|
48
|
-
MaskExtension.defaultProps = defaultProps;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { project } from '@deck.gl/core';
|
|
2
|
-
const vs = `
|
|
3
|
-
uniform vec4 mask_bounds;
|
|
4
|
-
uniform bool mask_maskByInstance;
|
|
5
|
-
vec2 mask_getCoords(vec4 position) {
|
|
6
|
-
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
7
|
-
}
|
|
8
|
-
`;
|
|
9
|
-
const fs = `
|
|
10
|
-
uniform sampler2D mask_texture;
|
|
11
|
-
uniform int mask_channel;
|
|
12
|
-
uniform bool mask_enabled;
|
|
13
|
-
bool mask_isInBounds(vec2 texCoords) {
|
|
14
|
-
if (!mask_enabled) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
vec4 maskColor = texture2D(mask_texture, texCoords);
|
|
18
|
-
float maskValue = 1.0;
|
|
19
|
-
if (mask_channel == 0) {
|
|
20
|
-
maskValue = maskColor.r;
|
|
21
|
-
} else if (mask_channel == 1) {
|
|
22
|
-
maskValue = maskColor.g;
|
|
23
|
-
} else if (mask_channel == 2) {
|
|
24
|
-
maskValue = maskColor.b;
|
|
25
|
-
} else if (mask_channel == 3) {
|
|
26
|
-
maskValue = maskColor.a;
|
|
27
|
-
}
|
|
28
|
-
return maskValue < 0.5;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
const inject = {
|
|
32
|
-
'vs:#decl': `
|
|
33
|
-
varying vec2 mask_texCoords;
|
|
34
|
-
`,
|
|
35
|
-
'vs:#main-end': `
|
|
36
|
-
vec4 mask_common_position;
|
|
37
|
-
if (mask_maskByInstance) {
|
|
38
|
-
mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
39
|
-
} else {
|
|
40
|
-
mask_common_position = geometry.position;
|
|
41
|
-
}
|
|
42
|
-
mask_texCoords = mask_getCoords(mask_common_position);
|
|
43
|
-
`,
|
|
44
|
-
'fs:#decl': `
|
|
45
|
-
varying vec2 mask_texCoords;
|
|
46
|
-
`,
|
|
47
|
-
'fs:#main-start': `
|
|
48
|
-
if (mask_enabled) {
|
|
49
|
-
bool mask = mask_isInBounds(mask_texCoords);
|
|
50
|
-
|
|
51
|
-
// Debug: show extent of render target
|
|
52
|
-
// gl_FragColor = vec4(mask_texCoords, 0.0, 1.0);
|
|
53
|
-
gl_FragColor = texture2D(mask_texture, mask_texCoords);
|
|
54
|
-
|
|
55
|
-
if (!mask) discard;
|
|
56
|
-
}
|
|
57
|
-
`
|
|
58
|
-
};
|
|
59
|
-
const getMaskUniforms = (opts = {}) => {
|
|
60
|
-
const uniforms = {};
|
|
61
|
-
if (opts.maskMap) {
|
|
62
|
-
uniforms.mask_texture = opts.maskMap;
|
|
63
|
-
}
|
|
64
|
-
return uniforms;
|
|
65
|
-
};
|
|
66
|
-
export default {
|
|
67
|
-
name: 'mask',
|
|
68
|
-
dependencies: [project],
|
|
69
|
-
vs,
|
|
70
|
-
fs,
|
|
71
|
-
inject,
|
|
72
|
-
getUniforms: getMaskUniforms
|
|
73
|
-
};
|
package/typed/mask/utils.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Layer, Viewport } from '@deck.gl/core/typed';
|
|
2
|
-
export declare type MaskBounds = [number, number, number, number];
|
|
3
|
-
export declare function getMaskBounds({ layers, viewport }: {
|
|
4
|
-
layers: Layer[];
|
|
5
|
-
viewport: Viewport;
|
|
6
|
-
}): MaskBounds;
|
|
7
|
-
export declare function getMaskViewport({ bounds, viewport, width, height }: {
|
|
8
|
-
bounds: MaskBounds;
|
|
9
|
-
viewport: Viewport;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
}): Viewport | null;
|
|
13
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mask/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAG1F,oBAAY,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAO1D,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,QAAQ,EACT,EAAE;IACD,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,UAAU,CAkDb;AAKD,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,EACP,EAAE;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,QAAQ,GAAG,IAAI,CAsDlB"}
|