Skip to content

Commit d821915

Browse files
committed
fix: fix ExtrudePolygonLayer in webgpu and set default altitudeProperty to 'height' and minHeightProperty to 'min_height'
1 parent a57281d commit d821915

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

packages/gl/src/reshader/pbr/wgsl/standard_vert.wgsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct VertexInput {
3535
#endif
3636

3737
#ifdef HAS_OPACITY
38-
@location($i) aOpacity: f32,
38+
@location($i) aOpacity: vec4u,
3939
#endif
4040

4141
#if HAS_COLOR0
@@ -278,7 +278,7 @@ fn main(input: VertexInput) -> VertexOutput {
278278
#endif
279279

280280
#ifdef HAS_OPACITY
281-
output.vOpacity = input.aOpacity / 255.0;
281+
output.vOpacity = f32(input.aOpacity[0]) / 255.0;
282282
#else
283283
output.vOpacity = 1.0;
284284
#endif

packages/gl/src/reshader/shaderlib/wgsl/mesh_picking.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ const vert = /*wgsl*/`
33
#include <get_output>
44
55
struct VertexInput {
6-
@location($i) aPosition: vec3f,
6+
#ifdef POSITION_IS_INT
7+
@location($i) aPosition: vec4i,
8+
#else
9+
@location($i) aPosition: vec3f,
10+
#endif
711
}
812
913
struct Uniforms {

packages/vt/src/layer/vector/ExtrudePolygonLayer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ const SYMBOL = {
139139
};
140140

141141
const DEFAULT_DATACONFIG = {
142-
defaultAltitude: 20,
142+
altitudeProperty: 'height',
143+
minHeightProperty: 'min_height',
144+
defaultAltitude: 20,
143145
};
144146

145147
const topFilter = (mesh) => {
@@ -278,15 +280,15 @@ class ExtrudePolygonLayerRenderer extends PolygonLayerRenderer {
278280
const topDataConfig = extend({}, dataConfig);
279281
topDataConfig.upsideUpTexture = true;
280282
const painter = new StandardPainter(
281-
this.regl,
283+
this.device,
282284
layer,
283285
this.painterSymbol,
284286
sceneConfig,
285287
0,
286288
topDataConfig
287289
);
288290
this.sidePainter = new StandardPainter(
289-
this.regl,
291+
this.device,
290292
layer,
291293
this.sidePainterSymbol,
292294
sceneConfig,

packages/vt/src/worker/builder/Extrusion.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,13 @@ export function buildExtrudeFaces(
257257
}
258258
}
259259
}
260-
const pickingCtor = PackUtil.getUnsignedArrayType(pickingIds.getLength() ? pickingIds[pickingIds.getLength() - 1] : 0);
260+
const isVector3D = !!center;
261+
let pickingCtor;
262+
if (isVector3D) {
263+
pickingCtor = Float32Array;
264+
} else {
265+
pickingCtor = PackUtil.getUnsignedArrayType(pickingIds.getLength() ? pickingIds[pickingIds.getLength() - 1] : 0);
266+
}
261267

262268
const data = {
263269
hasNegativeHeight,

packages/vt/src/worker/layer/BaseLayerWorker.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,13 @@ export default class BaseLayerWorker {
541541
}
542542
const projectionCode = this.options.projectionCode;
543543
const textureWidth = symbol.material && symbol.material.textureWidth || DEFAULT_TEX_WIDTH;
544-
return Promise.all([Promise.resolve(build3DExtrusion(features, dataConfig, extent, tilePoint,
545-
textureWidth, context.tileInfo.res, glScale, extent / this.options['tileSize'], centimeterToPoint, verticalCentimeterToPoint, symbol, zoom, projectionCode, debugIndex))]);
544+
return Promise.all([Promise.resolve(
545+
build3DExtrusion(
546+
features, dataConfig, extent, tilePoint,
547+
textureWidth, context.tileInfo.res, glScale, extent / this.options['tileSize'], centimeterToPoint,
548+
verticalCentimeterToPoint, symbol, zoom, projectionCode, debugIndex
549+
)
550+
)]);
546551
} else if (type === '3d-wireframe') {
547552
return Promise.all([Promise.resolve(buildWireframe(features, extent, symbol, dataConfig))]);
548553
} else if (type === 'point') {

0 commit comments

Comments
 (0)