-
-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of multi-sprites in mbgl-core #1858
Conversation
Cause various crashes from now.
Added mutex to dodge memory issues. SpriteLoader can now handle null sprites.
for more information, see https://pre-commit.ci
…aplibre-native into feature/multi-sprites
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
Please add tests to style_parser.test.cpp
to validate both the old (single string URL) and new (multiple sprites in array) are parsed correctly. Does an empty array get parsed correctly? What is the behavior when specifying the same sprite id twice? Some inspiration can be taken from https://github.com/maplibre/maplibre-gl-js/pull/1805/files#diff-3f25c81a5d56e4b9c90f8e63d1bdc10eeaf8e0de78818ff567d87c5ff5950710
We need to copy the render tests from MapLibre GL JS.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I resolved some of the issues, but one big issue still exist. In the current commit version you can have multiple sprites with the same id. MapLibre GL JS doesn't allow that and I need to handle this case + unit tests. |
…aplibre-native into feature/multi-sprites
for more information, see https://pre-commit.ci
I implemented checks about id uniqueness. Seems to be good for me. Tell me if something is wrong. |
@Geolives Will do a manual test today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for getting back again to this PR so late.
Code looks good, but we still need to add a render test.
Since this feature already exists in MapLibre GL JS if I remember correctly, can we copy-paste the render test from there? |
It's probably better if you can do it, as my understandings about the render tests are minor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience with this one. The new render tests passed locally. Thanks for this awesome contribution!
Bloaty Results (iOS) 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-1858-compared-to-main.txt |
iOS render test passes locally. On CI it complains about missing metrics. |
metrics/linux-gcc8-release/render-tests/sprites/array-default-only/metrics.json
Show resolved
Hide resolved
metrics/linux-gcc8-release/render-tests/sprites/array-multiple/metrics.json
Show resolved
Hide resolved
Co-authored-by: Christophe Brasseur <christophe.brasseur@geolives.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: Christophe Brasseur <christophe.brasseur@geolives.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: Christophe Brasseur <christophe.brasseur@geolives.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net>
In order to solve #641.
Implemented in the same way as for Maplibre GL JS.
In detail
In Style JSON,
sprite
property can now be a string or an array. If this is an array that must contains object(s) with id and urls.SpriteLoader
can now manage multiple sprites in parallel.Style::Impl
now stores the information about how much sprites are loaded. Included a methodareSpritesLoaded()
to be adequate with the old boolean property that serves the same goal.When using a string as sprite, that creates internally a Sprite object with id default and the url.
When using an array, there is a parsing to create adequate Sprite objects.
Usage
In images identifiers you need to prepend the sprite id to the image. Example :
That leads to the image identifier 'myimage' for the sprite object with id 'hiking'.
If id of your sprite is 'default', you don't need to prepend it :
Tip: If your icon-image is property driven, you can use this instead :