Enable ImageBitmap again for external images in Model #9627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ImageBitmap
was added in #7579 to reduce frame rate hitches when loading models and a follow up PR was added to fix a regression for images that were being flipped incorrectly #7701. The PR added a flag calledpreferImageBitmap
and each system now had to opt-in to usingImageBitmap
. While reviewing #9624 I noticed a pretty big omission where calls tofetchImage
inModel.js
were not setting this flag to true and were not taking advantage ofImageBitmap
. Note that this was only happening for external images; embedded images were fine because they go through a different code path,loadImageFromTypedArray
, which defaults to usingImageBitmap
if available. Thankfully embedded images are much more common in 3D Tiles so the regression wasn't super serious.This wasn't mentioned in the PR at all so I think it was a mistake rather than intentional. I looked at all the sample models and everything still looks correct after the change. I also tested the bike model in #7579 and saw the expected improvement.
I fixed this in
GltfImageLoader
too which will be used as part of the model rewrite.