maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

fill-extrusion breaking change between v1 and v2

Open Pessimistress opened this issue 3 years ago • 5 comments

Interleaving with deck.gl custom layers (depth occlusion) broke between 1.15.3 and 2.0.0. For reference the feature works with mapbox-gl v1 and v2.

Expected:

image

Actual:

image

See demo at: https://codepen.io/Pessimistress/pen/ExEoQXL

maplibre-gl-js version: 1.15.3, 2.0.0, latest

Question

The custom layer example works so the change either happened to near/far plane calculation (deck.gl calculates its own matrices) or depth-buffer related GL parameters.

I am unable to find any documentation about this change. The breaking commit is 20k lines so would appreciate some pointers :)

Pessimistress avatar Aug 02 '22 17:08 Pessimistress

The typescript migration is mainly cosmetic and there shouldn't be major changes there, but it was a big change and this does issue is basically saying there was a breaking change. If you know how this extrusion works I would advise to try and look there as I have little knowledge in that aspect unfortunately. Your help in knowledge in deck.gl might also help here. If you could create a simpler example maybe it will be easier to debug the changes in the code flow.

HarelM avatar Aug 02 '22 18:08 HarelM

Ok so this turns out to be something unrelated to the painter.

deck.gl relies on map.version to handle differences in matrix calculation between mapbox versions: https://github.com/visgl/deck.gl/blob/993613c74347f9da419b58c80030576e73919eed/modules/mapbox/src/deck-utils.js#L145-L151

This property is removed in 2.0.0. https://github.com/maplibre/maplibre-gl-js/blob/v1.15.3/src/ui/map.js#L2748

While I can handle this on our side, since my libs support both mapbox v1, mapbox v2 and maplibre, I frequently find myself in the position where I need to detect the library in use. Mapbox exposes the version number at root (import {version} from 'mapbox-gl') as well as on the Map instance (map.version). Both seem to be gone in maplibre 2.0.

Pessimistress avatar Aug 10 '22 16:08 Pessimistress

Ahh, yes, I removed it since there was a problem referencing the package.json file in the typescript migration. I think I noted that in the release notes... Not sure what the solution my be for this issue though.

HarelM avatar Aug 10 '22 16:08 HarelM

I understand that the removal is intended. If you can agree that exposing the version identifier is still useful, I can open a PR to inject the version number via rollup config.

Pessimistress avatar Aug 10 '22 16:08 Pessimistress

I have no objection to bring back the version if it doesn't break anything. Feel free to create a PR :-)

HarelM avatar Aug 10 '22 16:08 HarelM

We can make typescript behave like this #1471

birkskyum avatar Aug 13 '22 00:08 birkskyum

I believe 2.3.0 have the necessary changes to move forward with this.

birkskyum avatar Aug 13 '22 10:08 birkskyum

@birkskyum Thank you!

Pessimistress avatar Aug 13 '22 15:08 Pessimistress