Skip to content

Commit

Permalink
Move FloatOrd into bevy_math (#12732)
Browse files Browse the repository at this point in the history
# 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`
  • Loading branch information
OneFourth committed Mar 27, 2024
1 parent 56bcbb0 commit 4508077
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 19 deletions.
1 change: 0 additions & 1 deletion crates/bevy_animation/src/animatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bevy_ecs::world::World;
use bevy_math::*;
use bevy_reflect::Reflect;
use bevy_transform::prelude::Transform;
use bevy_utils::FloatOrd;

/// An individual input for [`Animatable::blend`].
pub struct BlendInput<T> {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_2d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub use main_pass_2d_node::*;

use bevy_app::{App, Plugin};
use bevy_ecs::prelude::*;
use bevy_math::FloatOrd;
use bevy_render::{
camera::Camera,
extract_component::ExtractComponentPlugin,
Expand All @@ -42,7 +43,6 @@ use bevy_render::{
render_resource::CachedRenderPipelineId,
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
};
use bevy_utils::FloatOrd;
use nonmax::NonMaxU32;

use crate::{tonemapping::TonemappingNode, upscaling::UpscalingNode};
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_core_pipeline/src/core_3d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub use main_transparent_pass_3d_node::*;

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

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gizmos/src/pipeline_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use bevy_ecs::{
system::{Query, Res, ResMut, Resource},
world::{FromWorld, World},
};
use bevy_math::FloatOrd;
use bevy_render::{
render_asset::{prepare_assets, RenderAssets},
render_phase::{AddRenderCommand, DrawFunctions, RenderPhase, SetItemPipeline},
Expand All @@ -24,7 +25,6 @@ use bevy_render::{
};
use bevy_sprite::{Mesh2dPipeline, Mesh2dPipelineKey, SetMesh2dViewBindGroup};
use bevy_utils::tracing::error;
use bevy_utils::FloatOrd;

pub struct LineGizmo2dPlugin;

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions crates/bevy_math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod aspect_ratio;
pub mod bounding;
pub mod cubic_splines;
mod direction;
mod float_ord;
pub mod primitives;
mod ray;
mod rects;
Expand All @@ -26,6 +27,7 @@ mod shape_sampling;
pub use affine3::*;
pub use aspect_ratio::AspectRatio;
pub use direction::*;
pub use float_ord::*;
pub use ray::{Ray2d, Ray3d};
pub use rects::*;
pub use rotation2d::Rotation2d;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/light_probe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use bevy_ecs::{
schedule::IntoSystemConfigs,
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_render::{
extract_instances::ExtractInstancesPlugin,
Expand All @@ -26,7 +26,7 @@ use bevy_render::{
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
};
use bevy_transform::prelude::GlobalTransform;
use bevy_utils::{tracing::error, FloatOrd, HashMap};
use bevy_utils::{tracing::error, HashMap};

use std::hash::Hash;
use std::ops::Deref;
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_sprite/src/mesh2d/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use bevy_ecs::{
prelude::*,
system::{lifetimeless::SRes, SystemParamItem},
};
use bevy_math::FloatOrd;
use bevy_render::{
mesh::{Mesh, MeshVertexBufferLayoutRef},
prelude::Image,
Expand All @@ -30,7 +31,7 @@ use bevy_render::{
};
use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::tracing::error;
use bevy_utils::{FloatOrd, HashMap, HashSet};
use bevy_utils::{HashMap, HashSet};
use std::hash::Hash;
use std::marker::PhantomData;

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy_ecs::{
prelude::*,
system::{lifetimeless::*, SystemParamItem, SystemState},
};
use bevy_math::{Affine3A, Quat, Rect, Vec2, Vec4};
use bevy_math::{Affine3A, FloatOrd, Quat, Rect, Vec2, Vec4};
use bevy_render::{
render_asset::RenderAssets,
render_phase::{
Expand All @@ -37,7 +37,7 @@ use bevy_render::{
Extract,
};
use bevy_transform::components::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap};
use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable};
use fixedbitset::FixedBitSet;

Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_text/src/font_atlas_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ use ab_glyph::{GlyphId, OutlinedGlyph, Point};
use bevy_asset::{AssetEvent, AssetId};
use bevy_asset::{Assets, Handle};
use bevy_ecs::prelude::*;
use bevy_math::UVec2;
use bevy_math::{FloatOrd, UVec2};
use bevy_reflect::Reflect;
use bevy_render::texture::Image;
use bevy_sprite::TextureAtlasLayout;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap;

type FontSizeKey = FloatOrd;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle};
use bevy_ecs::entity::EntityHashMap;
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::{
camera::Camera,
render_asset::RenderAssets,
Expand All @@ -40,7 +40,7 @@ use bevy_sprite::TextureAtlasLayout;
#[cfg(feature = "bevy_text")]
use bevy_text::{PositionedGlyph, Text, TextLayoutInfo};
use bevy_transform::components::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap};
use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable};
use std::ops::Range;

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/render_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use bevy_ecs::{
prelude::*,
system::{lifetimeless::*, SystemParamItem},
};
use bevy_math::FloatOrd;
use bevy_render::{
camera::ExtractedCamera,
render_graph::*,
Expand All @@ -14,7 +15,6 @@ use bevy_render::{
renderer::*,
view::*,
};
use bevy_utils::FloatOrd;
use nonmax::NonMaxU32;

pub struct UiPassNode {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/ui_material_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy_ecs::{
system::lifetimeless::{Read, SRes},
system::*,
};
use bevy_math::{Mat4, Rect, Vec2, Vec4Swizzles};
use bevy_math::{FloatOrd, Mat4, Rect, Vec2, Vec4Swizzles};
use bevy_render::{
extract_component::ExtractComponentPlugin,
globals::{GlobalsBuffer, GlobalsUniform},
Expand All @@ -22,7 +22,7 @@ use bevy_render::{
Extract, ExtractSchedule, Render, RenderSet,
};
use bevy_transform::prelude::GlobalTransform;
use bevy_utils::{FloatOrd, HashMap, HashSet};
use bevy_utils::{HashMap, HashSet};
use bevy_window::{PrimaryWindow, Window};
use bytemuck::{Pod, Zeroable};

Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub mod syncunsafecell;

mod cow_arc;
mod default;
mod float_ord;
pub mod intern;
mod once;
mod parallel_queue;
Expand All @@ -33,7 +32,6 @@ pub use ahash::{AHasher, RandomState};
pub use bevy_utils_proc_macros::*;
pub use cow_arc::*;
pub use default::default;
pub use float_ord::*;
pub use hashbrown;
pub use parallel_queue::*;
pub use tracing;
Expand Down
2 changes: 1 addition & 1 deletion examples/2d/mesh2d_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use bevy::{
color::palettes::basic::YELLOW,
core_pipeline::core_2d::Transparent2d,
math::FloatOrd,
prelude::*,
render::{
mesh::{Indices, MeshVertexAttribute},
Expand All @@ -28,7 +29,6 @@ use bevy::{
Mesh2dPipelineKey, Mesh2dTransforms, MeshFlags, RenderMesh2dInstance,
RenderMesh2dInstances, SetMesh2dBindGroup, SetMesh2dViewBindGroup,
},
utils::FloatOrd,
};
use std::f32::consts::PI;

Expand Down

0 comments on commit 4508077

Please sign in to comment.