Skip to content

Add texture load hook to gltf extension handler#24207

Draft
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:gltf-load-texture-hook
Draft

Add texture load hook to gltf extension handler#24207
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:gltf-load-texture-hook

Conversation

@beicause
Copy link
Copy Markdown
Member

@beicause beicause commented May 9, 2026

Objective

Fixes #21185

Solution

Add on_texture_load hook to GltfExtensionHandler. After parsing gltf textures, we iterate gltf extention handlers to let them load the parsed textures to image handles. Gltf extention handlers can choose to bypass it or load it. Once a extention handler loads it we use its result and skip the remaining handlers.

I removed the loading textures with IoTaskPool because we can't - at least &mut LoadContext cannot be accessed from multiple threads. But this probably doesn't matter because load_context.load_builder().load() is already deferred load and multi-threaded. This might only be helpful for loading embedded images.

Also add HdrTextureLoader and ExrTextureLoader for loading external gltf textures by recognizing file extension. But this is not ideal since asset loader cannot recognize paths or attempt to load and recognize assets.

Testing

TODO

@mnmaita mnmaita added C-Feature A new feature, making something new possible S-Needs-Review Needs reviewer attention (from anyone!) to move forward S-Needs-Testing Testing must be done before this is safe to merge A-glTF Related to the glTF 3D scene/model format D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-glTF Related to the glTF 3D scene/model format C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward S-Needs-Testing Testing must be done before this is safe to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow image decoding to be switched out in bevy_gltf

2 participants