@deck.gl/extensions 9.0.0-beta.2 → 9.0.0-beta.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/dist/brushing/brushing-extension.js +80 -0
- package/{typed → dist}/brushing/shader-module.d.ts +1 -1
- package/{typed → dist}/brushing/shader-module.d.ts.map +1 -1
- package/dist/{esm/brushing → brushing}/shader-module.js +24 -30
- package/dist/clip/clip-extension.js +117 -0
- package/{typed → dist}/collision-filter/collision-filter-effect.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-effect.js +193 -0
- package/dist/collision-filter/collision-filter-extension.js +49 -0
- package/{typed → dist}/collision-filter/collision-filter-pass.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-pass.js +25 -0
- package/dist/{esm/collision-filter → collision-filter}/shader-module.js +17 -24
- package/dist/data-filter/aggregator.js +104 -0
- package/{typed → dist}/data-filter/data-filter-extension.d.ts +36 -5
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -0
- package/dist/data-filter/data-filter-extension.js +243 -0
- package/{typed → dist}/data-filter/shader-module.d.ts +1 -1
- package/dist/data-filter/shader-module.d.ts.map +1 -0
- package/dist/data-filter/shader-module.js +187 -0
- package/dist/dist.dev.js +1847 -13033
- package/dist/fill-style/fill-style-extension.js +118 -0
- package/dist/{esm/fill-style → fill-style}/shaders.glsl.js +37 -43
- package/dist/fp64/fp64-extension.js +35 -0
- package/dist/{esm/fp64 → fp64}/project64.glsl.js +19 -1
- package/dist/fp64/project64.js +50 -0
- package/dist/index.cjs +2814 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/{typed → dist}/mask/mask-effect.d.ts +1 -1
- package/dist/mask/mask-effect.d.ts.map +1 -0
- package/dist/mask/mask-effect.js +194 -0
- package/dist/mask/mask-extension.js +57 -0
- package/{typed → dist}/mask/mask-pass.d.ts.map +1 -1
- package/dist/mask/mask-pass.js +44 -0
- package/dist/{esm/mask → mask}/shader-module.js +18 -21
- package/dist/path-style/path-style-extension.js +111 -0
- package/dist/{esm/path-style → path-style}/shaders.glsl.js +20 -13
- package/{typed → dist}/terrain/height-map-builder.d.ts +1 -1
- package/dist/terrain/height-map-builder.d.ts.map +1 -0
- package/dist/terrain/height-map-builder.js +104 -0
- package/{typed → dist}/terrain/shader-module.d.ts +2 -2
- package/dist/terrain/shader-module.d.ts.map +1 -0
- package/dist/terrain/shader-module.js +139 -0
- package/{typed → dist}/terrain/terrain-cover.d.ts +1 -1
- package/dist/terrain/terrain-cover.d.ts.map +1 -0
- package/dist/terrain/terrain-cover.js +187 -0
- package/{typed → dist}/terrain/terrain-effect.d.ts +1 -1
- package/dist/terrain/terrain-effect.d.ts.map +1 -0
- package/dist/terrain/terrain-effect.js +184 -0
- package/dist/terrain/terrain-extension.js +44 -0
- package/{typed → dist}/terrain/terrain-pass.d.ts +2 -2
- package/dist/terrain/terrain-pass.d.ts.map +1 -0
- package/dist/terrain/terrain-pass.js +61 -0
- package/{typed → dist}/terrain/terrain-picking-pass.d.ts +1 -1
- package/dist/terrain/terrain-picking-pass.d.ts.map +1 -0
- package/dist/terrain/terrain-picking-pass.js +66 -0
- package/dist/terrain/utils.js +21 -0
- package/{typed → dist}/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +50 -0
- package/dist/utils/projection-utils.js +153 -0
- package/dist.min.js +104 -208
- package/package.json +19 -12
- package/src/collision-filter/collision-filter-effect.ts +12 -8
- package/src/collision-filter/collision-filter-pass.ts +1 -3
- package/src/data-filter/data-filter-extension.ts +136 -29
- package/src/data-filter/shader-module.ts +31 -3
- package/src/mask/mask-effect.ts +0 -1
- package/src/mask/mask-pass.ts +1 -3
- package/src/terrain/terrain-effect.ts +8 -2
- package/src/terrain/terrain-pass.ts +2 -5
- package/src/terrain/terrain-picking-pass.ts +1 -3
- package/src/utils/debug.ts +1 -2
- package/dist/es5/brushing/brushing-extension.js +0 -108
- package/dist/es5/brushing/brushing-extension.js.map +0 -1
- package/dist/es5/brushing/shader-module.js +0 -50
- package/dist/es5/brushing/shader-module.js.map +0 -1
- package/dist/es5/clip/clip-extension.js +0 -98
- package/dist/es5/clip/clip-extension.js.map +0 -1
- package/dist/es5/collision-filter/collision-filter-effect.js +0 -294
- package/dist/es5/collision-filter/collision-filter-effect.js.map +0 -1
- package/dist/es5/collision-filter/collision-filter-extension.js +0 -109
- package/dist/es5/collision-filter/collision-filter-extension.js.map +0 -1
- package/dist/es5/collision-filter/collision-filter-pass.js +0 -79
- package/dist/es5/collision-filter/collision-filter-pass.js.map +0 -1
- package/dist/es5/collision-filter/shader-module.js +0 -39
- package/dist/es5/collision-filter/shader-module.js.map +0 -1
- package/dist/es5/data-filter/aggregator.js +0 -79
- package/dist/es5/data-filter/aggregator.js.map +0 -1
- package/dist/es5/data-filter/data-filter-extension.js +0 -236
- package/dist/es5/data-filter/data-filter-extension.js.map +0 -1
- package/dist/es5/data-filter/shader-module.js +0 -122
- package/dist/es5/data-filter/shader-module.js.map +0 -1
- package/dist/es5/fill-style/fill-style-extension.js +0 -190
- package/dist/es5/fill-style/fill-style-extension.js.map +0 -1
- package/dist/es5/fill-style/shaders.glsl.js +0 -59
- package/dist/es5/fill-style/shaders.glsl.js.map +0 -1
- package/dist/es5/fp64/fp64-extension.js +0 -55
- package/dist/es5/fp64/fp64-extension.js.map +0 -1
- package/dist/es5/fp64/project64.glsl.js +0 -9
- package/dist/es5/fp64/project64.glsl.js.map +0 -1
- package/dist/es5/fp64/project64.js +0 -52
- package/dist/es5/fp64/project64.js.map +0 -1
- package/dist/es5/index.js +0 -88
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/mask/mask-effect.js +0 -279
- package/dist/es5/mask/mask-effect.js.map +0 -1
- package/dist/es5/mask/mask-extension.js +0 -113
- package/dist/es5/mask/mask-extension.js.map +0 -1
- package/dist/es5/mask/mask-pass.js +0 -106
- package/dist/es5/mask/mask-pass.js.map +0 -1
- package/dist/es5/mask/shader-module.js +0 -38
- package/dist/es5/mask/shader-module.js.map +0 -1
- package/dist/es5/path-style/path-style-extension.js +0 -169
- package/dist/es5/path-style/path-style-extension.js.map +0 -1
- package/dist/es5/path-style/shaders.glsl.js +0 -25
- package/dist/es5/path-style/shaders.glsl.js.map +0 -1
- package/dist/es5/terrain/height-map-builder.js +0 -111
- package/dist/es5/terrain/height-map-builder.js.map +0 -1
- package/dist/es5/terrain/shader-module.js +0 -86
- package/dist/es5/terrain/shader-module.js.map +0 -1
- package/dist/es5/terrain/terrain-cover.js +0 -256
- package/dist/es5/terrain/terrain-cover.js.map +0 -1
- package/dist/es5/terrain/terrain-effect.js +0 -326
- package/dist/es5/terrain/terrain-effect.js.map +0 -1
- package/dist/es5/terrain/terrain-extension.js +0 -94
- package/dist/es5/terrain/terrain-extension.js.map +0 -1
- package/dist/es5/terrain/terrain-pass.js +0 -121
- package/dist/es5/terrain/terrain-pass.js.map +0 -1
- package/dist/es5/terrain/terrain-picking-pass.js +0 -124
- package/dist/es5/terrain/terrain-picking-pass.js.map +0 -1
- package/dist/es5/terrain/utils.js +0 -35
- package/dist/es5/terrain/utils.js.map +0 -1
- package/dist/es5/utils/debug.js +0 -71
- package/dist/es5/utils/debug.js.map +0 -1
- package/dist/es5/utils/projection-utils.js +0 -168
- package/dist/es5/utils/projection-utils.js.map +0 -1
- package/dist/esm/brushing/brushing-extension.js +0 -68
- package/dist/esm/brushing/brushing-extension.js.map +0 -1
- package/dist/esm/brushing/shader-module.js.map +0 -1
- package/dist/esm/clip/clip-extension.js +0 -86
- package/dist/esm/clip/clip-extension.js.map +0 -1
- package/dist/esm/collision-filter/collision-filter-effect.js +0 -246
- package/dist/esm/collision-filter/collision-filter-effect.js.map +0 -1
- package/dist/esm/collision-filter/collision-filter-extension.js +0 -75
- package/dist/esm/collision-filter/collision-filter-extension.js.map +0 -1
- package/dist/esm/collision-filter/collision-filter-pass.js +0 -32
- package/dist/esm/collision-filter/collision-filter-pass.js.map +0 -1
- package/dist/esm/collision-filter/shader-module.js.map +0 -1
- package/dist/esm/data-filter/aggregator.js +0 -102
- package/dist/esm/data-filter/aggregator.js.map +0 -1
- package/dist/esm/data-filter/data-filter-extension.js +0 -189
- package/dist/esm/data-filter/data-filter-extension.js.map +0 -1
- package/dist/esm/data-filter/shader-module.js +0 -164
- package/dist/esm/data-filter/shader-module.js.map +0 -1
- package/dist/esm/fill-style/fill-style-extension.js +0 -156
- package/dist/esm/fill-style/fill-style-extension.js.map +0 -1
- package/dist/esm/fill-style/shaders.glsl.js.map +0 -1
- package/dist/esm/fp64/fp64-extension.js +0 -20
- package/dist/esm/fp64/fp64-extension.js.map +0 -1
- package/dist/esm/fp64/project64.glsl.js.map +0 -1
- package/dist/esm/fp64/project64.js +0 -43
- package/dist/esm/fp64/project64.js.map +0 -1
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/mask/mask-effect.js +0 -228
- package/dist/esm/mask/mask-effect.js.map +0 -1
- package/dist/esm/mask/mask-extension.js +0 -83
- package/dist/esm/mask/mask-extension.js.map +0 -1
- package/dist/esm/mask/mask-pass.js +0 -58
- package/dist/esm/mask/mask-pass.js.map +0 -1
- package/dist/esm/mask/shader-module.js.map +0 -1
- package/dist/esm/path-style/path-style-extension.js +0 -130
- package/dist/esm/path-style/path-style-extension.js.map +0 -1
- package/dist/esm/path-style/shaders.glsl.js.map +0 -1
- package/dist/esm/terrain/height-map-builder.js +0 -86
- package/dist/esm/terrain/height-map-builder.js.map +0 -1
- package/dist/esm/terrain/shader-module.js +0 -127
- package/dist/esm/terrain/shader-module.js.map +0 -1
- package/dist/esm/terrain/terrain-cover.js +0 -212
- package/dist/esm/terrain/terrain-cover.js.map +0 -1
- package/dist/esm/terrain/terrain-effect.js +0 -219
- package/dist/esm/terrain/terrain-effect.js.map +0 -1
- package/dist/esm/terrain/terrain-extension.js +0 -59
- package/dist/esm/terrain/terrain-extension.js.map +0 -1
- package/dist/esm/terrain/terrain-pass.js +0 -71
- package/dist/esm/terrain/terrain-pass.js.map +0 -1
- package/dist/esm/terrain/terrain-picking-pass.js +0 -73
- package/dist/esm/terrain/terrain-picking-pass.js.map +0 -1
- package/dist/esm/terrain/utils.js +0 -19
- package/dist/esm/terrain/utils.js.map +0 -1
- package/dist/esm/utils/debug.js +0 -61
- package/dist/esm/utils/debug.js.map +0 -1
- package/dist/esm/utils/projection-utils.js +0 -134
- package/dist/esm/utils/projection-utils.js.map +0 -1
- package/typed/data-filter/data-filter-extension.d.ts.map +0 -1
- package/typed/data-filter/shader-module.d.ts.map +0 -1
- package/typed/index.d.ts +0 -19
- package/typed/index.d.ts.map +0 -1
- package/typed/mask/mask-effect.d.ts.map +0 -1
- package/typed/terrain/height-map-builder.d.ts.map +0 -1
- package/typed/terrain/shader-module.d.ts.map +0 -1
- package/typed/terrain/terrain-cover.d.ts.map +0 -1
- package/typed/terrain/terrain-effect.d.ts.map +0 -1
- package/typed/terrain/terrain-pass.d.ts.map +0 -1
- package/typed/terrain/terrain-picking-pass.d.ts.map +0 -1
- /package/{typed → dist}/brushing/brushing-extension.d.ts +0 -0
- /package/{typed → dist}/brushing/brushing-extension.d.ts.map +0 -0
- /package/{typed → dist}/clip/clip-extension.d.ts +0 -0
- /package/{typed → dist}/clip/clip-extension.d.ts.map +0 -0
- /package/{typed → dist}/collision-filter/collision-filter-effect.d.ts +0 -0
- /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts +0 -0
- /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts.map +0 -0
- /package/{typed → dist}/collision-filter/collision-filter-pass.d.ts +0 -0
- /package/{typed → dist}/collision-filter/shader-module.d.ts +0 -0
- /package/{typed → dist}/collision-filter/shader-module.d.ts.map +0 -0
- /package/{typed → dist}/data-filter/aggregator.d.ts +0 -0
- /package/{typed → dist}/data-filter/aggregator.d.ts.map +0 -0
- /package/{typed → dist}/fill-style/fill-style-extension.d.ts +0 -0
- /package/{typed → dist}/fill-style/fill-style-extension.d.ts.map +0 -0
- /package/{typed → dist}/fill-style/shaders.glsl.d.ts +0 -0
- /package/{typed → dist}/fill-style/shaders.glsl.d.ts.map +0 -0
- /package/{typed → dist}/fp64/fp64-extension.d.ts +0 -0
- /package/{typed → dist}/fp64/fp64-extension.d.ts.map +0 -0
- /package/{typed → dist}/fp64/project64.d.ts +0 -0
- /package/{typed → dist}/fp64/project64.d.ts.map +0 -0
- /package/{typed → dist}/fp64/project64.glsl.d.ts +0 -0
- /package/{typed → dist}/fp64/project64.glsl.d.ts.map +0 -0
- /package/{typed → dist}/mask/mask-extension.d.ts +0 -0
- /package/{typed → dist}/mask/mask-extension.d.ts.map +0 -0
- /package/{typed → dist}/mask/mask-pass.d.ts +0 -0
- /package/{typed → dist}/mask/shader-module.d.ts +0 -0
- /package/{typed → dist}/mask/shader-module.d.ts.map +0 -0
- /package/{typed → dist}/path-style/path-style-extension.d.ts +0 -0
- /package/{typed → dist}/path-style/path-style-extension.d.ts.map +0 -0
- /package/{typed → dist}/path-style/shaders.glsl.d.ts +0 -0
- /package/{typed → dist}/path-style/shaders.glsl.d.ts.map +0 -0
- /package/{typed → dist}/terrain/terrain-extension.d.ts +0 -0
- /package/{typed → dist}/terrain/terrain-extension.d.ts.map +0 -0
- /package/{typed → dist}/terrain/utils.d.ts +0 -0
- /package/{typed → dist}/terrain/utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/debug.d.ts +0 -0
- /package/{typed → dist}/utils/projection-utils.d.ts +0 -0
- /package/{typed → dist}/utils/projection-utils.d.ts.map +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import { patternShaders } from "./shaders.glsl.js";
|
|
3
|
+
const defaultProps = {
|
|
4
|
+
fillPatternEnabled: true,
|
|
5
|
+
fillPatternAtlas: {
|
|
6
|
+
type: 'image',
|
|
7
|
+
value: null,
|
|
8
|
+
async: true,
|
|
9
|
+
parameters: {
|
|
10
|
+
minFilter: 'linear'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
fillPatternMapping: { type: 'object', value: {}, async: true },
|
|
14
|
+
fillPatternMask: true,
|
|
15
|
+
getFillPattern: { type: 'accessor', value: d => d.pattern },
|
|
16
|
+
getFillPatternScale: { type: 'accessor', value: 1 },
|
|
17
|
+
getFillPatternOffset: { type: 'accessor', value: [0, 0] }
|
|
18
|
+
};
|
|
19
|
+
/** Adds selected features to layers that render a "fill", such as the `PolygonLayer` and `ScatterplotLayer`. */
|
|
20
|
+
export default class FillStyleExtension extends LayerExtension {
|
|
21
|
+
static { this.defaultProps = defaultProps; }
|
|
22
|
+
static { this.extensionName = 'FillStyleExtension'; }
|
|
23
|
+
constructor({ pattern = false } = {}) {
|
|
24
|
+
super({ pattern });
|
|
25
|
+
}
|
|
26
|
+
isEnabled(layer) {
|
|
27
|
+
return layer.getAttributeManager() !== null && !('pathTesselator' in layer.state);
|
|
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: this.context.device.createTexture({
|
|
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.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) {
|
|
97
|
+
this.getAttributeManager().invalidate('getFillPattern');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
draw(params, extension) {
|
|
101
|
+
if (!extension.isEnabled(this)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const { fillPatternAtlas } = this.props;
|
|
105
|
+
this.setModuleParameters({
|
|
106
|
+
fillPatternTexture: fillPatternAtlas || this.state.emptyTexture
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
finalizeState() {
|
|
110
|
+
const emptyTexture = this.state.emptyTexture;
|
|
111
|
+
emptyTexture?.delete();
|
|
112
|
+
}
|
|
113
|
+
getPatternFrame(name) {
|
|
114
|
+
const { fillPatternMapping } = this.getCurrentLayer().props;
|
|
115
|
+
const def = fillPatternMapping && fillPatternMapping[name];
|
|
116
|
+
return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { project, fp64LowPart } from '@deck.gl/core';
|
|
2
|
+
/*
|
|
3
|
+
* fill pattern shader module
|
|
4
|
+
*/
|
|
2
5
|
const patternVs = `
|
|
3
6
|
#ifdef NON_INSTANCED_MODEL
|
|
4
7
|
#define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
|
|
@@ -35,17 +38,17 @@ in vec2 fill_uv;
|
|
|
35
38
|
const float FILL_UV_SCALE = 512.0 / 40000000.0;
|
|
36
39
|
`;
|
|
37
40
|
const inject = {
|
|
38
|
-
|
|
41
|
+
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
39
42
|
fill_uv = geometry.position.xy;
|
|
40
43
|
`,
|
|
41
|
-
|
|
44
|
+
'vs:DECKGL_FILTER_COLOR': `
|
|
42
45
|
if (fill_patternEnabled) {
|
|
43
46
|
fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
|
|
44
47
|
fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
|
|
45
48
|
fill_patternPlacement.zw = FILL_PATTERN_SCALE_ATTRIB * FILL_PATTERN_FRAME_ATTRIB.zw;
|
|
46
49
|
}
|
|
47
50
|
`,
|
|
48
|
-
|
|
51
|
+
'fs:DECKGL_FILTER_COLOR': `
|
|
49
52
|
if (fill_patternEnabled) {
|
|
50
53
|
vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw;
|
|
51
54
|
vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale;
|
|
@@ -61,48 +64,39 @@ const inject = {
|
|
|
61
64
|
}
|
|
62
65
|
`
|
|
63
66
|
};
|
|
64
|
-
|
|
67
|
+
/* eslint-disable camelcase */
|
|
65
68
|
function getPatternUniforms(opts, uniforms) {
|
|
66
|
-
|
|
69
|
+
if (!opts) {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
if ('fillPatternTexture' in opts) {
|
|
73
|
+
const { fillPatternTexture } = opts;
|
|
74
|
+
return {
|
|
75
|
+
fill_patternTexture: fillPatternTexture,
|
|
76
|
+
fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if ('viewport' in opts) {
|
|
80
|
+
const { fillPatternMask = true, fillPatternEnabled = true } = opts;
|
|
81
|
+
const { project_uCommonOrigin: coordinateOriginCommon } = uniforms;
|
|
82
|
+
const coordinateOriginCommon64Low = [
|
|
83
|
+
fp64LowPart(coordinateOriginCommon[0]),
|
|
84
|
+
fp64LowPart(coordinateOriginCommon[1])
|
|
85
|
+
];
|
|
86
|
+
return {
|
|
87
|
+
fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2),
|
|
88
|
+
fill_uvCoordinateOrigin64Low: coordinateOriginCommon64Low,
|
|
89
|
+
fill_patternMask: fillPatternMask,
|
|
90
|
+
fill_patternEnabled: fillPatternEnabled
|
|
91
|
+
};
|
|
92
|
+
}
|
|
67
93
|
return {};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if ('fillPatternTexture' in opts) {
|
|
71
|
-
const {
|
|
72
|
-
fillPatternTexture
|
|
73
|
-
} = opts;
|
|
74
|
-
return {
|
|
75
|
-
fill_patternTexture: fillPatternTexture,
|
|
76
|
-
fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height]
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if ('viewport' in opts) {
|
|
81
|
-
const {
|
|
82
|
-
fillPatternMask = true,
|
|
83
|
-
fillPatternEnabled = true
|
|
84
|
-
} = opts;
|
|
85
|
-
const {
|
|
86
|
-
project_uCommonOrigin: coordinateOriginCommon
|
|
87
|
-
} = uniforms;
|
|
88
|
-
const coordinateOriginCommon64Low = [fp64LowPart(coordinateOriginCommon[0]), fp64LowPart(coordinateOriginCommon[1])];
|
|
89
|
-
return {
|
|
90
|
-
fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2),
|
|
91
|
-
fill_uvCoordinateOrigin64Low: coordinateOriginCommon64Low,
|
|
92
|
-
fill_patternMask: fillPatternMask,
|
|
93
|
-
fill_patternEnabled: fillPatternEnabled
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {};
|
|
98
94
|
}
|
|
99
|
-
|
|
100
95
|
export const patternShaders = {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
name: 'fill-pattern',
|
|
97
|
+
vs: patternVs,
|
|
98
|
+
fs: patternFs,
|
|
99
|
+
inject,
|
|
100
|
+
dependencies: [project],
|
|
101
|
+
getUniforms: getPatternUniforms
|
|
107
102
|
};
|
|
108
|
-
//# sourceMappingURL=shaders.glsl.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
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.js";
|
|
22
|
+
/** @deprecated Adds the legacy 64-bit precision to geospatial layers. */
|
|
23
|
+
export default class Fp64Extension extends LayerExtension {
|
|
24
|
+
static { this.extensionName = 'Fp64Extension'; }
|
|
25
|
+
getShaders() {
|
|
26
|
+
const { coordinateSystem } = this.props;
|
|
27
|
+
if (coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&
|
|
28
|
+
coordinateSystem !== COORDINATE_SYSTEM.DEFAULT) {
|
|
29
|
+
throw new Error('fp64: coordinateSystem must be LNGLAT');
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
modules: [project64]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,3 +1,22 @@
|
|
|
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.
|
|
1
20
|
export default `\
|
|
2
21
|
|
|
3
22
|
const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
@@ -79,4 +98,3 @@ vec4 project_position_to_clipspace(
|
|
|
79
98
|
);
|
|
80
99
|
}
|
|
81
100
|
`;
|
|
82
|
-
//# sourceMappingURL=project64.glsl.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
/* eslint-disable camelcase */
|
|
21
|
+
import { fp64 } from '@luma.gl/shadertools';
|
|
22
|
+
const { fp64ify, fp64ifyMatrix4 } = fp64;
|
|
23
|
+
import { project, _memoize as memoize } from '@deck.gl/core';
|
|
24
|
+
import project64Shader from "./project64.glsl.js";
|
|
25
|
+
export default {
|
|
26
|
+
name: 'project64',
|
|
27
|
+
dependencies: [project, fp64],
|
|
28
|
+
vs: project64Shader,
|
|
29
|
+
getUniforms
|
|
30
|
+
};
|
|
31
|
+
// TODO - this module should calculate the 64 bit uniforms
|
|
32
|
+
// It is currently done by project to minimize duplicated work
|
|
33
|
+
const getMemoizedUniforms = memoize(calculateUniforms);
|
|
34
|
+
function getUniforms(opts) {
|
|
35
|
+
if (opts && 'viewport' in opts) {
|
|
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
|
+
}
|