bevy/examples/3d
ira 585baf0a66
Consistent screen-space coordinates (#8306)
# Objective

Make the coordinate systems of screen-space items (cursor position, UI,
viewports, etc.) consistent.

## Solution

Remove the weird double inversion of the cursor position's Y origin.
Once in bevy_winit to the bottom and then again in bevy_ui back to the
top.
This leaves the origin at the top left like it is in every other popular
app framework.

Update the `world_to_viewport`, `viewport_to_world`, and
`viewport_to_world_2d` methods to flip the Y origin (as they should
since the viewport coordinates were always relative to the top left).

## Migration Guide

`Window::cursor_position` now returns the position of the cursor
relative to the top left instead of the bottom left.
This now matches other screen-space coordinates like
`RelativeCursorPosition`, UI, and viewports.

The `world_to_viewport`, `viewport_to_world`, and `viewport_to_world_2d`
methods on `Camera` now return/take the viewport position relative to
the top left instead of the bottom left.

If you were using `world_to_viewport` to position a UI node the returned
`y` value should now be passed into the `top` field on `Style` instead
of the `bottom` field.
Note that this might shift the position of the UI node as it is now
anchored at the top.

If you were passing `Window::cursor_position` to `viewport_to_world` or
`viewport_to_world_2d` no change is necessary.
2023-04-05 22:32:36 +00:00
..
3d_gizmos.rs Immediate Mode Line/Gizmo Drawing (#6529) 2023-03-20 20:57:54 +00:00
3d_scene.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
3d_shapes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
anti_aliasing.rs Add port of AMD's Robust Contrast Adaptive Sharpening (#7422) 2023-04-02 20:14:01 +00:00
atmospheric_fog.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
blend_modes.rs Consistent screen-space coordinates (#8306) 2023-04-05 22:32:36 +00:00
bloom_3d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
fog.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
lighting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
lines.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
load_gltf.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
orthographic.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
parenting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pbr.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
render_to_texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
shadow_biases.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
shadow_caster_receiver.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
skybox.rs Built-in skybox (#8275) 2023-04-02 10:57:12 +00:00
spherical_area_lights.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
split_screen.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
spotlight.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
tonemapping.rs Changed spelling linebreak_behaviour to linebreak_behavior (#8285) 2023-04-05 21:25:53 +00:00
transparency_3d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
two_passes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
update_gltf_scene.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
vertex_colors.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
wireframe.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00