Types: luma.gl Parameters
Background
I noticed that that passing depthTest in Parameters raises a type error, despite working in the past:
const scatter = new ScatterplotLayer({
parameters: {depthTest: false}
});
Even though luma is not including this on the Parameters type, it continues to work in practice.
I've gone ahead and added some types to surface the inconsistencies, and found that the following keys are used by deck but untyped in luma:
depthRange(collision-filter-pass.ts)depthTest(terrain-pass.ts)
@ibgreen should these types be added to luma or should deck be migrating to a new API?
Change List
- Add
Parameterstype where previously missing - Add
isDrawableLayerParameterstype helper
Type errors will occur when using non-WebGPU compatible parameters. Perhaps they work now but if so they will soon no longer work
Docs at https://luma.gl/docs/api-reference/core/parameters Type defs here https://github.com/visgl/luma.gl/blob/master/modules/core/src/adapter/types/parameters.ts#L99
Recommendations:
depthTestshould be replaced with https://github.com/visgl/luma.gl/blob/bd27f0b51114c751900525b366991e35a542e950/examples/showcase/instancing/app.ts#L178depthRange- Not sure if there is any equivalent, WebGPU uses 0-1 (clear depth buffer is 1)
Regarding depthRange, it isn't clear why we even need to add this. We only ever set it to [0,1]. I think it originally was introduced as a Mapbox workaround and the usage then spread to other places.