bevy/examples/3d
Robert Swain 05e5008624 Support array / cubemap / cubemap array textures in KTX2 (#5325)
# Objective

- Fix / support KTX2 array / cubemap / cubemap array textures
- Fixes #4495 . Supersedes #4514 .

## Solution

- Add `Option<TextureViewDescriptor>` to `Image` to enable configuration of the `TextureViewDimension` of a texture.
  - This allows users to set `D2Array`, `D3`, `Cube`, `CubeArray` or whatever they need
  - Automatically configure this when loading KTX2
- Transcode all layers and faces instead of just one
- Use the UASTC block size of 128 bits, and the number of blocks in x/y for a given mip level in order to determine the offset of the layer and face within the KTX2 mip level data
- `wgpu` wants data ordered as layer 0 mip 0..n, layer 1 mip 0..n, etc. See https://docs.rs/wgpu/latest/wgpu/util/trait.DeviceExt.html#tymethod.create_texture_with_data
- Reorder the data KTX2 mip X layer Y face Z to `wgpu` layer Y face Z mip X order
- Add a `skybox` example to demonstrate / test loading cubemaps from PNG and KTX2, including ASTC 4x4, BC7, and ETC2 compression for support everywhere. Note that you need to enable the `ktx2,zstd` features to be able to load the compressed textures.

---

## Changelog

- Fixed: KTX2 array / cubemap / cubemap array textures
- Fixes: Validation failure for compressed textures stored in KTX2 where the width/height are not a multiple of the block dimensions.
- Added: `Image` now has an `Option<TextureViewDescriptor>` field to enable configuration of the texture view. This is useful for configuring the `TextureViewDimension` when it is not just a plain 2D texture and the loader could/did not identify what it should be.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-07-30 07:02:58 +00:00
..
3d_scene.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
lighting.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
lines.rs add a 3d lines example (#5319) 2022-07-15 22:37:05 +00:00
load_gltf.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
msaa.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
orthographic.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
parenting.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
pbr.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
render_to_texture.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
shadow_biases.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
shadow_caster_receiver.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
shapes.rs Fix blurry debug texture in 3d shapes example (#5472) 2022-07-28 02:19:32 +00:00
skybox.rs Support array / cubemap / cubemap array textures in KTX2 (#5325) 2022-07-30 07:02:58 +00:00
spherical_area_lights.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
split_screen.rs add a SceneBundle to spawn a scene (#2424) 2022-06-09 20:34:09 +00:00
spotlight.rs Spotlights (#4715) 2022-07-08 19:57:43 +00:00
texture.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
transparency_3d.rs transparency_3d example tweaks (#4968) 2022-06-23 18:36:07 +00:00
two_passes.rs Add "depth_load_op" configuration to 3d Cameras (#4904) 2022-06-07 22:22:10 +00:00
update_gltf_scene.rs Update codebase to use IntoIterator where possible. (#5269) 2022-07-11 15:28:50 +00:00
vertex_colors.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
wireframe.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00