Fix various typos (#7096)
I stumbled across a typo in some docs. Fixed some more while I was in there.
This commit is contained in:
parent
329b71fa62
commit
3dd8b42f72
@ -10,7 +10,7 @@ use std::any::Any;
|
|||||||
/// can only be added once to an [`App`].
|
/// can only be added once to an [`App`].
|
||||||
///
|
///
|
||||||
/// If the plugin may need to be added twice or more, the function [`is_unique()`](Self::is_unique)
|
/// If the plugin may need to be added twice or more, the function [`is_unique()`](Self::is_unique)
|
||||||
/// should be overriden to return `false`. Plugins are considered duplicate if they have the same
|
/// should be overridden to return `false`. Plugins are considered duplicate if they have the same
|
||||||
/// [`name()`](Self::name). The default `name()` implementation returns the type name, which means
|
/// [`name()`](Self::name). The default `name()` implementation returns the type name, which means
|
||||||
/// generic plugins with different type parameters will not be considered duplicates.
|
/// generic plugins with different type parameters will not be considered duplicates.
|
||||||
pub trait Plugin: Downcast + Any + Send + Sync {
|
pub trait Plugin: Downcast + Any + Send + Sync {
|
||||||
|
@ -387,7 +387,7 @@ impl AssetServer {
|
|||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if version has changed since we loaded and grabbed a lock, return. theres is a newer
|
// if version has changed since we loaded and grabbed a lock, return. there is a newer
|
||||||
// version being loaded
|
// version being loaded
|
||||||
let mut asset_sources = self.server.asset_sources.write();
|
let mut asset_sources = self.server.asset_sources.write();
|
||||||
let source_info = asset_sources
|
let source_info = asset_sources
|
||||||
|
@ -111,7 +111,7 @@ impl Diagnostic {
|
|||||||
/// The smoothing factor used for the exponential smoothing used for
|
/// The smoothing factor used for the exponential smoothing used for
|
||||||
/// [`smoothed`](Self::smoothed).
|
/// [`smoothed`](Self::smoothed).
|
||||||
///
|
///
|
||||||
/// If measurements come in less fequently than `smoothing_factor` seconds
|
/// If measurements come in less frequently than `smoothing_factor` seconds
|
||||||
/// apart, no smoothing will be applied. As measurements come in more
|
/// apart, no smoothing will be applied. As measurements come in more
|
||||||
/// frequently, the smoothing takes a greater effect such that it takes
|
/// frequently, the smoothing takes a greater effect such that it takes
|
||||||
/// approximately `smoothing_factor` seconds for 83% of an instantaneous
|
/// approximately `smoothing_factor` seconds for 83% of an instantaneous
|
||||||
|
@ -625,7 +625,7 @@ impl Archetypes {
|
|||||||
self.archetypes.len()
|
self.archetypes.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetches an immutable reference to the archetype without any compoennts.
|
/// Fetches an immutable reference to the archetype without any components.
|
||||||
///
|
///
|
||||||
/// Shorthand for `archetypes.get(ArchetypeId::EMPTY).unwrap()`
|
/// Shorthand for `archetypes.get(ArchetypeId::EMPTY).unwrap()`
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -634,7 +634,7 @@ impl Archetypes {
|
|||||||
unsafe { self.archetypes.get_unchecked(ArchetypeId::EMPTY.index()) }
|
unsafe { self.archetypes.get_unchecked(ArchetypeId::EMPTY.index()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetches an mutable reference to the archetype without any compoennts.
|
/// Fetches an mutable reference to the archetype without any components.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn empty_mut(&mut self) -> &mut Archetype {
|
pub(crate) fn empty_mut(&mut self) -> &mut Archetype {
|
||||||
// SAFETY: empty archetype always exists
|
// SAFETY: empty archetype always exists
|
||||||
|
@ -33,7 +33,7 @@ pub const MAX_CHANGE_AGE: u32 = u32::MAX - (2 * CHECK_TICK_THRESHOLD - 1);
|
|||||||
///
|
///
|
||||||
/// To ensure that changes are only triggered when the value actually differs,
|
/// To ensure that changes are only triggered when the value actually differs,
|
||||||
/// check if the value would change before assignment, such as by checking that `new != old`.
|
/// check if the value would change before assignment, such as by checking that `new != old`.
|
||||||
/// You must be *sure* that you are not mutably derefencing in this process.
|
/// You must be *sure* that you are not mutably dereferencing in this process.
|
||||||
///
|
///
|
||||||
/// [`set_if_neq`](DetectChanges::set_if_neq) is a helper
|
/// [`set_if_neq`](DetectChanges::set_if_neq) is a helper
|
||||||
/// method for this common functionality.
|
/// method for this common functionality.
|
||||||
|
@ -586,7 +586,7 @@ impl Entities {
|
|||||||
/// - `location` must be valid for the entity at `index` or immediately made valid afterwards
|
/// - `location` must be valid for the entity at `index` or immediately made valid afterwards
|
||||||
/// before handing control to unknown code.
|
/// before handing control to unknown code.
|
||||||
pub(crate) unsafe fn set(&mut self, index: u32, location: EntityLocation) {
|
pub(crate) unsafe fn set(&mut self, index: u32, location: EntityLocation) {
|
||||||
// SAFETY: Caller guarentees that `index` a valid entity index
|
// SAFETY: Caller guarantees that `index` a valid entity index
|
||||||
self.meta.get_unchecked_mut(index as usize).location = location;
|
self.meta.get_unchecked_mut(index as usize).location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ pub unsafe trait WorldQuery {
|
|||||||
// This does not have a default body of `{}` because 99% of cases need to add accesses
|
// This does not have a default body of `{}` because 99% of cases need to add accesses
|
||||||
// and forgetting to do so would be unsound.
|
// and forgetting to do so would be unsound.
|
||||||
fn update_component_access(state: &Self::State, access: &mut FilteredAccess<ComponentId>);
|
fn update_component_access(state: &Self::State, access: &mut FilteredAccess<ComponentId>);
|
||||||
// This does not have a default body of `{}` becaues 99% of cases need to add accesses
|
// This does not have a default body of `{}` because 99% of cases need to add accesses
|
||||||
// and forgetting to do so would be unsound.
|
// and forgetting to do so would be unsound.
|
||||||
fn update_archetype_component_access(
|
fn update_archetype_component_access(
|
||||||
state: &Self::State,
|
state: &Self::State,
|
||||||
@ -886,7 +886,7 @@ unsafe impl<T: WorldQuery> WorldQuery for Option<T> {
|
|||||||
fn update_component_access(state: &T::State, access: &mut FilteredAccess<ComponentId>) {
|
fn update_component_access(state: &T::State, access: &mut FilteredAccess<ComponentId>) {
|
||||||
// We don't want to add the `with`/`without` of `T` as `Option<T>` will match things regardless of
|
// We don't want to add the `with`/`without` of `T` as `Option<T>` will match things regardless of
|
||||||
// `T`'s filters. for example `Query<(Option<&U>, &mut V)>` will match every entity with a `V` component
|
// `T`'s filters. for example `Query<(Option<&U>, &mut V)>` will match every entity with a `V` component
|
||||||
// regardless of whether it has a `U` component. If we dont do this the query will not conflict with
|
// regardless of whether it has a `U` component. If we don't do this the query will not conflict with
|
||||||
// `Query<&mut V, Without<U>>` which would be unsound.
|
// `Query<&mut V, Without<U>>` which would be unsound.
|
||||||
let mut intermediate = access.clone();
|
let mut intermediate = access.clone();
|
||||||
T::update_component_access(state, &mut intermediate);
|
T::update_component_access(state, &mut intermediate);
|
||||||
|
@ -25,7 +25,7 @@ pub(crate) trait DebugCheckedUnwrap {
|
|||||||
unsafe fn debug_checked_unwrap(self) -> Self::Item;
|
unsafe fn debug_checked_unwrap(self) -> Self::Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thes two impls are explicitly split to ensure that the unreachable! macro
|
// These two impls are explicitly split to ensure that the unreachable! macro
|
||||||
// does not cause inlining to fail when compiling in release mode.
|
// does not cause inlining to fail when compiling in release mode.
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
impl<T> DebugCheckedUnwrap for Option<T> {
|
impl<T> DebugCheckedUnwrap for Option<T> {
|
||||||
|
@ -220,7 +220,7 @@ impl Schedule {
|
|||||||
stage_label: impl StageLabel,
|
stage_label: impl StageLabel,
|
||||||
system: impl IntoSystemDescriptor<Params>,
|
system: impl IntoSystemDescriptor<Params>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
// Use a function instead of a closure to ensure that it is codegend inside bevy_ecs instead
|
// Use a function instead of a closure to ensure that it is codegened inside bevy_ecs instead
|
||||||
// of the game. Closures inherit generic parameters from their enclosing function.
|
// of the game. Closures inherit generic parameters from their enclosing function.
|
||||||
#[cold]
|
#[cold]
|
||||||
fn stage_not_found(stage_label: &dyn Debug) -> ! {
|
fn stage_not_found(stage_label: &dyn Debug) -> ! {
|
||||||
|
@ -49,14 +49,14 @@ impl TableId {
|
|||||||
|
|
||||||
/// A opaque newtype for rows in [`Table`]s. Specifies a single row in a specific table.
|
/// A opaque newtype for rows in [`Table`]s. Specifies a single row in a specific table.
|
||||||
///
|
///
|
||||||
/// Values of this type are retreivable from [`Archetype::entity_table_row`] and can be
|
/// Values of this type are retrievable from [`Archetype::entity_table_row`] and can be
|
||||||
/// used alongside [`Archetype::table_id`] to fetch the exact table and row where an
|
/// used alongside [`Archetype::table_id`] to fetch the exact table and row where an
|
||||||
/// [`Entity`]'s
|
/// [`Entity`]'s
|
||||||
///
|
///
|
||||||
/// Values of this type are only valid so long as entities have not moved around.
|
/// Values of this type are only valid so long as entities have not moved around.
|
||||||
/// Adding and removing components from an entity, or despawning it will invalidate
|
/// Adding and removing components from an entity, or despawning it will invalidate
|
||||||
/// potentially any table row in the table the entity was previously stored in. Users
|
/// potentially any table row in the table the entity was previously stored in. Users
|
||||||
/// should *always* fetch the approripate row from the entity's [`Archetype`] before
|
/// should *always* fetch the appropriate row from the entity's [`Archetype`] before
|
||||||
/// fetching the entity's components.
|
/// fetching the entity's components.
|
||||||
///
|
///
|
||||||
/// [`Archetype`]: crate::archetype::Archetype
|
/// [`Archetype`]: crate::archetype::Archetype
|
||||||
|
@ -279,7 +279,7 @@ fn assert_component_access_compatibility(
|
|||||||
/// # bad_system_system.run((), &mut world);
|
/// # bad_system_system.run((), &mut world);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Conflicing `SystemParam`s like these can be placed in a `ParamSet`,
|
/// Conflicting `SystemParam`s like these can be placed in a `ParamSet`,
|
||||||
/// which leverages the borrow checker to ensure that only one of the contained parameters are accessed at a given time.
|
/// which leverages the borrow checker to ensure that only one of the contained parameters are accessed at a given time.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -159,7 +159,7 @@ impl<'w> EntityRef<'w> {
|
|||||||
.map(|(value, ticks)| Mut {
|
.map(|(value, ticks)| Mut {
|
||||||
// SAFETY:
|
// SAFETY:
|
||||||
// - returned component is of type T
|
// - returned component is of type T
|
||||||
// - Caller guarentees that this reference will not alias.
|
// - Caller guarantees that this reference will not alias.
|
||||||
value: value.assert_unique().deref_mut::<T>(),
|
value: value.assert_unique().deref_mut::<T>(),
|
||||||
ticks: Ticks::from_tick_cells(ticks, last_change_tick, change_tick),
|
ticks: Ticks::from_tick_cells(ticks, last_change_tick, change_tick),
|
||||||
})
|
})
|
||||||
|
@ -172,7 +172,7 @@ mod tests {
|
|||||||
// Add a child to the grandparent (the "parent"), which will get deleted
|
// Add a child to the grandparent (the "parent"), which will get deleted
|
||||||
parent
|
parent
|
||||||
.spawn((N("Parent, to be deleted".to_owned()), Idx(3)))
|
.spawn((N("Parent, to be deleted".to_owned()), Idx(3)))
|
||||||
// All descendents of the "parent" should also be deleted.
|
// All descendants of the "parent" should also be deleted.
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent
|
parent
|
||||||
.spawn((N("First Child, to be deleted".to_owned()), Idx(4)))
|
.spawn((N("First Child, to be deleted".to_owned()), Idx(4)))
|
||||||
|
@ -864,7 +864,7 @@ impl AxisSettings {
|
|||||||
///
|
///
|
||||||
/// If the value passed is less than the dead zone upper bound,
|
/// If the value passed is less than the dead zone upper bound,
|
||||||
/// returns `AxisSettingsError::DeadZoneUpperBoundGreaterThanLiveZoneUpperBound`.
|
/// returns `AxisSettingsError::DeadZoneUpperBoundGreaterThanLiveZoneUpperBound`.
|
||||||
/// If the value passsed is not in range [0.0..=1.0], returns `AxisSettingsError::LiveZoneUpperBoundOutOfRange`.
|
/// If the value passed is not in range [0.0..=1.0], returns `AxisSettingsError::LiveZoneUpperBoundOutOfRange`.
|
||||||
pub fn try_set_livezone_upperbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
pub fn try_set_livezone_upperbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
||||||
if !(0.0..=1.0).contains(&value) {
|
if !(0.0..=1.0).contains(&value) {
|
||||||
Err(AxisSettingsError::LiveZoneUpperBoundOutOfRange(value))
|
Err(AxisSettingsError::LiveZoneUpperBoundOutOfRange(value))
|
||||||
@ -901,7 +901,7 @@ impl AxisSettings {
|
|||||||
///
|
///
|
||||||
/// If the value passed is greater than the live zone upper bound,
|
/// If the value passed is greater than the live zone upper bound,
|
||||||
/// returns `AxisSettingsError::DeadZoneUpperBoundGreaterThanLiveZoneUpperBound`.
|
/// returns `AxisSettingsError::DeadZoneUpperBoundGreaterThanLiveZoneUpperBound`.
|
||||||
/// If the value passsed is not in range [0.0..=1.0], returns `AxisSettingsError::DeadZoneUpperBoundOutOfRange`.
|
/// If the value passed is not in range [0.0..=1.0], returns `AxisSettingsError::DeadZoneUpperBoundOutOfRange`.
|
||||||
pub fn try_set_deadzone_upperbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
pub fn try_set_deadzone_upperbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
||||||
if !(0.0..=1.0).contains(&value) {
|
if !(0.0..=1.0).contains(&value) {
|
||||||
Err(AxisSettingsError::DeadZoneUpperBoundOutOfRange(value))
|
Err(AxisSettingsError::DeadZoneUpperBoundOutOfRange(value))
|
||||||
@ -939,7 +939,7 @@ impl AxisSettings {
|
|||||||
///
|
///
|
||||||
/// If the value passed is less than the dead zone lower bound,
|
/// If the value passed is less than the dead zone lower bound,
|
||||||
/// returns `AxisSettingsError::LiveZoneLowerBoundGreaterThanDeadZoneLowerBound`.
|
/// returns `AxisSettingsError::LiveZoneLowerBoundGreaterThanDeadZoneLowerBound`.
|
||||||
/// If the value passsed is not in range [-1.0..=0.0], returns `AxisSettingsError::LiveZoneLowerBoundOutOfRange`.
|
/// If the value passed is not in range [-1.0..=0.0], returns `AxisSettingsError::LiveZoneLowerBoundOutOfRange`.
|
||||||
pub fn try_set_livezone_lowerbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
pub fn try_set_livezone_lowerbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
||||||
if !(-1.0..=0.0).contains(&value) {
|
if !(-1.0..=0.0).contains(&value) {
|
||||||
Err(AxisSettingsError::LiveZoneLowerBoundOutOfRange(value))
|
Err(AxisSettingsError::LiveZoneLowerBoundOutOfRange(value))
|
||||||
@ -977,7 +977,7 @@ impl AxisSettings {
|
|||||||
///
|
///
|
||||||
/// If the value passed is less than the live zone lower bound,
|
/// If the value passed is less than the live zone lower bound,
|
||||||
/// returns `AxisSettingsError::LiveZoneLowerBoundGreaterThanDeadZoneLowerBound`.
|
/// returns `AxisSettingsError::LiveZoneLowerBoundGreaterThanDeadZoneLowerBound`.
|
||||||
/// If the value passsed is not in range [-1.0..=0.0], returns `AxisSettingsError::DeadZoneLowerBoundOutOfRange`.
|
/// If the value passed is not in range [-1.0..=0.0], returns `AxisSettingsError::DeadZoneLowerBoundOutOfRange`.
|
||||||
pub fn try_set_deadzone_lowerbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
pub fn try_set_deadzone_lowerbound(&mut self, value: f32) -> Result<(), AxisSettingsError> {
|
||||||
if !(-1.0..=0.0).contains(&value) {
|
if !(-1.0..=0.0).contains(&value) {
|
||||||
Err(AxisSettingsError::DeadZoneLowerBoundOutOfRange(value))
|
Err(AxisSettingsError::DeadZoneLowerBoundOutOfRange(value))
|
||||||
|
@ -166,7 +166,7 @@ impl Plugin for PbrPlugin {
|
|||||||
.after(VisibilitySystems::CheckVisibility)
|
.after(VisibilitySystems::CheckVisibility)
|
||||||
.after(TransformSystem::TransformPropagate)
|
.after(TransformSystem::TransformPropagate)
|
||||||
// We assume that no entity will be both a directional light and a spot light,
|
// We assume that no entity will be both a directional light and a spot light,
|
||||||
// so these systems will run indepdently of one another.
|
// so these systems will run independently of one another.
|
||||||
// FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481.
|
// FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481.
|
||||||
.ambiguous_with(update_spot_light_frusta),
|
.ambiguous_with(update_spot_light_frusta),
|
||||||
)
|
)
|
||||||
|
@ -303,7 +303,7 @@ pub enum SimulationLightSystems {
|
|||||||
// Some inspiration was taken from “Practical Clustered Shading” which is part 2 of:
|
// Some inspiration was taken from “Practical Clustered Shading” which is part 2 of:
|
||||||
// https://efficientshading.com/2015/01/01/real-time-many-light-management-and-shadows-with-clustered-shading/
|
// https://efficientshading.com/2015/01/01/real-time-many-light-management-and-shadows-with-clustered-shading/
|
||||||
// (Also note that Part 3 of the above shows how we could support the shadow mapping for many lights.)
|
// (Also note that Part 3 of the above shows how we could support the shadow mapping for many lights.)
|
||||||
// The z-slicing method mentioned in the aortiz article is originally from Tiago Sousa’s Siggraph 2016 talk about Doom 2016:
|
// The z-slicing method mentioned in the aortiz article is originally from Tiago Sousa's Siggraph 2016 talk about Doom 2016:
|
||||||
// http://advances.realtimerendering.com/s2016/Siggraph2016_idTech6.pdf
|
// http://advances.realtimerendering.com/s2016/Siggraph2016_idTech6.pdf
|
||||||
|
|
||||||
/// Configure the far z-plane mode used for the furthest depth slice for clustered forward
|
/// Configure the far z-plane mode used for the furthest depth slice for clustered forward
|
||||||
@ -550,7 +550,7 @@ fn view_z_to_z_slice(
|
|||||||
// NOTE: had to use -view_z to make it positive else log(negative) is nan
|
// NOTE: had to use -view_z to make it positive else log(negative) is nan
|
||||||
((-view_z).ln() * cluster_factors.x - cluster_factors.y + 1.0) as u32
|
((-view_z).ln() * cluster_factors.x - cluster_factors.y + 1.0) as u32
|
||||||
};
|
};
|
||||||
// NOTE: We use min as we may limit the far z plane used for clustering to be closeer than
|
// NOTE: We use min as we may limit the far z plane used for clustering to be closer than
|
||||||
// the furthest thing being drawn. This means that we need to limit to the maximum cluster.
|
// the furthest thing being drawn. This means that we need to limit to the maximum cluster.
|
||||||
z_slice.min(z_slices - 1)
|
z_slice.min(z_slices - 1)
|
||||||
}
|
}
|
||||||
@ -1437,7 +1437,7 @@ fn project_to_plane_z(z_light: Sphere, z_plane: Plane) -> Option<Sphere> {
|
|||||||
Some(Sphere {
|
Some(Sphere {
|
||||||
center: Vec3A::from(z_light.center.xy().extend(z)),
|
center: Vec3A::from(z_light.center.xy().extend(z)),
|
||||||
// hypotenuse length = radius
|
// hypotenuse length = radius
|
||||||
// pythagorus = (distance to plane)^2 + b^2 = radius^2
|
// pythagoras = (distance to plane)^2 + b^2 = radius^2
|
||||||
radius: (z_light.radius * z_light.radius - distance_to_plane * distance_to_plane).sqrt(),
|
radius: (z_light.radius * z_light.radius - distance_to_plane * distance_to_plane).sqrt(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ fn view_z_to_z_slice(view_z: f32, is_orthographic: bool) -> u32 {
|
|||||||
// NOTE: had to use -view_z to make it positive else log(negative) is nan
|
// NOTE: had to use -view_z to make it positive else log(negative) is nan
|
||||||
z_slice = u32(log(-view_z) * lights.cluster_factors.z - lights.cluster_factors.w + 1.0);
|
z_slice = u32(log(-view_z) * lights.cluster_factors.z - lights.cluster_factors.w + 1.0);
|
||||||
}
|
}
|
||||||
// NOTE: We use min as we may limit the far z plane used for clustering to be closeer than
|
// NOTE: We use min as we may limit the far z plane used for clustering to be closer than
|
||||||
// the furthest thing being drawn. This means that we need to limit to the maximum cluster.
|
// the furthest thing being drawn. This means that we need to limit to the maximum cluster.
|
||||||
return min(z_slice, lights.cluster_dimensions.z - 1u);
|
return min(z_slice, lights.cluster_dimensions.z - 1u);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ impl<T: CameraProjection> Default for CameraProjectionPlugin<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Label for [`camera_system<T>`], shared accross all `T`.
|
/// Label for [`camera_system<T>`], shared across all `T`.
|
||||||
///
|
///
|
||||||
/// [`camera_system<T>`]: crate::camera::camera_system
|
/// [`camera_system<T>`]: crate::camera::camera_system
|
||||||
#[derive(SystemLabel, Clone, Eq, PartialEq, Hash, Debug)]
|
#[derive(SystemLabel, Clone, Eq, PartialEq, Hash, Debug)]
|
||||||
|
@ -218,7 +218,7 @@ impl ShaderCache {
|
|||||||
let error = render_device.wgpu_device().pop_error_scope();
|
let error = render_device.wgpu_device().pop_error_scope();
|
||||||
|
|
||||||
// `now_or_never` will return Some if the future is ready and None otherwise.
|
// `now_or_never` will return Some if the future is ready and None otherwise.
|
||||||
// On native platforms, wgpu will yield the error immediatly while on wasm it may take longer since the browser APIs are asynchronous.
|
// On native platforms, wgpu will yield the error immediately while on wasm it may take longer since the browser APIs are asynchronous.
|
||||||
// So to keep the complexity of the ShaderCache low, we will only catch this error early on native platforms,
|
// So to keep the complexity of the ShaderCache low, we will only catch this error early on native platforms,
|
||||||
// and on wasm the error will be handled by wgpu and crash the application.
|
// and on wasm the error will be handled by wgpu and crash the application.
|
||||||
if let Some(Some(wgpu::Error::Validation { description, .. })) =
|
if let Some(Some(wgpu::Error::Validation { description, .. })) =
|
||||||
|
@ -74,7 +74,7 @@ impl<'w> DynamicSceneBuilder<'w> {
|
|||||||
self.extract_entities(std::iter::once(entity))
|
self.extract_entities(std::iter::once(entity))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Despawns all enitities with no components.
|
/// Despawns all entities with no components.
|
||||||
///
|
///
|
||||||
/// These were likely created because none of their components were present in the provided type registry upon extraction.
|
/// These were likely created because none of their components were present in the provided type registry upon extraction.
|
||||||
pub fn remove_empty_entities(&mut self) -> &mut Self {
|
pub fn remove_empty_entities(&mut self) -> &mut Self {
|
||||||
|
@ -12,7 +12,7 @@ use bevy_utils::{tracing::error, HashMap};
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// Informations about a scene instance.
|
/// Information about a scene instance.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct InstanceInfo {
|
pub struct InstanceInfo {
|
||||||
/// Mapping of entities from the scene world to the instance world.
|
/// Mapping of entities from the scene world to the instance world.
|
||||||
|
@ -549,7 +549,7 @@ pub fn queue_sprites(
|
|||||||
};
|
};
|
||||||
let mut current_batch_entity = Entity::PLACEHOLDER;
|
let mut current_batch_entity = Entity::PLACEHOLDER;
|
||||||
let mut current_image_size = Vec2::ZERO;
|
let mut current_image_size = Vec2::ZERO;
|
||||||
// Add a phase item for each sprite, and detect when succesive items can be batched.
|
// Add a phase item for each sprite, and detect when successive items can be batched.
|
||||||
// Spawn an entity with a `SpriteBatch` component for each possible batch.
|
// Spawn an entity with a `SpriteBatch` component for each possible batch.
|
||||||
// Compatible items share the same entity.
|
// Compatible items share the same entity.
|
||||||
// Batches are merged later (in `batch_phase_system()`), so that they can be interrupted
|
// Batches are merged later (in `batch_phase_system()`), so that they can be interrupted
|
||||||
|
@ -414,7 +414,7 @@ impl<'scope, 'env, T: Send + 'scope> Scope<'scope, 'env, T> {
|
|||||||
pub fn spawn<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
|
pub fn spawn<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
|
||||||
let task = self.executor.spawn(f).fallible();
|
let task = self.executor.spawn(f).fallible();
|
||||||
// ConcurrentQueue only errors when closed or full, but we never
|
// ConcurrentQueue only errors when closed or full, but we never
|
||||||
// close and use an unbouded queue, so it is safe to unwrap
|
// close and use an unbounded queue, so it is safe to unwrap
|
||||||
self.spawned.push(task).unwrap();
|
self.spawned.push(task).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ impl<'scope, 'env, T: Send + 'scope> Scope<'scope, 'env, T> {
|
|||||||
pub fn spawn_on_scope<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
|
pub fn spawn_on_scope<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
|
||||||
let task = self.task_scope_executor.spawn(f).fallible();
|
let task = self.task_scope_executor.spawn(f).fallible();
|
||||||
// ConcurrentQueue only errors when closed or full, but we never
|
// ConcurrentQueue only errors when closed or full, but we never
|
||||||
// close and use an unbouded queue, so it is safe to unwrap
|
// close and use an unbounded queue, so it is safe to unwrap
|
||||||
self.spawned.push(task).unwrap();
|
self.spawned.push(task).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ impl Stopwatch {
|
|||||||
self.paused
|
self.paused
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets the stopwatch. The reset doesn’t affect the paused state of the stopwatch.
|
/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -157,7 +157,7 @@ impl Val {
|
|||||||
/// Returns a [`ValArithmeticError::NonEvaluateable`] if the [`Val`] is impossible to evaluate into [`Val::Px`].
|
/// Returns a [`ValArithmeticError::NonEvaluateable`] if the [`Val`] is impossible to evaluate into [`Val::Px`].
|
||||||
/// Otherwise it returns an [`f32`] containing the evaluated value in pixels.
|
/// Otherwise it returns an [`f32`] containing the evaluated value in pixels.
|
||||||
///
|
///
|
||||||
/// **Note:** If a [`Val::Px`] is evaluated, it's innver value returned unchanged.
|
/// **Note:** If a [`Val::Px`] is evaluated, it's inner value returned unchanged.
|
||||||
pub fn evaluate(&self, size: f32) -> Result<f32, ValArithmeticError> {
|
pub fn evaluate(&self, size: f32) -> Result<f32, ValArithmeticError> {
|
||||||
match self {
|
match self {
|
||||||
Val::Percent(value) => Ok(size * value / 100.0),
|
Val::Percent(value) => Ok(size * value / 100.0),
|
||||||
@ -554,7 +554,7 @@ impl Default for FlexWrap {
|
|||||||
pub struct CalculatedSize {
|
pub struct CalculatedSize {
|
||||||
/// The size of the node
|
/// The size of the node
|
||||||
pub size: Size,
|
pub size: Size,
|
||||||
/// Whether to attempt to preserve the aspect ratio when determing the layout for this item
|
/// Whether to attempt to preserve the aspect ratio when determining the layout for this item
|
||||||
pub preserve_aspect_ratio: bool,
|
pub preserve_aspect_ratio: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ use std::{
|
|||||||
pin::Pin,
|
pin::Pin,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An owned and dynamically typed Future used when you can’t statically type your result or need to add some indirection.
|
/// An owned and dynamically typed Future used when you can't statically type your result or need to add some indirection.
|
||||||
#[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>>;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ pub enum PresentMode {
|
|||||||
)]
|
)]
|
||||||
#[reflect(Debug, PartialEq, Hash)]
|
#[reflect(Debug, PartialEq, Hash)]
|
||||||
pub enum CompositeAlphaMode {
|
pub enum CompositeAlphaMode {
|
||||||
/// Chooses either `Opaque` or `Inherit` automatically,depending on the
|
/// Chooses either `Opaque` or `Inherit` automatically, depending on the
|
||||||
/// `alpha_mode` that the current surface can support.
|
/// `alpha_mode` that the current surface can support.
|
||||||
Auto = 0,
|
Auto = 0,
|
||||||
/// The alpha channel, if it exists, of the textures is ignored in the
|
/// The alpha channel, if it exists, of the textures is ignored in the
|
||||||
|
@ -60,7 +60,7 @@ pub struct CustomMaterial {
|
|||||||
|
|
||||||
/// The Material trait is very configurable, but comes with sensible defaults for all methods.
|
/// The Material trait is very configurable, but comes with sensible defaults for all methods.
|
||||||
/// You only need to implement functions for features that need non-default behavior. See the Material api docs for details!
|
/// You only need to implement functions for features that need non-default behavior. See the Material api docs for details!
|
||||||
/// When using the GLSL shading language for your shader, the specialize method must be overriden.
|
/// When using the GLSL shading language for your shader, the specialize method must be overridden.
|
||||||
impl Material for CustomMaterial {
|
impl Material for CustomMaterial {
|
||||||
fn vertex_shader() -> ShaderRef {
|
fn vertex_shader() -> ShaderRef {
|
||||||
"shaders/custom_material.vert".into()
|
"shaders/custom_material.vert".into()
|
||||||
|
@ -16,7 +16,7 @@ mod pretty;
|
|||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
struct Args {
|
struct Args {
|
||||||
#[arg(short, long, default_value_t = 0.0)]
|
#[arg(short, long, default_value_t = 0.0)]
|
||||||
/// Filter spans that have an average shorther than the threshold
|
/// Filter spans that have an average shorter than the threshold
|
||||||
threshold: f32,
|
threshold: f32,
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
|
Loading…
Reference in New Issue
Block a user