Move float_ord from bevy_core to bevy_utils (#4189)
# Objective Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils. A step in addressing #2931 and splitting bevy_core into more specific locations. ## Solution Move FloatOrd into bevy_utils. Fix the compile errors. As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
This commit is contained in:
parent
8e03634457
commit
3d4e0066f4
@ -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::*;
|
||||
|
@ -19,7 +19,6 @@ trace = []
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
||||
bevy_render = { path = "../bevy_render", version = "0.8.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.8.0-dev" }
|
||||
|
@ -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::{ActiveCamera, Camera2d, Camera3d, ExtractedCamera, RenderTarget},
|
||||
@ -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.
|
||||
///
|
||||
|
@ -15,7 +15,6 @@ webgl = []
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
|
||||
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.8.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
||||
bevy_math = { path = "../bevy_math", version = "0.8.0-dev" }
|
||||
|
@ -4,7 +4,6 @@ use crate::{
|
||||
PointLight, PointLightShadowMap, SetMeshBindGroup, VisiblePointLights, SHADOW_SHADER_HANDLE,
|
||||
};
|
||||
use bevy_asset::Handle;
|
||||
use bevy_core::FloatOrd;
|
||||
use bevy_core_pipeline::Transparent3d;
|
||||
use bevy_ecs::{
|
||||
prelude::*,
|
||||
@ -30,6 +29,7 @@ use bevy_render::{
|
||||
},
|
||||
};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use bevy_utils::FloatOrd;
|
||||
use bevy_utils::{
|
||||
tracing::{error, warn},
|
||||
HashMap,
|
||||
|
@ -12,7 +12,6 @@ keywords = ["bevy"]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
|
||||
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.8.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
||||
bevy_log = { path = "../bevy_log", version = "0.8.0-dev" }
|
||||
|
@ -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,
|
||||
@ -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;
|
||||
|
||||
|
@ -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::*,
|
||||
@ -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;
|
||||
|
@ -15,7 +15,6 @@ subpixel_glyph_atlas = []
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
||||
bevy_math = { path = "../bevy_math", version = "0.8.0-dev" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.8.0-dev", features = ["bevy"] }
|
||||
|
@ -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;
|
||||
|
@ -12,7 +12,6 @@ keywords = ["bevy"]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
|
||||
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.8.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
||||
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.8.0-dev" }
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::{CalculatedClip, Node};
|
||||
use bevy_core::FloatOrd;
|
||||
use bevy_ecs::{
|
||||
entity::Entity,
|
||||
prelude::Component,
|
||||
@ -10,6 +9,7 @@ use bevy_input::{mouse::MouseButton, touch::Touches, Input};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use bevy_utils::FloatOrd;
|
||||
use bevy_window::Windows;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -9,7 +9,6 @@ pub use render_pass::*;
|
||||
use crate::{CalculatedClip, Node, UiColor, UiImage};
|
||||
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;
|
||||
@ -27,6 +26,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};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use bevy_core::FloatOrd;
|
||||
use bevy_ecs::{
|
||||
prelude::*,
|
||||
system::{lifetimeless::*, SystemParamItem},
|
||||
@ -13,6 +12,7 @@ use bevy_render::{
|
||||
renderer::*,
|
||||
view::*,
|
||||
};
|
||||
use bevy_utils::FloatOrd;
|
||||
|
||||
use crate::prelude::CameraUi;
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@ -7,10 +7,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;
|
||||
|
@ -1,5 +1,4 @@
|
||||
use bevy::{
|
||||
core::FloatOrd,
|
||||
core_pipeline::Transparent2d,
|
||||
prelude::*,
|
||||
reflect::TypeUuid,
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user