mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 22:18:33 +00:00
# Objective This PR arose as part of the migration process for `bevy_color`: see #12056. While examining how `bevy_gizmos` stores color types internally, I found that rather than storing a `Color` internally, it actually stores a `[f32;4]` for a linear RGB, type aliased to a `ColorItem`. While we don't *have* to clean this up to complete the migration, now that we have explicit strong typing for linear color types we should use them rather than replicating this idea throughout the codebase. ## Solution - Added `LinearRgba::NAN`, for when you want to do cursed rendering things. - Replaced the internal color representation in `bevy_gizmo`: this was `ColorItem`, but is now `LinearRgba`. - `LinearRgba` is now `Pod`, enabling us to use the same fast `bytemuck` bit twiddling tricks that we were using before. This requires: 1. Forcing `LinearRgba` to be `repr(C)` 2. Implementing `Zeroable`, and unsafe trait which defines what the struct looks like when all values are zero. 3. Implementing `Pod`, a marker trait with stringent safety requirements that is required for "plain old data". --------- Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
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_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_macros_compile_fail_tests | ||
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 |