@deck.gl/extensions 9.0.40 → 9.1.0-beta.3
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.d.ts +1 -0
- package/dist/brushing/brushing-extension.d.ts.map +1 -1
- package/dist/brushing/brushing-extension.js +16 -19
- package/dist/brushing/brushing-extension.js.map +1 -0
- package/dist/brushing/shader-module.d.ts +8 -2
- package/dist/brushing/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +75 -50
- package/dist/brushing/shader-module.js.map +1 -0
- package/dist/clip/clip-extension.d.ts +5 -2
- package/dist/clip/clip-extension.d.ts.map +1 -1
- package/dist/clip/clip-extension.js +37 -42
- package/dist/clip/clip-extension.js.map +1 -0
- package/dist/collision-filter/collision-filter-effect.d.ts +4 -4
- package/dist/collision-filter/collision-filter-effect.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-effect.js +28 -13
- package/dist/collision-filter/collision-filter-effect.js.map +1 -0
- package/dist/collision-filter/collision-filter-extension.d.ts +1 -1
- package/dist/collision-filter/collision-filter-extension.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-extension.js +6 -6
- package/dist/collision-filter/collision-filter-extension.js.map +1 -0
- package/dist/collision-filter/collision-filter-pass.d.ts +9 -5
- package/dist/collision-filter/collision-filter-pass.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-pass.js +15 -4
- package/dist/collision-filter/collision-filter-pass.js.map +1 -0
- package/dist/collision-filter/shader-module.d.ts +3 -2
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +75 -52
- package/dist/collision-filter/shader-module.js.map +1 -0
- package/dist/data-filter/aggregator.d.ts +4 -10
- package/dist/data-filter/aggregator.d.ts.map +1 -1
- package/dist/data-filter/aggregator.js +15 -8
- package/dist/data-filter/aggregator.js.map +1 -0
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +49 -39
- package/dist/data-filter/data-filter-extension.js.map +1 -0
- package/dist/data-filter/shader-module.d.ts +12 -5
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +190 -131
- package/dist/data-filter/shader-module.js.map +1 -0
- package/dist/dist.dev.js +2720 -2037
- package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
- package/dist/fill-style/fill-style-extension.js +12 -4
- package/dist/fill-style/fill-style-extension.js.map +1 -0
- package/dist/fill-style/shader-module.d.ts +64 -6
- package/dist/fill-style/shader-module.d.ts.map +1 -1
- package/dist/fill-style/shader-module.js +74 -51
- package/dist/fill-style/shader-module.js.map +1 -0
- package/dist/fp64/fp64-extension.d.ts +1 -0
- package/dist/fp64/fp64-extension.d.ts.map +1 -1
- package/dist/fp64/fp64-extension.js +8 -19
- package/dist/fp64/fp64-extension.js.map +1 -0
- package/dist/fp64/project64.d.ts +2 -2
- package/dist/fp64/project64.d.ts.map +1 -1
- package/dist/fp64/project64.glsl.d.ts +1 -1
- package/dist/fp64/project64.glsl.d.ts.map +1 -1
- package/dist/fp64/project64.glsl.js +19 -21
- package/dist/fp64/project64.glsl.js.map +1 -0
- package/dist/fp64/project64.js +25 -24
- package/dist/fp64/project64.js.map +1 -0
- package/dist/index.cjs +1034 -528
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/mask/mask-effect.d.ts +5 -3
- package/dist/mask/mask-effect.d.ts.map +1 -1
- package/dist/mask/mask-effect.js +13 -5
- package/dist/mask/mask-effect.js.map +1 -0
- package/dist/mask/mask-extension.d.ts +1 -1
- package/dist/mask/mask-extension.d.ts.map +1 -1
- package/dist/mask/mask-extension.js +14 -8
- package/dist/mask/mask-extension.js.map +1 -0
- package/dist/mask/mask-pass.d.ts +2 -43
- package/dist/mask/mask-pass.d.ts.map +1 -1
- package/dist/mask/mask-pass.js +5 -1
- package/dist/mask/mask-pass.js.map +1 -0
- package/dist/mask/shader-module.d.ts +60 -3
- package/dist/mask/shader-module.d.ts.map +1 -1
- package/dist/mask/shader-module.js +74 -46
- package/dist/mask/shader-module.js.map +1 -0
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +21 -24
- package/dist/path-style/path-style-extension.js.map +1 -0
- package/dist/path-style/shaders.glsl.d.ts.map +1 -1
- package/dist/path-style/shaders.glsl.js +12 -7
- package/dist/path-style/shaders.glsl.js.map +1 -0
- package/dist/terrain/height-map-builder.d.ts.map +1 -1
- package/dist/terrain/height-map-builder.js +4 -0
- package/dist/terrain/height-map-builder.js.map +1 -0
- package/dist/terrain/shader-module.d.ts +60 -6
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +70 -61
- package/dist/terrain/shader-module.js.map +1 -0
- package/dist/terrain/terrain-cover.d.ts.map +1 -1
- package/dist/terrain/terrain-cover.js +4 -0
- package/dist/terrain/terrain-cover.js.map +1 -0
- package/dist/terrain/terrain-effect.d.ts +4 -2
- package/dist/terrain/terrain-effect.d.ts.map +1 -1
- package/dist/terrain/terrain-effect.js +32 -18
- package/dist/terrain/terrain-effect.js.map +1 -0
- package/dist/terrain/terrain-extension.d.ts.map +1 -1
- package/dist/terrain/terrain-extension.js +4 -0
- package/dist/terrain/terrain-extension.js.map +1 -0
- package/dist/terrain/terrain-pass.d.ts +6 -41
- package/dist/terrain/terrain-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-pass.js +12 -1
- package/dist/terrain/terrain-pass.js.map +1 -0
- package/dist/terrain/terrain-picking-pass.d.ts +7 -1
- package/dist/terrain/terrain-picking-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-picking-pass.js +12 -1
- package/dist/terrain/terrain-picking-pass.js.map +1 -0
- package/dist/terrain/utils.d.ts.map +1 -1
- package/dist/terrain/utils.js +4 -0
- package/dist/terrain/utils.js.map +1 -0
- package/dist/utils/debug.d.ts +2 -2
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +4 -1
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/projection-utils.d.ts.map +1 -1
- package/dist/utils/projection-utils.js +4 -0
- package/dist/utils/projection-utils.js.map +1 -0
- package/dist.min.js +1102 -817
- package/package.json +8 -8
- package/src/brushing/brushing-extension.ts +17 -20
- package/src/brushing/shader-module.ts +58 -47
- package/src/clip/clip-extension.ts +38 -40
- package/src/collision-filter/collision-filter-effect.ts +31 -20
- package/src/collision-filter/collision-filter-extension.ts +6 -7
- package/src/collision-filter/collision-filter-pass.ts +17 -6
- package/src/collision-filter/shader-module.ts +40 -22
- package/src/data-filter/aggregator.ts +23 -11
- package/src/data-filter/data-filter-extension.ts +76 -49
- package/src/data-filter/shader-module.ts +150 -90
- package/src/fill-style/fill-style-extension.ts +13 -5
- package/src/fill-style/shader-module.ts +84 -52
- package/src/fp64/fp64-extension.ts +8 -19
- package/src/fp64/project64.glsl.ts +18 -21
- package/src/fp64/project64.ts +27 -28
- package/src/index.ts +5 -0
- package/src/mask/mask-effect.ts +17 -7
- package/src/mask/mask-extension.ts +16 -9
- package/src/mask/mask-pass.ts +17 -3
- package/src/mask/shader-module.ts +63 -27
- package/src/path-style/path-style-extension.ts +27 -28
- package/src/path-style/shaders.glsl.ts +13 -7
- package/src/terrain/height-map-builder.ts +4 -0
- package/src/terrain/shader-module.ts +62 -44
- package/src/terrain/terrain-cover.ts +4 -0
- package/src/terrain/terrain-effect.ts +36 -19
- package/src/terrain/terrain-extension.ts +4 -0
- package/src/terrain/terrain-pass.ts +19 -3
- package/src/terrain/terrain-picking-pass.ts +15 -2
- package/src/terrain/utils.ts +4 -0
- package/src/utils/debug.ts +4 -0
- package/src/utils/projection-utils.ts +4 -0
- package/dist/utils/syntax-tags.d.ts +0 -6
- package/dist/utils/syntax-tags.d.ts.map +0 -1
- package/dist/utils/syntax-tags.js +0 -5
- package/src/utils/syntax-tags.ts +0 -5
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
/* eslint-disable camelcase */
|
|
2
6
|
|
|
3
7
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
4
|
-
import {project} from '@deck.gl/core';
|
|
8
|
+
import {project, ProjectProps, ProjectUniforms} from '@deck.gl/core';
|
|
5
9
|
|
|
6
10
|
import type {Texture} from '@luma.gl/core';
|
|
7
11
|
import type {Bounds} from '../utils/projection-utils';
|
|
8
12
|
import type {TerrainCover} from './terrain-cover';
|
|
9
|
-
import {glsl} from '../utils/syntax-tags';
|
|
10
13
|
|
|
11
14
|
/** Module parameters expected by the terrain shader module */
|
|
12
|
-
export type
|
|
13
|
-
|
|
15
|
+
export type TerrainModuleProps = {
|
|
16
|
+
project: ProjectProps;
|
|
17
|
+
isPicking: boolean;
|
|
14
18
|
heightMap: Texture | null;
|
|
15
19
|
heightMapBounds?: Bounds | null;
|
|
16
20
|
dummyHeightMap: Texture;
|
|
@@ -20,6 +24,15 @@ export type TerrainModuleSettings = {
|
|
|
20
24
|
terrainSkipRender?: boolean;
|
|
21
25
|
};
|
|
22
26
|
|
|
27
|
+
type TerrainModuleUniforms = {
|
|
28
|
+
mode: number;
|
|
29
|
+
bounds: [number, number, number, number];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type TerrainModuleBindings = {
|
|
33
|
+
terrain_map: Texture;
|
|
34
|
+
};
|
|
35
|
+
|
|
23
36
|
/** A model can have one of the following modes */
|
|
24
37
|
export const TERRAIN_MODE = {
|
|
25
38
|
NONE: 0,
|
|
@@ -39,35 +52,44 @@ const TERRAIN_MODE_CONSTANTS = Object.keys(TERRAIN_MODE)
|
|
|
39
52
|
.map(key => `const float TERRAIN_MODE_${key} = ${TERRAIN_MODE[key]}.0;`)
|
|
40
53
|
.join('\n');
|
|
41
54
|
|
|
55
|
+
const uniformBlock =
|
|
56
|
+
// eslint-disable-next-line prefer-template
|
|
57
|
+
TERRAIN_MODE_CONSTANTS +
|
|
58
|
+
/* glsl */ `
|
|
59
|
+
uniform terrainUniforms {
|
|
60
|
+
float mode;
|
|
61
|
+
vec4 bounds;
|
|
62
|
+
} terrain;
|
|
63
|
+
|
|
64
|
+
uniform sampler2D terrain_map;
|
|
65
|
+
`;
|
|
66
|
+
|
|
42
67
|
export const terrainModule = {
|
|
43
68
|
name: 'terrain',
|
|
44
69
|
dependencies: [project],
|
|
70
|
+
// eslint-disable-next-line prefer-template
|
|
71
|
+
vs: uniformBlock + /* glsl */ 'out vec3 commonPos;',
|
|
72
|
+
// eslint-disable-next-line prefer-template
|
|
73
|
+
fs: uniformBlock + /* glsl */ 'in vec3 commonPos;',
|
|
45
74
|
inject: {
|
|
46
|
-
'vs:#
|
|
47
|
-
|
|
48
|
-
uniform float terrain_mode;
|
|
49
|
-
uniform sampler2D terrain_map;
|
|
50
|
-
uniform vec4 terrain_bounds;
|
|
51
|
-
out vec3 commonPos;
|
|
52
|
-
` + TERRAIN_MODE_CONSTANTS,
|
|
53
|
-
'vs:#main-start': glsl`
|
|
54
|
-
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
75
|
+
'vs:#main-start': /* glsl */ `
|
|
76
|
+
if (terrain.mode == TERRAIN_MODE_SKIP) {
|
|
55
77
|
gl_Position = vec4(0.0);
|
|
56
78
|
return;
|
|
57
79
|
}
|
|
58
80
|
`,
|
|
59
|
-
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
81
|
+
'vs:DECKGL_FILTER_GL_POSITION': /* glsl */ `
|
|
60
82
|
commonPos = geometry.position.xyz;
|
|
61
|
-
if (
|
|
62
|
-
vec2 texCoords = (commonPos.xy -
|
|
83
|
+
if (terrain.mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
84
|
+
vec2 texCoords = (commonPos.xy - terrain.bounds.xy) / terrain.bounds.zw;
|
|
63
85
|
position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);
|
|
64
|
-
commonPos.z +=
|
|
86
|
+
commonPos.z += project.commonOrigin.z;
|
|
65
87
|
}
|
|
66
|
-
if (
|
|
88
|
+
if (terrain.mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
67
89
|
vec3 anchor = geometry.worldPosition;
|
|
68
90
|
anchor.z = 0.0;
|
|
69
91
|
vec3 anchorCommon = project_position(anchor);
|
|
70
|
-
vec2 texCoords = (anchorCommon.xy -
|
|
92
|
+
vec2 texCoords = (anchorCommon.xy - terrain.bounds.xy) / terrain.bounds.zw;
|
|
71
93
|
if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {
|
|
72
94
|
float terrainZ = texture(terrain_map, texCoords).r;
|
|
73
95
|
geometry.position.z += terrainZ;
|
|
@@ -75,24 +97,17 @@ if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
|
75
97
|
}
|
|
76
98
|
}
|
|
77
99
|
`,
|
|
78
|
-
'fs:#
|
|
79
|
-
|
|
80
|
-
uniform float terrain_mode;
|
|
81
|
-
uniform sampler2D terrain_map;
|
|
82
|
-
uniform vec4 terrain_bounds;
|
|
83
|
-
in vec3 commonPos;
|
|
84
|
-
` + TERRAIN_MODE_CONSTANTS,
|
|
85
|
-
'fs:#main-start': glsl`
|
|
86
|
-
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
100
|
+
'fs:#main-start': /* glsl */ `
|
|
101
|
+
if (terrain.mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
87
102
|
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
88
103
|
return;
|
|
89
104
|
}
|
|
90
105
|
`,
|
|
91
|
-
'fs:DECKGL_FILTER_COLOR': glsl`
|
|
92
|
-
if ((
|
|
93
|
-
vec2 texCoords = (commonPos.xy -
|
|
106
|
+
'fs:DECKGL_FILTER_COLOR': /* glsl */ `
|
|
107
|
+
if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_USE_COVER_ONLY)) {
|
|
108
|
+
vec2 texCoords = (commonPos.xy - terrain.bounds.xy) / terrain.bounds.zw;
|
|
94
109
|
vec4 pixel = texture(terrain_map, texCoords);
|
|
95
|
-
if (
|
|
110
|
+
if (terrain.mode == TERRAIN_MODE_USE_COVER_ONLY) {
|
|
96
111
|
color = pixel;
|
|
97
112
|
} else {
|
|
98
113
|
// pixel is premultiplied
|
|
@@ -103,7 +118,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
103
118
|
`
|
|
104
119
|
},
|
|
105
120
|
// eslint-disable-next-line complexity
|
|
106
|
-
getUniforms: (opts: Partial<
|
|
121
|
+
getUniforms: (opts: Partial<TerrainModuleProps> = {}) => {
|
|
107
122
|
if ('dummyHeightMap' in opts) {
|
|
108
123
|
const {
|
|
109
124
|
drawToTerrainHeightMap,
|
|
@@ -114,8 +129,8 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
114
129
|
useTerrainHeightMap,
|
|
115
130
|
terrainSkipRender
|
|
116
131
|
} = opts;
|
|
117
|
-
|
|
118
|
-
const {
|
|
132
|
+
const projectUniforms = project.getUniforms(opts.project) as ProjectUniforms;
|
|
133
|
+
const {commonOrigin} = projectUniforms;
|
|
119
134
|
|
|
120
135
|
let mode: number = terrainSkipRender ? TERRAIN_MODE.SKIP : TERRAIN_MODE.NONE;
|
|
121
136
|
// height map if case USE_HEIGHT_MAP, terrain cover if USE_COVER, otherwise empty
|
|
@@ -131,12 +146,11 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
131
146
|
bounds = heightMapBounds!;
|
|
132
147
|
} else if (terrainCover) {
|
|
133
148
|
// This is a terrain layer
|
|
134
|
-
const
|
|
135
|
-
const fbo = isPicking
|
|
149
|
+
const fbo = opts.isPicking
|
|
136
150
|
? terrainCover.getPickingFramebuffer()
|
|
137
151
|
: terrainCover.getRenderFramebuffer();
|
|
138
152
|
sampler = fbo?.colorAttachments[0].texture;
|
|
139
|
-
if (isPicking) {
|
|
153
|
+
if (opts.isPicking) {
|
|
140
154
|
// Never render the layer itself in picking pass
|
|
141
155
|
mode = TERRAIN_MODE.SKIP;
|
|
142
156
|
}
|
|
@@ -150,19 +164,23 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
150
164
|
|
|
151
165
|
/* eslint-disable camelcase */
|
|
152
166
|
return {
|
|
153
|
-
|
|
167
|
+
mode,
|
|
154
168
|
terrain_map: sampler,
|
|
155
169
|
// Convert bounds to the common space, as [minX, minY, width, height]
|
|
156
|
-
|
|
170
|
+
bounds: bounds
|
|
157
171
|
? [
|
|
158
|
-
bounds[0] -
|
|
159
|
-
bounds[1] -
|
|
172
|
+
bounds[0] - commonOrigin[0],
|
|
173
|
+
bounds[1] - commonOrigin[1],
|
|
160
174
|
bounds[2] - bounds[0],
|
|
161
175
|
bounds[3] - bounds[1]
|
|
162
176
|
]
|
|
163
177
|
: [0, 0, 0, 0]
|
|
164
178
|
};
|
|
165
179
|
}
|
|
166
|
-
return
|
|
180
|
+
return {};
|
|
181
|
+
},
|
|
182
|
+
uniformTypes: {
|
|
183
|
+
mode: 'f32',
|
|
184
|
+
bounds: 'vec4<f32>'
|
|
167
185
|
}
|
|
168
|
-
} as ShaderModule<
|
|
186
|
+
} as const satisfies ShaderModule<TerrainModuleProps, TerrainModuleUniforms, TerrainModuleBindings>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {Texture} from '@luma.gl/core';
|
|
2
6
|
import {log} from '@deck.gl/core';
|
|
3
7
|
|
|
4
|
-
import {terrainModule,
|
|
8
|
+
import {terrainModule, TerrainModuleProps} from './shader-module';
|
|
5
9
|
import {TerrainCover} from './terrain-cover';
|
|
6
10
|
import {TerrainPass} from './terrain-pass';
|
|
7
11
|
import {TerrainPickingPass, TerrainPickingPassRenderOptions} from './terrain-picking-pass';
|
|
@@ -43,7 +47,6 @@ export class TerrainEffect implements Effect {
|
|
|
43
47
|
log.warn('Terrain offset mode is not supported by this browser')();
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
// @ts-expect-error stricter luma gl types
|
|
47
50
|
deck._addDefaultShaderModule(terrainModule);
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -83,16 +86,23 @@ export class TerrainEffect implements Effect {
|
|
|
83
86
|
this._updateTerrainCovers(terrainLayers, drapeLayers, viewport, opts);
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
getShaderModuleProps(
|
|
90
|
+
layer: Layer,
|
|
91
|
+
otherShaderModuleProps: Record<string, any>
|
|
92
|
+
): {terrain: TerrainModuleProps} {
|
|
87
93
|
const {terrainDrawMode} = layer.state;
|
|
88
94
|
|
|
89
95
|
return {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
terrain: {
|
|
97
|
+
project: otherShaderModuleProps.project,
|
|
98
|
+
isPicking: this.isPicking,
|
|
99
|
+
heightMap: this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture || null,
|
|
100
|
+
heightMapBounds: this.heightMap?.bounds,
|
|
101
|
+
dummyHeightMap: this.dummyHeightMap!,
|
|
102
|
+
terrainCover: this.isDrapingEnabled ? this.terrainCovers.get(layer.id) : null,
|
|
103
|
+
useTerrainHeightMap: terrainDrawMode === 'offset',
|
|
104
|
+
terrainSkipRender: terrainDrawMode === 'drape' || !layer.props.operation.includes('draw')
|
|
105
|
+
}
|
|
96
106
|
};
|
|
97
107
|
}
|
|
98
108
|
|
|
@@ -112,7 +122,6 @@ export class TerrainEffect implements Effect {
|
|
|
112
122
|
}
|
|
113
123
|
this.terrainCovers.clear();
|
|
114
124
|
|
|
115
|
-
// @ts-expect-error stricter luma gl types
|
|
116
125
|
deck._removeDefaultShaderModule(terrainModule);
|
|
117
126
|
}
|
|
118
127
|
|
|
@@ -130,11 +139,15 @@ export class TerrainEffect implements Effect {
|
|
|
130
139
|
this.terrainPass.renderHeightMap(this.heightMap, {
|
|
131
140
|
...opts,
|
|
132
141
|
layers: terrainLayers,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
shaderModuleProps: {
|
|
143
|
+
terrain: {
|
|
144
|
+
heightMapBounds: this.heightMap.bounds,
|
|
145
|
+
dummyHeightMap: this.dummyHeightMap,
|
|
146
|
+
drawToTerrainHeightMap: true
|
|
147
|
+
},
|
|
148
|
+
project: {
|
|
149
|
+
devicePixelRatio: 1
|
|
150
|
+
}
|
|
138
151
|
}
|
|
139
152
|
});
|
|
140
153
|
}
|
|
@@ -188,10 +201,14 @@ export class TerrainEffect implements Effect {
|
|
|
188
201
|
renderPass.renderTerrainCover(terrainCover, {
|
|
189
202
|
...opts,
|
|
190
203
|
layers: drapeLayers,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
204
|
+
shaderModuleProps: {
|
|
205
|
+
terrain: {
|
|
206
|
+
dummyHeightMap: this.dummyHeightMap,
|
|
207
|
+
terrainSkipRender: false
|
|
208
|
+
},
|
|
209
|
+
project: {
|
|
210
|
+
devicePixelRatio: 1
|
|
211
|
+
}
|
|
195
212
|
}
|
|
196
213
|
});
|
|
197
214
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Parameters, RenderPipelineParameters} from '@luma.gl/core';
|
|
2
6
|
import {Layer, Viewport, _LayersPass as LayersPass, LayersPassRenderOptions} from '@deck.gl/core';
|
|
3
7
|
import type {HeightMapBuilder} from './height-map-builder';
|
|
4
8
|
import type {TerrainCover} from './terrain-cover';
|
|
@@ -75,12 +79,24 @@ export class TerrainPass extends LayersPass {
|
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
81
|
|
|
78
|
-
protected getLayerParameters(
|
|
82
|
+
protected getLayerParameters(
|
|
83
|
+
layer: Layer<{}>,
|
|
84
|
+
layerIndex: number,
|
|
85
|
+
viewport: Viewport
|
|
86
|
+
): Parameters {
|
|
79
87
|
return {
|
|
80
88
|
...layer.props.parameters,
|
|
81
89
|
blend: true,
|
|
82
|
-
|
|
90
|
+
depthCompare: 'always',
|
|
83
91
|
...(layer.props.operation.includes('terrain') && TERRAIN_BLENDING)
|
|
84
92
|
};
|
|
85
93
|
}
|
|
94
|
+
|
|
95
|
+
getShaderModuleProps(layer: Layer, effects: any, otherShaderModuleProps: Record<string, any>) {
|
|
96
|
+
return {
|
|
97
|
+
terrain: {
|
|
98
|
+
project: otherShaderModuleProps.project
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
86
102
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Layer,
|
|
3
7
|
Viewport,
|
|
@@ -5,6 +9,7 @@ import {
|
|
|
5
9
|
_PickLayersPass as PickLayersPass
|
|
6
10
|
} from '@deck.gl/core';
|
|
7
11
|
import type {TerrainCover} from './terrain-cover';
|
|
12
|
+
import {Parameters} from '@luma.gl/core';
|
|
8
13
|
|
|
9
14
|
export type TerrainPickingPassRenderOptions = LayersPassRenderOptions & {
|
|
10
15
|
pickZ: boolean;
|
|
@@ -68,7 +73,7 @@ export class TerrainPickingPass extends PickLayersPass {
|
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
protected getLayerParameters(layer: Layer, layerIndex: number, viewport: Viewport):
|
|
76
|
+
protected getLayerParameters(layer: Layer, layerIndex: number, viewport: Viewport): Parameters {
|
|
72
77
|
let parameters: any;
|
|
73
78
|
if (this.drawParameters[layer.id]) {
|
|
74
79
|
parameters = this.drawParameters[layer.id];
|
|
@@ -76,6 +81,14 @@ export class TerrainPickingPass extends PickLayersPass {
|
|
|
76
81
|
parameters = super.getLayerParameters(layer, layerIndex, viewport);
|
|
77
82
|
parameters.blend = true;
|
|
78
83
|
}
|
|
79
|
-
return {...parameters,
|
|
84
|
+
return {...parameters, depthCompare: 'always'};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getShaderModuleProps(layer: Layer, effects: any, otherShaderModuleProps: Record<string, any>) {
|
|
88
|
+
return {
|
|
89
|
+
terrain: {
|
|
90
|
+
project: otherShaderModuleProps.project
|
|
91
|
+
}
|
|
92
|
+
};
|
|
80
93
|
}
|
|
81
94
|
}
|
package/src/terrain/utils.ts
CHANGED
package/src/utils/debug.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-tags.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-tags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,IAAI,MAAO,oBAAoB,WAAW,CAAC"}
|