@deck.gl/extensions 9.3.2 → 9.3.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/dist.dev.js +30 -12
- package/dist/index.cjs +31 -14
- package/dist/index.cjs.map +2 -2
- package/dist/mask/mask-effect.d.ts +1 -1
- package/dist/mask/mask-effect.d.ts.map +1 -1
- package/dist/mask/mask-effect.js +4 -2
- package/dist/mask/mask-effect.js.map +1 -1
- package/dist/terrain/shader-module.d.ts +4 -4
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +20 -10
- package/dist/terrain/shader-module.js.map +1 -1
- package/dist/terrain/terrain-effect.d.ts +1 -1
- package/dist/terrain/terrain-effect.d.ts.map +1 -1
- package/dist/terrain/terrain-effect.js +16 -1
- package/dist/terrain/terrain-effect.js.map +1 -1
- package/dist/terrain/terrain-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-pass.js +0 -1
- package/dist/terrain/terrain-pass.js.map +1 -1
- package/dist/terrain/terrain-picking-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-picking-pass.js +0 -1
- package/dist/terrain/terrain-picking-pass.js.map +1 -1
- package/dist.min.js +9 -9
- package/package.json +2 -2
- package/src/mask/mask-effect.ts +5 -0
- package/src/terrain/shader-module.ts +22 -11
- package/src/terrain/terrain-effect.ts +19 -2
- package/src/terrain/terrain-pass.ts +0 -1
- package/src/terrain/terrain-picking-pass.ts +0 -1
package/src/mask/mask-effect.ts
CHANGED
|
@@ -70,6 +70,7 @@ export default class MaskEffect implements Effect {
|
|
|
70
70
|
viewports,
|
|
71
71
|
onViewportActive,
|
|
72
72
|
views,
|
|
73
|
+
effects,
|
|
73
74
|
isPicking
|
|
74
75
|
}: PreRenderOptions): MaskPreRenderStats {
|
|
75
76
|
let didRender = false;
|
|
@@ -103,6 +104,7 @@ export default class MaskEffect implements Effect {
|
|
|
103
104
|
layerFilter,
|
|
104
105
|
onViewportActive,
|
|
105
106
|
views,
|
|
107
|
+
effects,
|
|
106
108
|
viewport,
|
|
107
109
|
viewportChanged
|
|
108
110
|
});
|
|
@@ -120,12 +122,14 @@ export default class MaskEffect implements Effect {
|
|
|
120
122
|
layerFilter,
|
|
121
123
|
onViewportActive,
|
|
122
124
|
views,
|
|
125
|
+
effects,
|
|
123
126
|
viewport,
|
|
124
127
|
viewportChanged
|
|
125
128
|
}: {
|
|
126
129
|
layerFilter: PreRenderOptions['layerFilter'];
|
|
127
130
|
onViewportActive: PreRenderOptions['onViewportActive'];
|
|
128
131
|
views: PreRenderOptions['views'];
|
|
132
|
+
effects: PreRenderOptions['effects'];
|
|
129
133
|
viewport: Viewport;
|
|
130
134
|
viewportChanged: boolean;
|
|
131
135
|
}
|
|
@@ -190,6 +194,7 @@ export default class MaskEffect implements Effect {
|
|
|
190
194
|
viewports: maskViewport ? [maskViewport] : [],
|
|
191
195
|
onViewportActive,
|
|
192
196
|
views,
|
|
197
|
+
effects,
|
|
193
198
|
shaderModuleProps: {
|
|
194
199
|
project: {
|
|
195
200
|
devicePixelRatio: 1
|
|
@@ -119,7 +119,13 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
119
119
|
},
|
|
120
120
|
// eslint-disable-next-line complexity
|
|
121
121
|
getUniforms: (opts: Partial<TerrainModuleProps> = {}) => {
|
|
122
|
-
if (
|
|
122
|
+
if (!opts.dummyHeightMap) {
|
|
123
|
+
// TerrainEffect has not provided props (e.g. not set up yet, or this pass
|
|
124
|
+
// doesn't include the terrain effect in its effects list)
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if ('terrainSkipRender' in opts || 'drawToTerrainHeightMap' in opts) {
|
|
123
129
|
const {
|
|
124
130
|
drawToTerrainHeightMap,
|
|
125
131
|
heightMap,
|
|
@@ -134,7 +140,7 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
134
140
|
|
|
135
141
|
let mode: number = terrainSkipRender ? TERRAIN_MODE.SKIP : TERRAIN_MODE.NONE;
|
|
136
142
|
// height map if case USE_HEIGHT_MAP, terrain cover if USE_COVER, otherwise empty
|
|
137
|
-
let sampler: Texture
|
|
143
|
+
let sampler: Texture = dummyHeightMap;
|
|
138
144
|
// height map bounds if case USE_HEIGHT_MAP, terrain cover bounds if USE_COVER, otherwise null
|
|
139
145
|
let bounds: number[] | null = null;
|
|
140
146
|
if (drawToTerrainHeightMap) {
|
|
@@ -149,19 +155,17 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
149
155
|
const fbo = opts.isPicking
|
|
150
156
|
? terrainCover.getPickingFramebuffer()
|
|
151
157
|
: terrainCover.getRenderFramebuffer();
|
|
152
|
-
|
|
158
|
+
const coverTexture = fbo?.colorAttachments[0].texture;
|
|
153
159
|
if (opts.isPicking) {
|
|
154
160
|
mode = TERRAIN_MODE.SKIP;
|
|
155
161
|
}
|
|
156
|
-
if (
|
|
162
|
+
if (coverTexture) {
|
|
163
|
+
sampler = coverTexture;
|
|
157
164
|
mode = mode === TERRAIN_MODE.SKIP ? TERRAIN_MODE.USE_COVER_ONLY : TERRAIN_MODE.USE_COVER;
|
|
158
165
|
bounds = terrainCover.bounds;
|
|
159
|
-
} else {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// terrain+draw layer without cover FBO: render own picking colors
|
|
163
|
-
mode = TERRAIN_MODE.NONE;
|
|
164
|
-
}
|
|
166
|
+
} else if (opts.isPicking && !terrainSkipRender) {
|
|
167
|
+
// terrain+draw layer without cover FBO: render own picking colors
|
|
168
|
+
mode = TERRAIN_MODE.NONE;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
|
|
@@ -180,7 +184,14 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
180
184
|
: [0, 0, 0, 0]
|
|
181
185
|
};
|
|
182
186
|
}
|
|
183
|
-
|
|
187
|
+
// No terrain-specific props provided but dummyHeightMap is available
|
|
188
|
+
// (e.g. non-terrain render pass where the effect still provides props).
|
|
189
|
+
// Provide the dummy texture to satisfy the terrain_map binding.
|
|
190
|
+
return {
|
|
191
|
+
mode: TERRAIN_MODE.NONE,
|
|
192
|
+
terrain_map: opts.dummyHeightMap,
|
|
193
|
+
bounds: [0, 0, 0, 0]
|
|
194
|
+
};
|
|
184
195
|
},
|
|
185
196
|
uniformTypes: {
|
|
186
197
|
mode: 'f32',
|
|
@@ -38,6 +38,7 @@ export class TerrainEffect implements Effect {
|
|
|
38
38
|
height: 1,
|
|
39
39
|
data: new Uint8Array([0, 0, 0, 0])
|
|
40
40
|
});
|
|
41
|
+
|
|
41
42
|
this.terrainPass = new TerrainPass(device, {id: 'terrain'});
|
|
42
43
|
this.terrainPickingPass = new TerrainPickingPass(device, {id: 'terrain-picking'});
|
|
43
44
|
|
|
@@ -83,13 +84,29 @@ export class TerrainEffect implements Effect {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
const drapeLayers = layers.filter(l => l.state.terrainDrawMode === 'drape');
|
|
86
|
-
|
|
87
|
+
// Filter out the terrain effect itself to avoid feedback loops when rendering terrain covers
|
|
88
|
+
// (the terrain cover FBO would be both read and written to). Other effects like MaskEffect
|
|
89
|
+
// need to be passed through so they can apply to draped layers.
|
|
90
|
+
const nonTerrainEffects = opts.effects?.filter(e => e !== this);
|
|
91
|
+
this._updateTerrainCovers(terrainLayers, drapeLayers, viewport, {
|
|
92
|
+
...opts,
|
|
93
|
+
effects: nonTerrainEffects
|
|
94
|
+
});
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
getShaderModuleProps(
|
|
90
98
|
layer: Layer,
|
|
91
99
|
otherShaderModuleProps: Record<string, any>
|
|
92
|
-
): {terrain: TerrainModuleProps} {
|
|
100
|
+
): {terrain: Partial<TerrainModuleProps>} {
|
|
101
|
+
// Mask layers need the terrain_map binding satisfied but shouldn't use terrain features
|
|
102
|
+
if (layer.props.operation.includes('mask')) {
|
|
103
|
+
return {
|
|
104
|
+
terrain: {
|
|
105
|
+
dummyHeightMap: this.dummyHeightMap!
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
const {terrainDrawMode} = layer.state;
|
|
94
111
|
const terrainCover = this.isDrapingEnabled ? (this.terrainCovers.get(layer.id) ?? null) : null;
|
|
95
112
|
|
|
@@ -69,7 +69,6 @@ export class TerrainPickingPass extends PickLayersPass {
|
|
|
69
69
|
pickingFBO: target,
|
|
70
70
|
pass: `terrain-cover-picking-${terrainCover.id}`,
|
|
71
71
|
layers,
|
|
72
|
-
effects: [],
|
|
73
72
|
viewports: [viewport],
|
|
74
73
|
// Disable the default culling because TileLayer would cull sublayers based on the screen viewport,
|
|
75
74
|
// not the viewport of the terrain cover. Culling is already done by `terrainCover.filterLayers`
|