@deck.gl/extensions 9.0.0-beta.5 → 9.0.0-beta.6
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/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +52 -57
- package/dist/clip/clip-extension.d.ts.map +1 -1
- package/dist/clip/clip-extension.js +6 -6
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +46 -56
- package/dist/data-filter/aggregator.d.ts.map +1 -1
- package/dist/data-filter/aggregator.js +11 -14
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +2 -5
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +70 -78
- package/dist/dist.dev.js +286 -300
- package/dist/fill-style/fill-style-extension.js +1 -1
- package/dist/fill-style/{shaders.glsl.d.ts → shader-module.d.ts} +1 -1
- package/dist/fill-style/shader-module.d.ts.map +1 -0
- package/dist/fill-style/{shaders.glsl.js → shader-module.js} +27 -33
- package/dist/fp64/project64.glsl.js +41 -60
- package/dist/index.cjs +363 -430
- package/dist/index.cjs.map +4 -4
- package/dist/mask/mask-pass.js +2 -2
- package/dist/mask/shader-module.d.ts.map +1 -1
- package/dist/mask/shader-module.js +33 -37
- package/dist/path-style/shaders.glsl.js +42 -47
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +30 -32
- package/dist/terrain/terrain-pass.js +2 -2
- package/dist/terrain/utils.js +2 -2
- package/dist/utils/syntax-tags.d.ts +6 -0
- package/dist/utils/syntax-tags.d.ts.map +1 -0
- package/dist/utils/syntax-tags.js +5 -0
- package/dist.min.js +364 -431
- package/package.json +8 -8
- package/src/brushing/shader-module.ts +4 -3
- package/src/clip/clip-extension.ts +10 -9
- package/src/collision-filter/shader-module.ts +6 -4
- package/src/data-filter/aggregator.ts +8 -13
- package/src/data-filter/data-filter-extension.ts +2 -5
- package/src/data-filter/shader-module.ts +7 -6
- package/src/fill-style/fill-style-extension.ts +1 -1
- package/src/fill-style/{shaders.glsl.ts → shader-module.ts} +6 -5
- package/src/mask/shader-module.ts +7 -6
- package/src/terrain/shader-module.ts +11 -10
- package/src/terrain/utils.ts +1 -1
- package/src/utils/syntax-tags.ts +5 -0
- package/dist/fill-style/shaders.glsl.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Plug-and-play functionalities for deck.gl layers",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.0-beta.
|
|
6
|
+
"version": "9.0.0-beta.6",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
|
-
"@luma.gl/shadertools": "9.0.0-beta.
|
|
42
|
+
"@luma.gl/shadertools": "9.0.0-beta.6"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deck.gl/core": "^9.0.0-alpha",
|
|
46
|
-
"@luma.gl/constants": "9.0.0-beta.
|
|
47
|
-
"@luma.gl/core": "9.0.0-beta.
|
|
48
|
-
"@luma.gl/engine": "9.0.0-beta.
|
|
49
|
-
"@luma.gl/shadertools": "9.0.0-beta.
|
|
50
|
-
"@luma.gl/webgl": "9.0.0-beta.
|
|
46
|
+
"@luma.gl/constants": "9.0.0-beta.6",
|
|
47
|
+
"@luma.gl/core": "9.0.0-beta.6",
|
|
48
|
+
"@luma.gl/engine": "9.0.0-beta.6",
|
|
49
|
+
"@luma.gl/shadertools": "9.0.0-beta.6",
|
|
50
|
+
"@luma.gl/webgl": "9.0.0-beta.6",
|
|
51
51
|
"@math.gl/core": "^4.0.0",
|
|
52
52
|
"@math.gl/web-mercator": "^4.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "373729308eb3fdec4b7c8b5842ddeff4f2d70338"
|
|
55
55
|
}
|
|
@@ -23,6 +23,7 @@ import {project} from '@deck.gl/core';
|
|
|
23
23
|
import type {Viewport} from '@deck.gl/core';
|
|
24
24
|
|
|
25
25
|
import type {BrushingExtensionProps} from './brushing-extension';
|
|
26
|
+
import {glsl} from '../utils/syntax-tags';
|
|
26
27
|
|
|
27
28
|
type BrushingModuleSettings = {
|
|
28
29
|
// From layer context
|
|
@@ -30,7 +31,7 @@ type BrushingModuleSettings = {
|
|
|
30
31
|
mousePosition?: {x: number; y: number};
|
|
31
32
|
} & BrushingExtensionProps;
|
|
32
33
|
|
|
33
|
-
const vs = `
|
|
34
|
+
const vs = glsl`
|
|
34
35
|
uniform bool brushing_enabled;
|
|
35
36
|
uniform int brushing_target;
|
|
36
37
|
uniform vec2 brushing_mousePos;
|
|
@@ -64,7 +65,7 @@ const vs = `
|
|
|
64
65
|
}
|
|
65
66
|
`;
|
|
66
67
|
|
|
67
|
-
const fs = `
|
|
68
|
+
const fs = glsl`
|
|
68
69
|
uniform bool brushing_enabled;
|
|
69
70
|
in float brushing_isVisible;
|
|
70
71
|
`;
|
|
@@ -77,7 +78,7 @@ const TARGET = {
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
const inject = {
|
|
80
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
81
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
81
82
|
vec2 brushingTarget;
|
|
82
83
|
vec2 brushingSource;
|
|
83
84
|
if (brushing_target == 3) {
|
|
@@ -22,6 +22,7 @@ import type {ShaderModule} from '@luma.gl/shadertools';
|
|
|
22
22
|
import {LayerExtension} from '@deck.gl/core';
|
|
23
23
|
|
|
24
24
|
import type {Layer} from '@deck.gl/core';
|
|
25
|
+
import {glsl} from '../utils/syntax-tags';
|
|
25
26
|
|
|
26
27
|
const defaultProps = {
|
|
27
28
|
clipBounds: [0, 0, 1, 1],
|
|
@@ -40,7 +41,7 @@ export type ClipExtensionProps = {
|
|
|
40
41
|
clipByInstance?: boolean;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
const shaderFunction = `
|
|
44
|
+
const shaderFunction = glsl`
|
|
44
45
|
uniform vec4 clip_bounds;
|
|
45
46
|
|
|
46
47
|
bool clip_isInBounds(vec2 position) {
|
|
@@ -58,16 +59,16 @@ const shaderModuleVs: ShaderModule = {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
const injectionVs = {
|
|
61
|
-
'vs:#decl': `
|
|
62
|
+
'vs:#decl': glsl`
|
|
62
63
|
out float clip_isVisible;
|
|
63
64
|
`,
|
|
64
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
65
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
65
66
|
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
66
67
|
`,
|
|
67
|
-
'fs:#decl': `
|
|
68
|
+
'fs:#decl': glsl`
|
|
68
69
|
in float clip_isVisible;
|
|
69
70
|
`,
|
|
70
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
71
|
+
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
71
72
|
if (clip_isVisible < 0.5) discard;
|
|
72
73
|
`
|
|
73
74
|
};
|
|
@@ -82,16 +83,16 @@ const shaderModuleFs: ShaderModule = {
|
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
const injectionFs = {
|
|
85
|
-
'vs:#decl': `
|
|
86
|
+
'vs:#decl': glsl`
|
|
86
87
|
out vec2 clip_commonPosition;
|
|
87
88
|
`,
|
|
88
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
89
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
89
90
|
clip_commonPosition = geometry.position.xy;
|
|
90
91
|
`,
|
|
91
|
-
'fs:#decl': `
|
|
92
|
+
'fs:#decl': glsl`
|
|
92
93
|
in vec2 clip_commonPosition;
|
|
93
94
|
`,
|
|
94
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
95
|
+
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
95
96
|
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
96
97
|
`
|
|
97
98
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {Framebuffer, Texture} from '@luma.gl/core';
|
|
2
2
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
3
3
|
import {project} from '@deck.gl/core';
|
|
4
|
+
import {glsl} from '../utils/syntax-tags';
|
|
4
5
|
|
|
5
|
-
const vs = `
|
|
6
|
+
const vs = glsl`
|
|
6
7
|
#ifdef NON_INSTANCED_MODEL
|
|
7
8
|
in float collisionPriorities;
|
|
8
9
|
#else
|
|
@@ -54,10 +55,10 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
54
55
|
`;
|
|
55
56
|
|
|
56
57
|
const inject = {
|
|
57
|
-
'vs:#decl': `
|
|
58
|
+
'vs:#decl': glsl`
|
|
58
59
|
float collision_fade = 1.0;
|
|
59
60
|
`,
|
|
60
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
61
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
61
62
|
if (collision_sort) {
|
|
62
63
|
#ifdef NON_INSTANCED_MODEL
|
|
63
64
|
float collisionPriority = collisionPriorities;
|
|
@@ -77,7 +78,7 @@ const inject = {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
`,
|
|
80
|
-
'vs:DECKGL_FILTER_COLOR': `
|
|
81
|
+
'vs:DECKGL_FILTER_COLOR': glsl`
|
|
81
82
|
color.a *= collision_fade;
|
|
82
83
|
`
|
|
83
84
|
};
|
|
@@ -101,6 +102,7 @@ const getCollisionUniforms = (
|
|
|
101
102
|
const {collisionFBO, drawToCollisionMap, dummyCollisionMap} = opts;
|
|
102
103
|
return {
|
|
103
104
|
collision_sort: Boolean(drawToCollisionMap),
|
|
105
|
+
// @ts-ignore (v9 not sure why this isn't allowed now)
|
|
104
106
|
collision_texture:
|
|
105
107
|
!drawToCollisionMap && collisionFBO ? collisionFBO.colorAttachments[0] : dummyCollisionMap
|
|
106
108
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Device, Framebuffer} from '@luma.gl/core';
|
|
1
|
+
import {Device, DeviceFeature, Framebuffer} from '@luma.gl/core';
|
|
2
2
|
import {Model} from '@luma.gl/engine';
|
|
3
3
|
import {GL} from '@luma.gl/constants';
|
|
4
4
|
|
|
@@ -53,18 +53,13 @@ void main() {
|
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
//
|
|
58
|
-
|
|
56
|
+
const FLOAT_TARGET_FEATURES: DeviceFeature[] = [
|
|
57
|
+
'float32-renderable-webgl', // ability to render to float texture
|
|
58
|
+
'texture-blend-float-webgl' // ability to blend when rendering to float texture
|
|
59
|
+
];
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
gl.getExtension('EXT_float_blend') &&
|
|
63
|
-
// WebGL 2
|
|
64
|
-
(gl.getExtension('EXT_color_buffer_float') ||
|
|
65
|
-
// WebGL 1
|
|
66
|
-
gl.getExtension('WEBGL_color_buffer_float'))
|
|
67
|
-
);
|
|
61
|
+
export function supportsFloatTarget(device: Device): boolean {
|
|
62
|
+
return FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
// A 1x1 framebuffer object that encodes the total count of filtered items
|
|
@@ -75,7 +70,7 @@ export function getFramebuffer(device: Device, useFloatTarget: boolean): Framebu
|
|
|
75
70
|
height: 1,
|
|
76
71
|
colorAttachments: [
|
|
77
72
|
device.createTexture({
|
|
78
|
-
format:
|
|
73
|
+
format: 'rgba32float',
|
|
79
74
|
type: GL.FLOAT,
|
|
80
75
|
mipmaps: false
|
|
81
76
|
})
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
import {GL} from '@luma.gl/constants';
|
|
22
21
|
import type {Framebuffer} from '@luma.gl/core';
|
|
23
22
|
import type {Model} from '@luma.gl/engine';
|
|
24
23
|
import type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';
|
|
@@ -165,7 +164,7 @@ export default class DataFilterExtension extends LayerExtension<
|
|
|
165
164
|
attributeManager.add({
|
|
166
165
|
filterValues: {
|
|
167
166
|
size: filterSize,
|
|
168
|
-
type: fp64 ?
|
|
167
|
+
type: fp64 ? 'float64' : 'float32',
|
|
169
168
|
accessor: 'getFilterValue',
|
|
170
169
|
shaderAttributes: {
|
|
171
170
|
filterValues: {
|
|
@@ -178,7 +177,6 @@ export default class DataFilterExtension extends LayerExtension<
|
|
|
178
177
|
},
|
|
179
178
|
filterCategoryValues: {
|
|
180
179
|
size: categorySize,
|
|
181
|
-
type: GL.FLOAT,
|
|
182
180
|
accessor: 'getFilterCategory',
|
|
183
181
|
transform:
|
|
184
182
|
categorySize === 1
|
|
@@ -206,8 +204,7 @@ export default class DataFilterExtension extends LayerExtension<
|
|
|
206
204
|
filterIndices: {
|
|
207
205
|
size: useFloatTarget ? 1 : 2,
|
|
208
206
|
vertexOffset: 1,
|
|
209
|
-
type:
|
|
210
|
-
normalized: true,
|
|
207
|
+
type: 'unorm8',
|
|
211
208
|
accessor: (object, {index}) => {
|
|
212
209
|
const i = object && object.__source ? object.__source.index : index;
|
|
213
210
|
return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
2
2
|
import type {DataFilterExtensionProps} from './data-filter-extension';
|
|
3
|
+
import {glsl} from '../utils/syntax-tags';
|
|
3
4
|
|
|
4
5
|
/*
|
|
5
6
|
* data filter shader module
|
|
6
7
|
*/
|
|
7
|
-
const vs = `
|
|
8
|
+
const vs = glsl`
|
|
8
9
|
uniform DATAFILTER_TYPE filter_min;
|
|
9
10
|
uniform DATAFILTER_TYPE filter_softMin;
|
|
10
11
|
uniform DATAFILTER_TYPE filter_softMax;
|
|
@@ -88,7 +89,7 @@ void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFrom
|
|
|
88
89
|
}
|
|
89
90
|
`;
|
|
90
91
|
|
|
91
|
-
const fs = `
|
|
92
|
+
const fs = glsl`
|
|
92
93
|
uniform bool filter_transformColor;
|
|
93
94
|
in float dataFilter_value;
|
|
94
95
|
`;
|
|
@@ -161,7 +162,7 @@ function getUniforms64(opts?: DataFilterModuleSettings | {}): Record<string, any
|
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
const inject = {
|
|
164
|
-
'vs:#main-start': `
|
|
165
|
+
'vs:#main-start': glsl`
|
|
165
166
|
#ifdef DATAFILTER_DOUBLE
|
|
166
167
|
dataFilter_setValue(
|
|
167
168
|
DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,
|
|
@@ -173,19 +174,19 @@ const inject = {
|
|
|
173
174
|
#endif
|
|
174
175
|
`,
|
|
175
176
|
|
|
176
|
-
'vs:#main-end': `
|
|
177
|
+
'vs:#main-end': glsl`
|
|
177
178
|
if (dataFilter_value == 0.0) {
|
|
178
179
|
gl_Position = vec4(0.);
|
|
179
180
|
}
|
|
180
181
|
`,
|
|
181
182
|
|
|
182
|
-
'vs:DECKGL_FILTER_SIZE': `
|
|
183
|
+
'vs:DECKGL_FILTER_SIZE': glsl`
|
|
183
184
|
if (filter_transformSize) {
|
|
184
185
|
size = size * dataFilter_value;
|
|
185
186
|
}
|
|
186
187
|
`,
|
|
187
188
|
|
|
188
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
189
|
+
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
189
190
|
if (dataFilter_value == 0.0) discard;
|
|
190
191
|
if (filter_transformColor) {
|
|
191
192
|
color.a *= dataFilter_value;
|
|
@@ -3,11 +3,12 @@ import {project, fp64LowPart} from '@deck.gl/core';
|
|
|
3
3
|
import type {Viewport, ProjectUniforms} from '@deck.gl/core';
|
|
4
4
|
|
|
5
5
|
import type {Texture} from '@luma.gl/core';
|
|
6
|
+
import {glsl} from '../utils/syntax-tags';
|
|
6
7
|
|
|
7
8
|
/*
|
|
8
9
|
* fill pattern shader module
|
|
9
10
|
*/
|
|
10
|
-
const patternVs = `
|
|
11
|
+
const patternVs = glsl`
|
|
11
12
|
#ifdef NON_INSTANCED_MODEL
|
|
12
13
|
#define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
|
|
13
14
|
#define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
|
|
@@ -30,7 +31,7 @@ out vec4 fill_patternBounds;
|
|
|
30
31
|
out vec4 fill_patternPlacement;
|
|
31
32
|
`;
|
|
32
33
|
|
|
33
|
-
const patternFs = `
|
|
34
|
+
const patternFs = glsl`
|
|
34
35
|
uniform bool fill_patternEnabled;
|
|
35
36
|
uniform bool fill_patternMask;
|
|
36
37
|
uniform sampler2D fill_patternTexture;
|
|
@@ -45,11 +46,11 @@ const float FILL_UV_SCALE = 512.0 / 40000000.0;
|
|
|
45
46
|
`;
|
|
46
47
|
|
|
47
48
|
const inject = {
|
|
48
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
49
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
49
50
|
fill_uv = geometry.position.xy;
|
|
50
51
|
`,
|
|
51
52
|
|
|
52
|
-
'vs:DECKGL_FILTER_COLOR': `
|
|
53
|
+
'vs:DECKGL_FILTER_COLOR': glsl`
|
|
53
54
|
if (fill_patternEnabled) {
|
|
54
55
|
fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
|
|
55
56
|
fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
|
|
@@ -57,7 +58,7 @@ const inject = {
|
|
|
57
58
|
}
|
|
58
59
|
`,
|
|
59
60
|
|
|
60
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
61
|
+
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
61
62
|
if (fill_patternEnabled) {
|
|
62
63
|
vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw;
|
|
63
64
|
vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
2
2
|
import {project} from '@deck.gl/core';
|
|
3
3
|
import type {Texture} from '@luma.gl/core';
|
|
4
|
+
import {glsl} from '../utils/syntax-tags';
|
|
4
5
|
|
|
5
|
-
const vs = `
|
|
6
|
+
const vs = glsl`
|
|
6
7
|
uniform vec4 mask_bounds;
|
|
7
8
|
uniform bool mask_maskByInstance;
|
|
8
9
|
vec2 mask_getCoords(vec4 position) {
|
|
@@ -10,7 +11,7 @@ vec2 mask_getCoords(vec4 position) {
|
|
|
10
11
|
}
|
|
11
12
|
`;
|
|
12
13
|
|
|
13
|
-
const fs = `
|
|
14
|
+
const fs = glsl`
|
|
14
15
|
uniform sampler2D mask_texture;
|
|
15
16
|
uniform int mask_channel;
|
|
16
17
|
uniform bool mask_enabled;
|
|
@@ -40,10 +41,10 @@ bool mask_isInBounds(vec2 texCoords) {
|
|
|
40
41
|
`;
|
|
41
42
|
|
|
42
43
|
const inject = {
|
|
43
|
-
'vs:#decl': `
|
|
44
|
+
'vs:#decl': glsl`
|
|
44
45
|
out vec2 mask_texCoords;
|
|
45
46
|
`,
|
|
46
|
-
'vs:#main-end': `
|
|
47
|
+
'vs:#main-end': glsl`
|
|
47
48
|
vec4 mask_common_position;
|
|
48
49
|
if (mask_maskByInstance) {
|
|
49
50
|
mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
@@ -52,10 +53,10 @@ out vec2 mask_texCoords;
|
|
|
52
53
|
}
|
|
53
54
|
mask_texCoords = mask_getCoords(mask_common_position);
|
|
54
55
|
`,
|
|
55
|
-
'fs:#decl': `
|
|
56
|
+
'fs:#decl': glsl`
|
|
56
57
|
in vec2 mask_texCoords;
|
|
57
58
|
`,
|
|
58
|
-
'fs:#main-start': `
|
|
59
|
+
'fs:#main-start': glsl`
|
|
59
60
|
if (mask_enabled) {
|
|
60
61
|
bool mask = mask_isInBounds(mask_texCoords);
|
|
61
62
|
|
|
@@ -6,6 +6,7 @@ import {project} from '@deck.gl/core';
|
|
|
6
6
|
import type {Texture} from '@luma.gl/core';
|
|
7
7
|
import type {Bounds} from '../utils/projection-utils';
|
|
8
8
|
import type {TerrainCover} from './terrain-cover';
|
|
9
|
+
import {glsl} from '../utils/syntax-tags';
|
|
9
10
|
|
|
10
11
|
/** Module parameters expected by the terrain shader module */
|
|
11
12
|
export type TerrainModuleSettings = {
|
|
@@ -43,20 +44,20 @@ export const terrainModule = {
|
|
|
43
44
|
name: 'terrain',
|
|
44
45
|
dependencies: [project],
|
|
45
46
|
inject: {
|
|
46
|
-
'vs:#decl':
|
|
47
|
+
'vs:#decl':
|
|
48
|
+
glsl`
|
|
47
49
|
uniform float terrain_mode;
|
|
48
50
|
uniform sampler2D terrain_map;
|
|
49
51
|
uniform vec4 terrain_bounds;
|
|
50
52
|
out vec3 commonPos;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
'vs:#main-start': `
|
|
53
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
54
|
+
'vs:#main-start': glsl`
|
|
54
55
|
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
55
56
|
gl_Position = vec4(0.0);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
`,
|
|
59
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
60
|
+
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
60
61
|
commonPos = geometry.position.xyz;
|
|
61
62
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
62
63
|
vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
@@ -75,20 +76,20 @@ if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
`,
|
|
78
|
-
'fs:#decl':
|
|
79
|
+
'fs:#decl':
|
|
80
|
+
glsl`
|
|
79
81
|
uniform float terrain_mode;
|
|
80
82
|
uniform sampler2D terrain_map;
|
|
81
83
|
uniform vec4 terrain_bounds;
|
|
82
84
|
in vec3 commonPos;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'fs:#main-start': `
|
|
85
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
86
|
+
'fs:#main-start': glsl`
|
|
86
87
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
87
88
|
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
`,
|
|
91
|
-
'fs:DECKGL_FILTER_COLOR': `
|
|
92
|
+
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
92
93
|
if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {
|
|
93
94
|
vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
94
95
|
vec4 pixel = texture(terrain_map, texCoords);
|
package/src/terrain/utils.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shaders.glsl.d.ts","sourceRoot":"","sources":["../../src/fill-style/shaders.glsl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAC,QAAQ,EAAkB,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAwE3C,KAAK,uBAAuB,GACxB;IACE,QAAQ,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoCN,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,uBAAuB,CAOhE,CAAC"}
|