diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08d34fec7a..8ae7f6597e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -294,7 +294,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check for typos - uses: crate-ci/typos@v1.33.1 + uses: crate-ci/typos@v1.34.0 - name: Typos info if: failure() run: | diff --git a/crates/bevy_core_widgets/src/core_slider.rs b/crates/bevy_core_widgets/src/core_slider.rs index 8a5e27f885..521e6fc1d3 100644 --- a/crates/bevy_core_widgets/src/core_slider.rs +++ b/crates/bevy_core_widgets/src/core_slider.rs @@ -176,7 +176,7 @@ impl Default for SliderRange { } /// Defines the amount by which to increment or decrement the slider value when using keyboard -/// shorctuts. Defaults to 1.0. +/// shortcuts. Defaults to 1.0. #[derive(Component, Debug, PartialEq, Clone)] #[component(immutable)] pub struct SliderStep(pub f32); diff --git a/crates/bevy_ecs/src/archetype.rs b/crates/bevy_ecs/src/archetype.rs index 1ecbad16a1..f682554ce9 100644 --- a/crates/bevy_ecs/src/archetype.rs +++ b/crates/bevy_ecs/src/archetype.rs @@ -630,7 +630,7 @@ impl Archetype { #[inline] pub fn len(&self) -> u32 { // No entity may have more than one archetype row, so there are no duplicates, - // and there may only ever be u32::MAX entities, so the length never exceeds u32's cappacity. + // and there may only ever be u32::MAX entities, so the length never exceeds u32's capacity. self.entities.len() as u32 } diff --git a/crates/bevy_ecs/src/storage/table/mod.rs b/crates/bevy_ecs/src/storage/table/mod.rs index be75c58f03..548ba82103 100644 --- a/crates/bevy_ecs/src/storage/table/mod.rs +++ b/crates/bevy_ecs/src/storage/table/mod.rs @@ -597,7 +597,7 @@ impl Table { #[inline] pub fn entity_count(&self) -> u32 { // No entity may have more than one table row, so there are no duplicates, - // and there may only ever be u32::MAX entities, so the length never exceeds u32's cappacity. + // and there may only ever be u32::MAX entities, so the length never exceeds u32's capacity. self.entities.len() as u32 } diff --git a/crates/bevy_light/src/lib.rs b/crates/bevy_light/src/lib.rs index cf7e19ed81..655171da63 100644 --- a/crates/bevy_light/src/lib.rs +++ b/crates/bevy_light/src/lib.rs @@ -27,7 +27,7 @@ use cluster::{ mod ambient_light; pub use ambient_light::AmbientLight; mod probe; -pub use probe::{EnvironmentMapLight, LightProbe}; +pub use probe::{EnvironmentMapLight, IrradianceVolume, LightProbe}; mod volumetric; pub use volumetric::{FogVolume, VolumetricFog, VolumetricLight}; pub mod cascade; @@ -121,6 +121,7 @@ impl Plugin for LightPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::() diff --git a/crates/bevy_light/src/probe.rs b/crates/bevy_light/src/probe.rs index 7cd7e2f634..5683daa562 100644 --- a/crates/bevy_light/src/probe.rs +++ b/crates/bevy_light/src/probe.rs @@ -107,3 +107,50 @@ impl Default for EnvironmentMapLight { } } } + +/// The component that defines an irradiance volume. +/// +/// See `bevy_pbr::irradiance_volume` for detailed information. +/// +/// This component requires the [`LightProbe`] component, and is typically used with +/// [`bevy_transform::components::Transform`] to place the volume appropriately. +#[derive(Clone, Reflect, Component, Debug)] +#[reflect(Component, Default, Debug, Clone)] +#[require(LightProbe)] +pub struct IrradianceVolume { + /// The 3D texture that represents the ambient cubes, encoded in the format + /// described in `bevy_pbr::irradiance_volume`. + pub voxels: Handle, + + /// Scale factor applied to the diffuse and specular light generated by this component. + /// + /// After applying this multiplier, the resulting values should + /// be in units of [cd/m^2](https://en.wikipedia.org/wiki/Candela_per_square_metre). + /// + /// See also . + pub intensity: f32, + + /// Whether the light from this irradiance volume has an effect on meshes + /// with lightmaps. + /// + /// Set this to false if your lightmap baking tool bakes the light from this + /// irradiance volume into the lightmaps in order to avoid counting the + /// irradiance twice. Frequently, applications use irradiance volumes as a + /// lower-quality alternative to lightmaps for capturing indirect + /// illumination on dynamic objects, and such applications will want to set + /// this value to false. + /// + /// By default, this is set to true. + pub affects_lightmapped_meshes: bool, +} + +impl Default for IrradianceVolume { + #[inline] + fn default() -> Self { + IrradianceVolume { + voxels: Handle::default(), + intensity: 0.0, + affects_lightmapped_meshes: true, + } + } +} diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 994cb72b25..45aa6297d2 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -51,9 +51,9 @@ use bevy_light::SimulationLightSystems; pub use bevy_light::{ light_consts, AmbientLight, CascadeShadowConfig, CascadeShadowConfigBuilder, Cascades, ClusteredDecal, DirectionalLight, DirectionalLightShadowMap, DirectionalLightTexture, - FogVolume, LightPlugin, LightProbe, NotShadowCaster, NotShadowReceiver, PointLight, - PointLightShadowMap, PointLightTexture, ShadowFilteringMethod, SpotLight, SpotLightTexture, - TransmittedShadowReceiver, VolumetricFog, VolumetricLight, + FogVolume, IrradianceVolume, LightPlugin, LightProbe, NotShadowCaster, NotShadowReceiver, + PointLight, PointLightShadowMap, PointLightTexture, ShadowFilteringMethod, SpotLight, + SpotLightTexture, TransmittedShadowReceiver, VolumetricFog, VolumetricLight, }; pub use cluster::*; pub use components::*; diff --git a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs index 49fa9185d3..95ed8dcbd9 100644 --- a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs +++ b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs @@ -133,9 +133,8 @@ //! //! [Why ambient cubes?]: #why-ambient-cubes -use bevy_ecs::{component::Component, reflect::ReflectComponent}; use bevy_image::Image; -use bevy_light::LightProbe; +pub use bevy_light::IrradianceVolume; use bevy_render::{ render_asset::RenderAssets, render_resource::{ @@ -145,11 +144,9 @@ use bevy_render::{ renderer::{RenderAdapter, RenderDevice}, texture::{FallbackImage, GpuImage}, }; -use bevy_utils::default; use core::{num::NonZero, ops::Deref}; -use bevy_asset::{AssetId, Handle}; -use bevy_reflect::{std_traits::ReflectDefault, Reflect}; +use bevy_asset::AssetId; use crate::{ add_cubemap_texture_view, binding_arrays_are_usable, RenderViewLightProbes, @@ -163,53 +160,6 @@ use super::LightProbeComponent; /// (see issue #11885). pub(crate) const IRRADIANCE_VOLUMES_ARE_USABLE: bool = cfg!(not(target_arch = "wasm32")); -/// The component that defines an irradiance volume. -/// -/// See [`crate::irradiance_volume`] for detailed information. -/// -/// This component requires the [`LightProbe`] component, and is typically used with -/// [`bevy_transform::components::Transform`] to place the volume appropriately. -#[derive(Clone, Reflect, Component, Debug)] -#[reflect(Component, Default, Debug, Clone)] -#[require(LightProbe)] -pub struct IrradianceVolume { - /// The 3D texture that represents the ambient cubes, encoded in the format - /// described in [`crate::irradiance_volume`]. - pub voxels: Handle, - - /// Scale factor applied to the diffuse and specular light generated by this component. - /// - /// After applying this multiplier, the resulting values should - /// be in units of [cd/m^2](https://en.wikipedia.org/wiki/Candela_per_square_metre). - /// - /// See also . - pub intensity: f32, - - /// Whether the light from this irradiance volume has an effect on meshes - /// with lightmaps. - /// - /// Set this to false if your lightmap baking tool bakes the light from this - /// irradiance volume into the lightmaps in order to avoid counting the - /// irradiance twice. Frequently, applications use irradiance volumes as a - /// lower-quality alternative to lightmaps for capturing indirect - /// illumination on dynamic objects, and such applications will want to set - /// this value to false. - /// - /// By default, this is set to true. - pub affects_lightmapped_meshes: bool, -} - -impl Default for IrradianceVolume { - #[inline] - fn default() -> Self { - IrradianceVolume { - voxels: default(), - intensity: 0.0, - affects_lightmapped_meshes: true, - } - } -} - /// All the bind group entries necessary for PBR shaders to access the /// irradiance volumes exposed to a view. pub(crate) enum RenderViewIrradianceVolumeBindGroupEntries<'a> { diff --git a/crates/bevy_pbr/src/light_probe/mod.rs b/crates/bevy_pbr/src/light_probe/mod.rs index 2884c86a2f..bce844bb21 100644 --- a/crates/bevy_pbr/src/light_probe/mod.rs +++ b/crates/bevy_pbr/src/light_probe/mod.rs @@ -288,8 +288,7 @@ impl Plugin for LightProbePlugin { load_shader_library!(app, "environment_map.wgsl"); load_shader_library!(app, "irradiance_volume.wgsl"); - app.register_type::() - .add_plugins(ExtractInstancesPlugin::::new()); + app.add_plugins(ExtractInstancesPlugin::::new()); } fn finish(&self, app: &mut App) { diff --git a/crates/bevy_picking/src/hover.rs b/crates/bevy_picking/src/hover.rs index dbb6ee942e..f675568394 100644 --- a/crates/bevy_picking/src/hover.rs +++ b/crates/bevy_picking/src/hover.rs @@ -344,7 +344,7 @@ pub fn update_is_hovered( } // Algorithm: for each entity having a `Hovered` component, we want to know if the current - // entry in the hover map is "within" (that is, in the set of descenants of) that entity. Rather + // entry in the hover map is "within" (that is, in the set of descendants of) that entity. Rather // than doing an expensive breadth-first traversal of children, instead start with the hovermap // entry and search upwards. We can make this even cheaper by building a set of ancestors for // the hovermap entry, and then testing each `Hovered` entity against that set. diff --git a/crates/bevy_reflect/src/kind.rs b/crates/bevy_reflect/src/kind.rs index 8988b30aa5..e8a2310b0f 100644 --- a/crates/bevy_reflect/src/kind.rs +++ b/crates/bevy_reflect/src/kind.rs @@ -215,7 +215,7 @@ pub enum ReflectRef<'a> { /// [function-like]: Function #[cfg(feature = "functions")] Function(&'a dyn Function), - /// An immutable refeence to an [opaque] type. + /// An immutable reference to an [opaque] type. /// /// [opaque]: ReflectKind::Opaque Opaque(&'a dyn PartialReflect), @@ -281,7 +281,7 @@ pub enum ReflectMut<'a> { /// /// [function-like]: Function Function(&'a mut dyn Function), - /// A mutable refeence to an [opaque] type. + /// A mutable reference to an [opaque] type. /// /// [opaque]: ReflectKind::Opaque Opaque(&'a mut dyn PartialReflect), diff --git a/crates/bevy_utils/src/debug_info.rs b/crates/bevy_utils/src/debug_info.rs index 292b77d352..71ce96ea00 100644 --- a/crates/bevy_utils/src/debug_info.rs +++ b/crates/bevy_utils/src/debug_info.rs @@ -79,7 +79,7 @@ impl DebugName { } } - /// Get the [`ShortName`] corresping to this debug name + /// Get the [`ShortName`] corresponding to this debug name /// /// The value will be a static string if the `debug` feature is not enabled pub fn shortname(&self) -> ShortName {