mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
Merge branch 'main' into transmission
This commit is contained in:
commit
521426047f
25 changed files with 70 additions and 49 deletions
|
@ -404,7 +404,7 @@ path = "examples/2d/texture_atlas.rs"
|
||||||
name = "Texture Atlas"
|
name = "Texture Atlas"
|
||||||
description = "Generates a texture atlas (sprite sheet) from individual sprites"
|
description = "Generates a texture atlas (sprite sheet) from individual sprites"
|
||||||
category = "2D Rendering"
|
category = "2D Rendering"
|
||||||
wasm = true
|
wasm = false
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "transparency_2d"
|
name = "transparency_2d"
|
||||||
|
@ -916,7 +916,7 @@ path = "examples/asset/asset_loading.rs"
|
||||||
name = "Asset Loading"
|
name = "Asset Loading"
|
||||||
description = "Demonstrates various methods to load assets"
|
description = "Demonstrates various methods to load assets"
|
||||||
category = "Assets"
|
category = "Assets"
|
||||||
wasm = true
|
wasm = false
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "custom_asset"
|
name = "custom_asset"
|
||||||
|
|
|
@ -11,7 +11,7 @@ fn fragment(
|
||||||
@builtin(position) position: vec4<f32>,
|
@builtin(position) position: vec4<f32>,
|
||||||
#import bevy_pbr::mesh_vertex_output
|
#import bevy_pbr::mesh_vertex_output
|
||||||
) -> @location(0) vec4<f32> {
|
) -> @location(0) vec4<f32> {
|
||||||
let uv = coords_to_viewport_uv(position.xy, view.viewport);
|
let viewport_uv = coords_to_viewport_uv(position.xy, view.viewport);
|
||||||
let color = textureSample(texture, texture_sampler, uv);
|
let color = textureSample(texture, texture_sampler, viewport_uv);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl PluginGroupBuilder {
|
||||||
/// opt back in to a [`Plugin`] after [disabling](Self::disable) it. If there are no plugins
|
/// opt back in to a [`Plugin`] after [disabling](Self::disable) it. If there are no plugins
|
||||||
/// of type `T` in this group, it will panic.
|
/// of type `T` in this group, it will panic.
|
||||||
pub fn enable<T: Plugin>(mut self) -> Self {
|
pub fn enable<T: Plugin>(mut self) -> Self {
|
||||||
let mut plugin_entry = self
|
let plugin_entry = self
|
||||||
.plugins
|
.plugins
|
||||||
.get_mut(&TypeId::of::<T>())
|
.get_mut(&TypeId::of::<T>())
|
||||||
.expect("Cannot enable a plugin that does not exist.");
|
.expect("Cannot enable a plugin that does not exist.");
|
||||||
|
@ -158,7 +158,7 @@ impl PluginGroupBuilder {
|
||||||
/// [`add_after`](Self::add_after), or it can be [re-enabled](Self::enable). If there are no
|
/// [`add_after`](Self::add_after), or it can be [re-enabled](Self::enable). If there are no
|
||||||
/// plugins of type `T` in this group, it will panic.
|
/// plugins of type `T` in this group, it will panic.
|
||||||
pub fn disable<T: Plugin>(mut self) -> Self {
|
pub fn disable<T: Plugin>(mut self) -> Self {
|
||||||
let mut plugin_entry = self
|
let plugin_entry = self
|
||||||
.plugins
|
.plugins
|
||||||
.get_mut(&TypeId::of::<T>())
|
.get_mut(&TypeId::of::<T>())
|
||||||
.expect("Cannot disable a plugin that does not exist.");
|
.expect("Cannot disable a plugin that does not exist.");
|
||||||
|
|
|
@ -133,12 +133,12 @@ impl<T: Asset> Assets<T> {
|
||||||
/// This is the main method for accessing asset data from an [Assets] collection. If you need
|
/// This is the main method for accessing asset data from an [Assets] collection. If you need
|
||||||
/// mutable access to the asset, use [`get_mut`](Assets::get_mut).
|
/// mutable access to the asset, use [`get_mut`](Assets::get_mut).
|
||||||
pub fn get(&self, handle: &Handle<T>) -> Option<&T> {
|
pub fn get(&self, handle: &Handle<T>) -> Option<&T> {
|
||||||
self.assets.get(&handle.into())
|
self.assets.get::<HandleId>(&handle.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if an asset exists for the given handle
|
/// Checks if an asset exists for the given handle
|
||||||
pub fn contains(&self, handle: &Handle<T>) -> bool {
|
pub fn contains(&self, handle: &Handle<T>) -> bool {
|
||||||
self.assets.contains_key(&handle.into())
|
self.assets.contains_key::<HandleId>(&handle.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get mutable access to the asset for the given handle.
|
/// Get mutable access to the asset for the given handle.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use bevy_reflect::{
|
use bevy_reflect::{
|
||||||
FromReflect, Reflect, ReflectDeserialize, ReflectFromReflect, ReflectSerialize,
|
FromReflect, Reflect, ReflectDeserialize, ReflectFromReflect, ReflectSerialize,
|
||||||
};
|
};
|
||||||
use bevy_utils::AHasher;
|
use bevy_utils::{AHasher, RandomState};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
hash::{Hash, Hasher},
|
hash::{BuildHasher, Hash, Hasher},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ impl AssetPathId {
|
||||||
|
|
||||||
/// this hasher provides consistent results across runs
|
/// this hasher provides consistent results across runs
|
||||||
pub(crate) fn get_hasher() -> AHasher {
|
pub(crate) fn get_hasher() -> AHasher {
|
||||||
AHasher::new_with_keys(42, 23)
|
RandomState::with_seeds(42, 23, 13, 8).build_hasher()
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> From<T> for AssetPathId
|
impl<'a, T> From<T> for AssetPathId
|
||||||
|
|
|
@ -24,7 +24,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.11.0-dev" }
|
||||||
# MacOS
|
# MacOS
|
||||||
[target.'cfg(all(target_os="macos"))'.dependencies]
|
[target.'cfg(all(target_os="macos"))'.dependencies]
|
||||||
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
|
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
|
||||||
sysinfo = { version = "0.28.1", default-features = false, features = [
|
sysinfo = { version = "0.29.0", default-features = false, features = [
|
||||||
"apple-app-store",
|
"apple-app-store",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,5 @@ keywords = ["bevy"]
|
||||||
bevy_app = { path = "../bevy_app", version = "0.11.0-dev" }
|
bevy_app = { path = "../bevy_app", version = "0.11.0-dev" }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
libloading = { version = "0.7" }
|
libloading = { version = "0.8" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
use crate as bevy_ecs;
|
||||||
use crate::change_detection::DetectChangesMut;
|
use crate::change_detection::DetectChangesMut;
|
||||||
|
@ -95,6 +96,14 @@ impl<S: States> PartialEq<S> for State<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S: States> Deref for State<S> {
|
||||||
|
type Target = S;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
self.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The next state of [`State<S>`].
|
/// The next state of [`State<S>`].
|
||||||
///
|
///
|
||||||
/// To queue a transition, just set the contained value to `Some(next_state)`.
|
/// To queue a transition, just set the contained value to `Some(next_state)`.
|
||||||
|
|
|
@ -1472,7 +1472,7 @@ impl World {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Increments the world's current change tick, and returns the old value.
|
/// Increments the world's current change tick and returns the old value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn increment_change_tick(&self) -> Tick {
|
pub fn increment_change_tick(&self) -> Tick {
|
||||||
let prev_tick = self.change_tick.fetch_add(1, Ordering::AcqRel);
|
let prev_tick = self.change_tick.fetch_add(1, Ordering::AcqRel);
|
||||||
|
|
|
@ -253,6 +253,7 @@ impl<'w> UnsafeWorldCell<'w> {
|
||||||
unsafe { self.world_metadata() }.last_change_tick()
|
unsafe { self.world_metadata() }.last_change_tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Increments the world's current change tick and returns the old value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn increment_change_tick(self) -> Tick {
|
pub fn increment_change_tick(self) -> Tick {
|
||||||
// SAFETY:
|
// SAFETY:
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub struct LogPlugin {
|
||||||
impl Default for LogPlugin {
|
impl Default for LogPlugin {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
filter: "wgpu=error".to_string(),
|
filter: "wgpu=error,naga=warn".to_string(),
|
||||||
level: Level::INFO,
|
level: Level::INFO,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ fn extract_windows(
|
||||||
window.resolution.physical_height().max(1),
|
window.resolution.physical_height().max(1),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut extracted_window = extracted_windows.entry(entity).or_insert(ExtractedWindow {
|
let extracted_window = extracted_windows.entry(entity).or_insert(ExtractedWindow {
|
||||||
entity,
|
entity,
|
||||||
handle: handle.clone(),
|
handle: handle.clone(),
|
||||||
physical_width: new_width,
|
physical_width: new_width,
|
||||||
|
|
|
@ -432,7 +432,7 @@ pub struct PreparedMaterial2d<T: Material2d> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
struct ExtractedMaterials2d<M: Material2d> {
|
pub struct ExtractedMaterials2d<M: Material2d> {
|
||||||
extracted: Vec<(Handle<M>, M)>,
|
extracted: Vec<(Handle<M>, M)>,
|
||||||
removed: Vec<Handle<M>>,
|
removed: Vec<Handle<M>>,
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ impl<T: Material2d> Default for RenderMaterials2d<T> {
|
||||||
|
|
||||||
/// This system extracts all created or modified assets of the corresponding [`Material2d`] type
|
/// This system extracts all created or modified assets of the corresponding [`Material2d`] type
|
||||||
/// into the "render world".
|
/// into the "render world".
|
||||||
fn extract_materials_2d<M: Material2d>(
|
pub fn extract_materials_2d<M: Material2d>(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut events: Extract<EventReader<AssetEvent<M>>>,
|
mut events: Extract<EventReader<AssetEvent<M>>>,
|
||||||
assets: Extract<Res<Assets<M>>>,
|
assets: Extract<Res<Assets<M>>>,
|
||||||
|
@ -505,7 +505,7 @@ impl<M: Material2d> Default for PrepareNextFrameMaterials<M> {
|
||||||
|
|
||||||
/// This system prepares all assets of the corresponding [`Material2d`] type
|
/// This system prepares all assets of the corresponding [`Material2d`] type
|
||||||
/// which where extracted this frame for the GPU.
|
/// which where extracted this frame for the GPU.
|
||||||
fn prepare_materials_2d<M: Material2d>(
|
pub fn prepare_materials_2d<M: Material2d>(
|
||||||
mut prepare_next_frame: Local<PrepareNextFrameMaterials<M>>,
|
mut prepare_next_frame: Local<PrepareNextFrameMaterials<M>>,
|
||||||
mut extracted_assets: ResMut<ExtractedMaterials2d<M>>,
|
mut extracted_assets: ResMut<ExtractedMaterials2d<M>>,
|
||||||
mut render_materials: ResMut<RenderMaterials2d<M>>,
|
mut render_materials: ResMut<RenderMaterials2d<M>>,
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct TextureAtlas {
|
||||||
/// The specific areas of the atlas where each texture can be found
|
/// The specific areas of the atlas where each texture can be found
|
||||||
pub textures: Vec<Rect>,
|
pub textures: Vec<Rect>,
|
||||||
/// Mapping from texture handle to index
|
/// Mapping from texture handle to index
|
||||||
pub(crate) texture_handles: Option<HashMap<Handle<Image>, usize>>,
|
pub texture_handles: Option<HashMap<Handle<Image>, usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
|
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
|
||||||
|
|
|
@ -23,7 +23,7 @@ use bevy_utils::Duration;
|
||||||
/// assert!(stopwatch.paused());
|
/// assert!(stopwatch.paused());
|
||||||
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
|
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Reflect, FromReflect)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[reflect(Default)]
|
#[reflect(Default)]
|
||||||
pub struct Stopwatch {
|
pub struct Stopwatch {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use bevy_utils::Duration;
|
||||||
/// exceeded, and can still be reset at any given point.
|
/// exceeded, and can still be reset at any given point.
|
||||||
///
|
///
|
||||||
/// Paused timers will not have elapsed time increased.
|
/// Paused timers will not have elapsed time increased.
|
||||||
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Reflect, FromReflect)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[reflect(Default)]
|
#[reflect(Default)]
|
||||||
pub struct Timer {
|
pub struct Timer {
|
||||||
|
|
|
@ -349,19 +349,19 @@ impl Transform {
|
||||||
/// and [`Transform::up`] points towards `up`.
|
/// and [`Transform::up`] points towards `up`.
|
||||||
///
|
///
|
||||||
/// In some cases it's not possible to construct a rotation. Another axis will be picked in those cases:
|
/// In some cases it's not possible to construct a rotation. Another axis will be picked in those cases:
|
||||||
/// * if `direction` is zero, `Vec3::Z` is used instead
|
/// * if `direction` is zero, `Vec3::NEG_Z` is used instead
|
||||||
/// * if `up` is zero, `Vec3::Y` is used instead
|
/// * if `up` is zero, `Vec3::Y` is used instead
|
||||||
/// * if `direction` is parallel with `up`, an orthogonal vector is used as the "right" direction
|
/// * if `direction` is parallel with `up`, an orthogonal vector is used as the "right" direction
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn look_to(&mut self, direction: Vec3, up: Vec3) {
|
pub fn look_to(&mut self, direction: Vec3, up: Vec3) {
|
||||||
let forward = -direction.try_normalize().unwrap_or(Vec3::Z);
|
let back = -direction.try_normalize().unwrap_or(Vec3::NEG_Z);
|
||||||
let up = up.try_normalize().unwrap_or(Vec3::Y);
|
let up = up.try_normalize().unwrap_or(Vec3::Y);
|
||||||
let right = up
|
let right = up
|
||||||
.cross(forward)
|
.cross(back)
|
||||||
.try_normalize()
|
.try_normalize()
|
||||||
.unwrap_or_else(|| up.any_orthonormal_vector());
|
.unwrap_or_else(|| up.any_orthonormal_vector());
|
||||||
let up = forward.cross(right);
|
let up = back.cross(right);
|
||||||
self.rotation = Quat::from_mat3(&Mat3::from_cols(right, up, forward));
|
self.rotation = Quat::from_mat3(&Mat3::from_cols(right, up, back));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Multiplies `self` with `transform` component by component, returning the
|
/// Multiplies `self` with `transform` component by component, returning the
|
||||||
|
|
|
@ -6,10 +6,11 @@ use bevy_a11y::{
|
||||||
accesskit::{NodeBuilder, Rect, Role},
|
accesskit::{NodeBuilder, Rect, Role},
|
||||||
AccessibilityNode,
|
AccessibilityNode,
|
||||||
};
|
};
|
||||||
use bevy_app::{App, Plugin, Update};
|
use bevy_app::{App, Plugin, PostUpdate};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::{DetectChanges, Entity},
|
prelude::{DetectChanges, Entity},
|
||||||
query::{Changed, Without},
|
query::{Changed, Without},
|
||||||
|
schedule::IntoSystemConfigs,
|
||||||
system::{Commands, Query},
|
system::{Commands, Query},
|
||||||
world::Ref,
|
world::Ref,
|
||||||
};
|
};
|
||||||
|
@ -147,8 +148,13 @@ pub(crate) struct AccessibilityPlugin;
|
||||||
impl Plugin for AccessibilityPlugin {
|
impl Plugin for AccessibilityPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
PostUpdate,
|
||||||
(calc_bounds, button_changed, image_changed, label_changed),
|
(
|
||||||
|
calc_bounds.after(bevy_transform::TransformSystem::TransformPropagate),
|
||||||
|
button_changed,
|
||||||
|
image_changed,
|
||||||
|
label_changed,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@ keywords = ["bevy"]
|
||||||
detailed_trace = []
|
detailed_trace = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ahash = "0.7.0"
|
ahash = "0.8.3"
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
instant = { version = "0.1", features = ["wasm-bindgen"] }
|
instant = { version = "0.1", features = ["wasm-bindgen"] }
|
||||||
uuid = { version = "1.1", features = ["v4", "serde"] }
|
uuid = { version = "1.1", features = ["v4", "serde"] }
|
||||||
hashbrown = { version = "0.12", features = ["serde"] }
|
hashbrown = { version = "0.13", features = ["serde"] }
|
||||||
bevy_utils_proc_macros = {version = "0.11.0-dev", path = "macros"}
|
bevy_utils_proc_macros = {version = "0.11.0-dev", path = "macros"}
|
||||||
petgraph = "0.6"
|
petgraph = "0.6"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub mod syncunsafecell;
|
||||||
mod default;
|
mod default;
|
||||||
mod float_ord;
|
mod float_ord;
|
||||||
|
|
||||||
pub use ahash::AHasher;
|
pub use ahash::{AHasher, RandomState};
|
||||||
pub use bevy_utils_proc_macros::*;
|
pub use bevy_utils_proc_macros::*;
|
||||||
pub use default::default;
|
pub use default::default;
|
||||||
pub use float_ord::*;
|
pub use float_ord::*;
|
||||||
|
@ -32,12 +32,11 @@ pub use thiserror;
|
||||||
pub use tracing;
|
pub use tracing;
|
||||||
pub use uuid::Uuid;
|
pub use uuid::Uuid;
|
||||||
|
|
||||||
use ahash::RandomState;
|
|
||||||
use hashbrown::hash_map::RawEntryMut;
|
use hashbrown::hash_map::RawEntryMut;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
future::Future,
|
future::Future,
|
||||||
hash::{BuildHasher, Hash, Hasher},
|
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
mem::ManuallyDrop,
|
mem::ManuallyDrop,
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
|
@ -48,11 +47,12 @@ use std::{
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
|
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
|
||||||
|
|
||||||
|
#[allow(missing_docs)]
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
|
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
|
||||||
|
|
||||||
/// A shortcut alias for [`hashbrown::hash_map::Entry`].
|
/// A shortcut alias for [`hashbrown::hash_map::Entry`].
|
||||||
pub type Entry<'a, K, V> = hashbrown::hash_map::Entry<'a, K, V, RandomState>;
|
pub type Entry<'a, K, V> = hashbrown::hash_map::Entry<'a, K, V, BuildHasherDefault<AHasher>>;
|
||||||
|
|
||||||
/// A hasher builder that will create a fixed hasher.
|
/// A hasher builder that will create a fixed hasher.
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
|
@ -63,10 +63,13 @@ impl std::hash::BuildHasher for FixedState {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn build_hasher(&self) -> AHasher {
|
fn build_hasher(&self) -> AHasher {
|
||||||
AHasher::new_with_keys(
|
RandomState::with_seeds(
|
||||||
0b1001010111101110000001001100010000000011001001101011001001111000,
|
0b10010101111011100000010011000100,
|
||||||
0b1100111101101011011110001011010100000100001111100011010011010101,
|
0b00000011001001101011001001111000,
|
||||||
|
0b11001111011010110111100010110101,
|
||||||
|
0b00000100001111100011010011010101,
|
||||||
)
|
)
|
||||||
|
.build_hasher()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +77,7 @@ impl std::hash::BuildHasher for FixedState {
|
||||||
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
|
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
|
||||||
///
|
///
|
||||||
/// aHash is designed for performance and is NOT cryptographically secure.
|
/// aHash is designed for performance and is NOT cryptographically secure.
|
||||||
pub type HashMap<K, V> = hashbrown::HashMap<K, V, RandomState>;
|
pub type HashMap<K, V> = hashbrown::HashMap<K, V, BuildHasherDefault<AHasher>>;
|
||||||
|
|
||||||
/// A stable hash map implementing aHash, a high speed keyed hashing algorithm
|
/// A stable hash map implementing aHash, a high speed keyed hashing algorithm
|
||||||
/// intended for use in in-memory hashmaps.
|
/// intended for use in in-memory hashmaps.
|
||||||
|
@ -89,7 +92,7 @@ pub type StableHashMap<K, V> = hashbrown::HashMap<K, V, FixedState>;
|
||||||
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
|
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
|
||||||
///
|
///
|
||||||
/// aHash is designed for performance and is NOT cryptographically secure.
|
/// aHash is designed for performance and is NOT cryptographically secure.
|
||||||
pub type HashSet<K> = hashbrown::HashSet<K, RandomState>;
|
pub type HashSet<K> = hashbrown::HashSet<K, BuildHasherDefault<AHasher>>;
|
||||||
|
|
||||||
/// A stable hash set implementing aHash, a high speed keyed hashing algorithm
|
/// A stable hash set implementing aHash, a high speed keyed hashing algorithm
|
||||||
/// intended for use in in-memory hashmaps.
|
/// intended for use in in-memory hashmaps.
|
||||||
|
|
|
@ -24,9 +24,8 @@ pub struct WindowResized {
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This would redraw all windows ? If yes, update docs to reflect this
|
/// An event that indicates all of the application's windows should be redrawn,
|
||||||
/// An event that indicates the window should redraw, even if its control flow is set to `Wait` and
|
/// even if their control flow is set to `Wait` and there have been no window events.
|
||||||
/// there have been no window events.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Reflect, FromReflect)]
|
#[derive(Debug, Clone, PartialEq, Eq, Reflect, FromReflect)]
|
||||||
#[reflect(Debug, PartialEq)]
|
#[reflect(Debug, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
|
|
|
@ -10,7 +10,7 @@ use bevy_a11y::{
|
||||||
accesskit::{ActionHandler, ActionRequest, NodeBuilder, NodeClassSet, Role, TreeUpdate},
|
accesskit::{ActionHandler, ActionRequest, NodeBuilder, NodeClassSet, Role, TreeUpdate},
|
||||||
AccessKitEntityExt, AccessibilityNode, AccessibilityRequested, Focus,
|
AccessKitEntityExt, AccessibilityNode, AccessibilityRequested, Focus,
|
||||||
};
|
};
|
||||||
use bevy_app::{App, Plugin, Update};
|
use bevy_app::{App, Plugin, PostUpdate};
|
||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::{DetectChanges, Entity, EventReader, EventWriter},
|
prelude::{DetectChanges, Entity, EventReader, EventWriter},
|
||||||
|
@ -166,7 +166,7 @@ impl Plugin for AccessibilityPlugin {
|
||||||
.init_resource::<WinitActionHandlers>()
|
.init_resource::<WinitActionHandlers>()
|
||||||
.add_event::<ActionRequest>()
|
.add_event::<ActionRequest>()
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
PostUpdate,
|
||||||
(
|
(
|
||||||
handle_window_focus,
|
handle_window_focus,
|
||||||
window_closed,
|
window_closed,
|
||||||
|
|
|
@ -400,7 +400,10 @@ fn toggle_tonemapping_method(
|
||||||
*method = Tonemapping::BlenderFilmic;
|
*method = Tonemapping::BlenderFilmic;
|
||||||
}
|
}
|
||||||
|
|
||||||
*color_grading = *per_method_settings.settings.get(&method).unwrap();
|
*color_grading = *per_method_settings
|
||||||
|
.settings
|
||||||
|
.get::<Tonemapping>(&method)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn main() {
|
||||||
|
|
||||||
app.add_plugins(DefaultPlugins.set(WindowPlugin {
|
app.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
present_mode: PresentMode::Immediate,
|
present_mode: PresentMode::AutoNoVsync,
|
||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
..default()
|
..default()
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.add_plugins(DefaultPlugins.set(WindowPlugin {
|
app.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
present_mode: PresentMode::Immediate,
|
present_mode: PresentMode::AutoNoVsync,
|
||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
..default()
|
..default()
|
||||||
|
|
Loading…
Reference in a new issue