Skip to content

Commit

Permalink
Move float_ord from bevy_core to bevy_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
CAD97 committed Mar 12, 2022
1 parent 5af7464 commit e08d166
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 19 deletions.
2 changes: 0 additions & 2 deletions crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#![warn(missing_docs)]
//! This crate provides core functionality for Bevy Engine.
mod float_ord;
mod name;
mod task_pool_options;
mod time;

pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable};
pub use float_ord::*;
pub use name::*;
pub use task_pool_options::*;
pub use time::*;
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_core_pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ keywords = ["bevy"]
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
bevy_core = { path = "../bevy_core", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
bevy_render = { path = "../bevy_render", version = "0.6.0" }
bevy_utils = { path = "../bevy_utils", version = "0.6.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub use main_pass_driver::*;
use std::ops::Range;

use bevy_app::{App, Plugin};
use bevy_core::FloatOrd;
use bevy_ecs::prelude::*;
use bevy_render::{
camera::{ActiveCameras, CameraPlugin, RenderTarget},
Expand All @@ -36,6 +35,7 @@ use bevy_render::{
view::{ExtractedView, Msaa, ViewDepthTexture},
RenderApp, RenderStage, RenderWorld,
};
use bevy_utils::FloatOrd;

/// When used as a resource, sets the color that is used to clear the screen between frames.
///
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ webgl = []
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
bevy_core = { path = "../bevy_core", version = "0.6.0" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
bevy_math = { path = "../bevy_math", version = "0.6.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
PointLightShadowMap, SetMeshBindGroup, VisiblePointLights, SHADOW_SHADER_HANDLE,
};
use bevy_asset::Handle;
use bevy_core::FloatOrd;
use bevy_core_pipeline::Transparent3d;
use bevy_ecs::{
prelude::*,
Expand All @@ -30,6 +29,7 @@ use bevy_render::{
},
};
use bevy_transform::components::GlobalTransform;
use bevy_utils::FloatOrd;
use bevy_utils::{
tracing::{error, warn},
HashMap,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_sprite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ keywords = ["bevy"]
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
bevy_core = { path = "../bevy_core", version = "0.6.0" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
bevy_log = { path = "../bevy_log", version = "0.6.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_sprite/src/mesh2d/material.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bevy_app::{App, Plugin};
use bevy_asset::{AddAsset, Asset, AssetServer, Handle};
use bevy_core::FloatOrd;
use bevy_core_pipeline::Transparent2d;
use bevy_ecs::{
entity::Entity,
Expand Down Expand Up @@ -29,6 +28,7 @@ use bevy_render::{
RenderApp, RenderStage,
};
use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::FloatOrd;
use std::hash::Hash;
use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::{
Rect, Sprite, SPRITE_SHADER_HANDLE,
};
use bevy_asset::{AssetEvent, Assets, Handle, HandleId};
use bevy_core::FloatOrd;
use bevy_core_pipeline::Transparent2d;
use bevy_ecs::{
prelude::*,
Expand All @@ -27,6 +26,7 @@ use bevy_render::{
RenderWorld,
};
use bevy_transform::components::GlobalTransform;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable};
use copyless::VecHelper;
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_text/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ subpixel_glyph_atlas = []
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
bevy_core = { path = "../bevy_core", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
bevy_math = { path = "../bevy_math", version = "0.6.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.6.0", features = ["bevy"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_text/src/font_atlas_set.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{error::TextError, Font, FontAtlas};
use ab_glyph::{GlyphId, OutlinedGlyph, Point};
use bevy_asset::{Assets, Handle};
use bevy_core::FloatOrd;
use bevy_math::Vec2;
use bevy_reflect::TypeUuid;
use bevy_render::texture::Image;
use bevy_sprite::TextureAtlas;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap;

type FontSizeKey = FloatOrd;
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ keywords = ["bevy"]
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
bevy_core = { path = "../bevy_core", version = "0.6.0" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.6.0" }
bevy_derive = { path = "../bevy_derive", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/focus.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{CalculatedClip, Node};
use bevy_core::FloatOrd;
use bevy_utils::FloatOrd;
use bevy_ecs::{
entity::Entity,
prelude::Component,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::ops::Range;

use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, AssetEvent, Assets, Handle, HandleUntyped};
use bevy_core::FloatOrd;
use bevy_ecs::prelude::*;
use bevy_math::{const_vec3, Mat4, Vec2, Vec3, Vec4Swizzles};
use bevy_reflect::TypeUuid;
Expand All @@ -29,6 +28,7 @@ use bevy_render::{
use bevy_sprite::{Rect, SpriteAssetEvents, TextureAtlas};
use bevy_text::{DefaultTextPipeline, Text};
use bevy_transform::components::GlobalTransform;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap;
use bevy_window::{WindowId, Windows};

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
@@ -1,4 +1,4 @@
use bevy_core::FloatOrd;
use bevy_utils::FloatOrd;
use bevy_ecs::{
prelude::*,
system::{lifetimeless::*, SystemParamItem},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ impl Hash for FloatOrd {
fn hash<H: Hasher>(&self, state: &mut H) {
if self.0.is_nan() {
// Ensure all NaN representations hash to the same value
state.write(bytemuck::bytes_of(&f32::NAN));
state.write(&f32::to_ne_bytes(f32::NAN));
} else if self.0 == 0.0 {
// Ensure both zeroes hash to the same value
state.write(bytemuck::bytes_of(&0.0f32));
state.write(&f32::to_ne_bytes(0.0f32));
} else {
state.write(bytemuck::bytes_of(&self.0));
state.write(&f32::to_ne_bytes(self.0));
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ pub mod label;

mod default;
mod enum_variant_meta;
mod float_ord;

pub use ahash::AHasher;
pub use default::default;
pub use enum_variant_meta::*;
pub use float_ord::*;
pub use hashbrown;
pub use instant::{Duration, Instant};
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
@@ -1,5 +1,4 @@
use bevy::{
core::FloatOrd,
core_pipeline::Transparent2d,
prelude::*,
reflect::TypeUuid,
Expand All @@ -21,6 +20,7 @@ use bevy::{
DrawMesh2d, Mesh2dHandle, Mesh2dPipeline, Mesh2dPipelineKey, Mesh2dUniform,
SetMesh2dBindGroup, SetMesh2dViewBindGroup,
},
utils::FloatOrd,
};

/// This example shows how to manually render 2d items using "mid level render apis" with a custom pipeline for 2d meshes
Expand Down

0 comments on commit e08d166

Please sign in to comment.