Move FloatOrd into bevy_math (#12732)

# Objective

- Fixes #12712

## Solution

- Move the `float_ord.rs` file to `bevy_math`
- Change any `bevy_utils::FloatOrd` statements to `bevy_math::FloatOrd`

---

## Changelog

- Moved `FloatOrd` from `bevy_utils` to `bevy_math`

## Migration Guide

- References to `bevy_utils::FloatOrd` should be changed to
`bevy_math::FloatOrd`
This commit is contained in:
Jacques Schutte 2024-03-27 20:30:11 +02:00 committed by GitHub
parent 56bcbb0975
commit 4508077297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,6 @@ use bevy_ecs::world::World;
use bevy_math::*; use bevy_math::*;
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
use bevy_transform::prelude::Transform; use bevy_transform::prelude::Transform;
use bevy_utils::FloatOrd;
/// An individual input for [`Animatable::blend`]. /// An individual input for [`Animatable::blend`].
pub struct BlendInput<T> { pub struct BlendInput<T> {

View File

@ -31,6 +31,7 @@ pub use main_pass_2d_node::*;
use bevy_app::{App, Plugin}; use bevy_app::{App, Plugin};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_math::FloatOrd;
use bevy_render::{ use bevy_render::{
camera::Camera, camera::Camera,
extract_component::ExtractComponentPlugin, extract_component::ExtractComponentPlugin,
@ -42,7 +43,6 @@ use bevy_render::{
render_resource::CachedRenderPipelineId, render_resource::CachedRenderPipelineId,
Extract, ExtractSchedule, Render, RenderApp, RenderSet, Extract, ExtractSchedule, Render, RenderApp, RenderSet,
}; };
use bevy_utils::FloatOrd;
use nonmax::NonMaxU32; use nonmax::NonMaxU32;
use crate::{tonemapping::TonemappingNode, upscaling::UpscalingNode}; use crate::{tonemapping::TonemappingNode, upscaling::UpscalingNode};

View File

@ -48,6 +48,7 @@ pub use main_transparent_pass_3d_node::*;
use bevy_app::{App, Plugin, PostUpdate}; use bevy_app::{App, Plugin, PostUpdate};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_math::FloatOrd;
use bevy_render::{ use bevy_render::{
camera::{Camera, ExtractedCamera}, camera::{Camera, ExtractedCamera},
extract_component::ExtractComponentPlugin, extract_component::ExtractComponentPlugin,
@ -67,7 +68,7 @@ use bevy_render::{
view::{ExtractedView, ViewDepthTexture, ViewTarget}, view::{ExtractedView, ViewDepthTexture, ViewTarget},
Extract, ExtractSchedule, Render, RenderApp, RenderSet, Extract, ExtractSchedule, Render, RenderApp, RenderSet,
}; };
use bevy_utils::{tracing::warn, FloatOrd, HashMap}; use bevy_utils::{tracing::warn, HashMap};
use nonmax::NonMaxU32; use nonmax::NonMaxU32;
use crate::{ use crate::{

View File

@ -14,6 +14,7 @@ use bevy_ecs::{
system::{Query, Res, ResMut, Resource}, system::{Query, Res, ResMut, Resource},
world::{FromWorld, World}, world::{FromWorld, World},
}; };
use bevy_math::FloatOrd;
use bevy_render::{ use bevy_render::{
render_asset::{prepare_assets, RenderAssets}, render_asset::{prepare_assets, RenderAssets},
render_phase::{AddRenderCommand, DrawFunctions, RenderPhase, SetItemPipeline}, render_phase::{AddRenderCommand, DrawFunctions, RenderPhase, SetItemPipeline},
@ -24,7 +25,6 @@ use bevy_render::{
}; };
use bevy_sprite::{Mesh2dPipeline, Mesh2dPipelineKey, SetMesh2dViewBindGroup}; use bevy_sprite::{Mesh2dPipeline, Mesh2dPipelineKey, SetMesh2dViewBindGroup};
use bevy_utils::tracing::error; use bevy_utils::tracing::error;
use bevy_utils::FloatOrd;
pub struct LineGizmo2dPlugin; pub struct LineGizmo2dPlugin;

View File

@ -16,6 +16,7 @@ mod aspect_ratio;
pub mod bounding; pub mod bounding;
pub mod cubic_splines; pub mod cubic_splines;
mod direction; mod direction;
mod float_ord;
pub mod primitives; pub mod primitives;
mod ray; mod ray;
mod rects; mod rects;
@ -26,6 +27,7 @@ mod shape_sampling;
pub use affine3::*; pub use affine3::*;
pub use aspect_ratio::AspectRatio; pub use aspect_ratio::AspectRatio;
pub use direction::*; pub use direction::*;
pub use float_ord::*;
pub use ray::{Ray2d, Ray3d}; pub use ray::{Ray2d, Ray3d};
pub use rects::*; pub use rects::*;
pub use rotation2d::Rotation2d; pub use rotation2d::Rotation2d;

View File

@ -12,7 +12,7 @@ use bevy_ecs::{
schedule::IntoSystemConfigs, schedule::IntoSystemConfigs,
system::{Commands, Local, Query, Res, ResMut, Resource}, system::{Commands, Local, Query, Res, ResMut, Resource},
}; };
use bevy_math::{Affine3A, Mat4, Vec3A, Vec4}; use bevy_math::{Affine3A, FloatOrd, Mat4, Vec3A, Vec4};
use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{ use bevy_render::{
extract_instances::ExtractInstancesPlugin, extract_instances::ExtractInstancesPlugin,
@ -26,7 +26,7 @@ use bevy_render::{
Extract, ExtractSchedule, Render, RenderApp, RenderSet, Extract, ExtractSchedule, Render, RenderApp, RenderSet,
}; };
use bevy_transform::prelude::GlobalTransform; use bevy_transform::prelude::GlobalTransform;
use bevy_utils::{tracing::error, FloatOrd, HashMap}; use bevy_utils::{tracing::error, HashMap};
use std::hash::Hash; use std::hash::Hash;
use std::ops::Deref; use std::ops::Deref;

View File

@ -10,6 +10,7 @@ use bevy_ecs::{
prelude::*, prelude::*,
system::{lifetimeless::SRes, SystemParamItem}, system::{lifetimeless::SRes, SystemParamItem},
}; };
use bevy_math::FloatOrd;
use bevy_render::{ use bevy_render::{
mesh::{Mesh, MeshVertexBufferLayoutRef}, mesh::{Mesh, MeshVertexBufferLayoutRef},
prelude::Image, prelude::Image,
@ -30,7 +31,7 @@ use bevy_render::{
}; };
use bevy_transform::components::{GlobalTransform, Transform}; use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::tracing::error; use bevy_utils::tracing::error;
use bevy_utils::{FloatOrd, HashMap, HashSet}; use bevy_utils::{HashMap, HashSet};
use std::hash::Hash; use std::hash::Hash;
use std::marker::PhantomData; use std::marker::PhantomData;

View File

@ -15,7 +15,7 @@ use bevy_ecs::{
prelude::*, prelude::*,
system::{lifetimeless::*, SystemParamItem, SystemState}, system::{lifetimeless::*, SystemParamItem, SystemState},
}; };
use bevy_math::{Affine3A, Quat, Rect, Vec2, Vec4}; use bevy_math::{Affine3A, FloatOrd, Quat, Rect, Vec2, Vec4};
use bevy_render::{ use bevy_render::{
render_asset::RenderAssets, render_asset::RenderAssets,
render_phase::{ render_phase::{
@ -37,7 +37,7 @@ use bevy_render::{
Extract, Extract,
}; };
use bevy_transform::components::GlobalTransform; use bevy_transform::components::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap}; use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;

View File

@ -3,11 +3,10 @@ use ab_glyph::{GlyphId, OutlinedGlyph, Point};
use bevy_asset::{AssetEvent, AssetId}; use bevy_asset::{AssetEvent, AssetId};
use bevy_asset::{Assets, Handle}; use bevy_asset::{Assets, Handle};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_math::UVec2; use bevy_math::{FloatOrd, UVec2};
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
use bevy_render::texture::Image; use bevy_render::texture::Image;
use bevy_sprite::TextureAtlasLayout; use bevy_sprite::TextureAtlasLayout;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap; use bevy_utils::HashMap;
type FontSizeKey = FloatOrd; type FontSizeKey = FloatOrd;

View File

@ -24,7 +24,7 @@ use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle}; use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle};
use bevy_ecs::entity::EntityHashMap; use bevy_ecs::entity::EntityHashMap;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_math::{Mat4, Rect, URect, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles}; use bevy_math::{FloatOrd, Mat4, Rect, URect, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
use bevy_render::{ use bevy_render::{
camera::Camera, camera::Camera,
render_asset::RenderAssets, render_asset::RenderAssets,
@ -40,7 +40,7 @@ use bevy_sprite::TextureAtlasLayout;
#[cfg(feature = "bevy_text")] #[cfg(feature = "bevy_text")]
use bevy_text::{PositionedGlyph, Text, TextLayoutInfo}; use bevy_text::{PositionedGlyph, Text, TextLayoutInfo};
use bevy_transform::components::GlobalTransform; use bevy_transform::components::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap}; use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use std::ops::Range; use std::ops::Range;

View File

@ -6,6 +6,7 @@ use bevy_ecs::{
prelude::*, prelude::*,
system::{lifetimeless::*, SystemParamItem}, system::{lifetimeless::*, SystemParamItem},
}; };
use bevy_math::FloatOrd;
use bevy_render::{ use bevy_render::{
camera::ExtractedCamera, camera::ExtractedCamera,
render_graph::*, render_graph::*,
@ -14,7 +15,6 @@ use bevy_render::{
renderer::*, renderer::*,
view::*, view::*,
}; };
use bevy_utils::FloatOrd;
use nonmax::NonMaxU32; use nonmax::NonMaxU32;
pub struct UiPassNode { pub struct UiPassNode {

View File

@ -9,7 +9,7 @@ use bevy_ecs::{
system::lifetimeless::{Read, SRes}, system::lifetimeless::{Read, SRes},
system::*, system::*,
}; };
use bevy_math::{Mat4, Rect, Vec2, Vec4Swizzles}; use bevy_math::{FloatOrd, Mat4, Rect, Vec2, Vec4Swizzles};
use bevy_render::{ use bevy_render::{
extract_component::ExtractComponentPlugin, extract_component::ExtractComponentPlugin,
globals::{GlobalsBuffer, GlobalsUniform}, globals::{GlobalsBuffer, GlobalsUniform},
@ -22,7 +22,7 @@ use bevy_render::{
Extract, ExtractSchedule, Render, RenderSet, Extract, ExtractSchedule, Render, RenderSet,
}; };
use bevy_transform::prelude::GlobalTransform; use bevy_transform::prelude::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap, HashSet}; use bevy_utils::{HashMap, HashSet};
use bevy_window::{PrimaryWindow, Window}; use bevy_window::{PrimaryWindow, Window};
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};

View File

@ -24,7 +24,6 @@ pub mod syncunsafecell;
mod cow_arc; mod cow_arc;
mod default; mod default;
mod float_ord;
pub mod intern; pub mod intern;
mod once; mod once;
mod parallel_queue; mod parallel_queue;
@ -33,7 +32,6 @@ pub use ahash::{AHasher, RandomState};
pub use bevy_utils_proc_macros::*; pub use bevy_utils_proc_macros::*;
pub use cow_arc::*; pub use cow_arc::*;
pub use default::default; pub use default::default;
pub use float_ord::*;
pub use hashbrown; pub use hashbrown;
pub use parallel_queue::*; pub use parallel_queue::*;
pub use tracing; pub use tracing;

View File

@ -8,6 +8,7 @@
use bevy::{ use bevy::{
color::palettes::basic::YELLOW, color::palettes::basic::YELLOW,
core_pipeline::core_2d::Transparent2d, core_pipeline::core_2d::Transparent2d,
math::FloatOrd,
prelude::*, prelude::*,
render::{ render::{
mesh::{Indices, MeshVertexAttribute}, mesh::{Indices, MeshVertexAttribute},
@ -28,7 +29,6 @@ use bevy::{
Mesh2dPipelineKey, Mesh2dTransforms, MeshFlags, RenderMesh2dInstance, Mesh2dPipelineKey, Mesh2dTransforms, MeshFlags, RenderMesh2dInstance,
RenderMesh2dInstances, SetMesh2dBindGroup, SetMesh2dViewBindGroup, RenderMesh2dInstances, SetMesh2dBindGroup, SetMesh2dViewBindGroup,
}, },
utils::FloatOrd,
}; };
use std::f32::consts::PI; use std::f32::consts::PI;