mirror of
https://github.com/bevyengine/bevy
synced 2024-12-22 19:13:08 +00:00
09cb590c57
# Objective - Terminology used in field names and docs aren't accurate - `window_origin` doesn't have any effect when `scaling_mode` is `ScalingMode::None` - `left`, `right`, `bottom`, and `top` are set automatically unless `scaling_mode` is `None`. Fields that only sometimes give feedback are confusing. - `ScalingMode::WindowSize` has no arguments, which is inconsistent with other `ScalingMode`s. 1 pixel = 1 world unit is also typically way too wide. - `OrthographicProjection` feels generally less streamlined than its `PerspectiveProjection` counterpart - Fixes #5818 - Fixes #6190 ## Solution - Improve consistency in `OrthographicProjection`'s public fields (they should either always give feedback or never give feedback). - Improve consistency in `ScalingMode`'s arguments - General usability improvements - Improve accuracy of terminology: - "Window" should refer to the physical window on the desktop - "Viewport" should refer to the component in the window that images are drawn on (typically all of it) - "View frustum" should refer to the volume captured by the projection --- ## Changelog ### Added - Added argument to `ScalingMode::WindowSize` that specifies the number of pixels that equals one world unit. - Added documentation for fields and enums ### Changed - Renamed `window_origin` to `viewport_origin`, which now: - Affects all `ScalingMode`s - Takes a fraction of the viewport's width and height instead of an enum - Removed `WindowOrigin` enum as it's obsolete - Renamed `ScalingMode::None` to `ScalingMode::Fixed`, which now: - Takes arguments to specify the projection size - Replaced `left`, `right`, `bottom`, and `top` fields with a single `area: Rect` - `scale` is now applied before updating `area`. Reading from it will take `scale` into account. - Documentation changes to make terminology more accurate and consistent ## Migration Guide - Change `window_origin` to `viewport_origin`; replace `WindowOrigin::Center` with `Vec2::new(0.5, 0.5)` and `WindowOrigin::BottomLeft` with `Vec2::new(0.0, 0.0)` - For shadow projections and such, replace `left`, `right`, `bottom`, and `top` with `area: Rect::new(left, bottom, right, top)` - For camera projections, remove l/r/b/t values from `OrthographicProjection` instantiations, as they no longer have any effect in any `ScalingMode` - Change `ScalingMode::None` to `ScalingMode::Fixed` - Replace manual changes of l/r/b/t with: - Arguments in `ScalingMode::Fixed` to specify size - `viewport_origin` to specify offset - Change `ScalingMode::WindowSize` to `ScalingMode::WindowSize(1.0)` |
||
---|---|---|
.. | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |