bevy/examples/2d
Johannes Ringler 683b08fec9
Respect viewport position in coordinate conversion functions (#17633)
# Objective

- In `Camera::viewport_to_world_2d`, `Camera::viewport_to_world`,
`Camera::world_to_viewport` and `Camera::world_to_viewport_with_depth`,
the results were incorrect when the `Camera::viewport` field was
configured with a viewport position that was non-zero. This PR attempts
to correct that.
- Fixes #16200 

## Solution

- This PR now takes the viewport position into account in the functions
mentioned above.
- Extended `2d_viewport_to_world` example to test the functions with a
dynamic viewport position and size, camera positions and zoom levels. It
is probably worth discussing whether to change the example, add a new
one or just completely skip touching the examples.

## Testing

Used the modified example to test the functions with dynamic camera
transform as well as dynamic viewport size and position.
2025-03-10 21:19:26 +00:00
..
2d_shapes.rs
2d_viewport_to_world.rs Respect viewport position in coordinate conversion functions (#17633) 2025-03-10 21:19:26 +00:00
bloom_2d.rs Add tonemapping switch to bloom 2d example (#17789) 2025-02-11 22:21:04 +00:00
cpu_draw.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
custom_gltf_vertex_attribute.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
mesh2d_alpha_mode.rs Add uv_transform to ColorMaterial (#17879) 2025-02-24 21:17:26 +00:00
mesh2d_arcs.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
mesh2d_manual.rs Replace internal uses of insert_or_spawn_batch (#18035) 2025-03-06 16:16:36 +00:00
mesh2d_repeated_texture.rs Add uv_transform to ColorMaterial (#17879) 2025-02-24 21:17:26 +00:00
mesh2d_vertex_color_texture.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
mesh2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
move_sprite.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
pixel_grid_snap.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
rotation.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_animation.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_flipping.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_scale.rs Proportional scaling for the sprite's texture. (#17258) 2025-01-24 18:24:02 +00:00
sprite_sheet.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_slice.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_tile.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
text2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
texture_atlas.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
transparency_2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
wireframe_2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00