Remove all deprecated
code (#16338)
# Objective Release cycle things ## Solution Delete items deprecated in 0.15 and migrate bevy itself. ## Testing CI
This commit is contained in:
parent
1e03f2a7c1
commit
7112d5594e
@ -939,13 +939,6 @@ impl AnimationPlayer {
|
|||||||
pub fn animation_mut(&mut self, animation: AnimationNodeIndex) -> Option<&mut ActiveAnimation> {
|
pub fn animation_mut(&mut self, animation: AnimationNodeIndex) -> Option<&mut ActiveAnimation> {
|
||||||
self.active_animations.get_mut(&animation)
|
self.active_animations.get_mut(&animation)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `is_playing_animation` instead"]
|
|
||||||
/// Returns true if the animation is currently playing or paused, or false
|
|
||||||
/// if the animation is stopped.
|
|
||||||
pub fn animation_is_playing(&self, animation: AnimationNodeIndex) -> bool {
|
|
||||||
self.active_animations.contains_key(&animation)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A system that triggers untargeted animation events for the currently-playing animations.
|
/// A system that triggers untargeted animation events for the currently-playing animations.
|
||||||
|
@ -105,26 +105,6 @@ impl<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A flexible [`Process`] implementation that loads the source [`Asset`] using the `L` [`AssetLoader`], then
|
|
||||||
/// saves that `L` asset using the `S` [`AssetSaver`].
|
|
||||||
///
|
|
||||||
/// This is a specialized use case of [`LoadTransformAndSave`] and is useful where there is no asset manipulation
|
|
||||||
/// such as when compressing assets.
|
|
||||||
///
|
|
||||||
/// This uses [`LoadAndSaveSettings`] to configure the processor.
|
|
||||||
///
|
|
||||||
/// [`Asset`]: crate::Asset
|
|
||||||
#[deprecated = "Use `LoadTransformAndSave<L, IdentityAssetTransformer<<L as AssetLoader>::Asset>, S>` instead"]
|
|
||||||
pub type LoadAndSave<L, S> =
|
|
||||||
LoadTransformAndSave<L, IdentityAssetTransformer<<L as AssetLoader>::Asset>, S>;
|
|
||||||
|
|
||||||
/// Settings for the [`LoadAndSave`] [`Process::Settings`] implementation.
|
|
||||||
///
|
|
||||||
/// `LoaderSettings` corresponds to [`AssetLoader::Settings`] and `SaverSettings` corresponds to [`AssetSaver::Settings`].
|
|
||||||
#[deprecated = "Use `LoadTransformAndSaveSettings<LoaderSettings, (), SaverSettings>` instead"]
|
|
||||||
pub type LoadAndSaveSettings<LoaderSettings, SaverSettings> =
|
|
||||||
LoadTransformAndSaveSettings<LoaderSettings, (), SaverSettings>;
|
|
||||||
|
|
||||||
/// An error that is encountered during [`Process::process`].
|
/// An error that is encountered during [`Process::process`].
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum ProcessError {
|
pub enum ProcessError {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{AudioSource, Decodable, Volume};
|
use crate::{AudioSource, Decodable, Volume};
|
||||||
use bevy_asset::{Asset, Handle};
|
use bevy_asset::{Asset, Handle};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
@ -207,13 +205,6 @@ impl Default for SpatialScale {
|
|||||||
#[reflect(Resource, Default)]
|
#[reflect(Resource, Default)]
|
||||||
pub struct DefaultSpatialScale(pub SpatialScale);
|
pub struct DefaultSpatialScale(pub SpatialScale);
|
||||||
|
|
||||||
/// Bundle for playing a standard bevy audio asset
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `AudioPlayer` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically."
|
|
||||||
)]
|
|
||||||
pub type AudioBundle = AudioSourceBundle<AudioSource>;
|
|
||||||
|
|
||||||
/// A component for playing a sound.
|
/// A component for playing a sound.
|
||||||
///
|
///
|
||||||
/// Insert this component onto an entity to trigger an audio source to begin playing.
|
/// Insert this component onto an entity to trigger an audio source to begin playing.
|
||||||
@ -252,48 +243,3 @@ impl AudioPlayer<AudioSource> {
|
|||||||
Self(source)
|
Self(source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bundle for playing a sound.
|
|
||||||
///
|
|
||||||
/// Insert this bundle onto an entity to trigger a sound source to begin playing.
|
|
||||||
///
|
|
||||||
/// If the handle refers to an unavailable asset (such as if it has not finished loading yet),
|
|
||||||
/// the audio will not begin playing immediately. The audio will play when the asset is ready.
|
|
||||||
///
|
|
||||||
/// When Bevy begins the audio playback, an [`AudioSink`][crate::AudioSink] component will be
|
|
||||||
/// added to the entity. You can use that component to control the audio settings during playback.
|
|
||||||
#[derive(Bundle)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `AudioPlayer` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically."
|
|
||||||
)]
|
|
||||||
pub struct AudioSourceBundle<Source = AudioSource>
|
|
||||||
where
|
|
||||||
Source: Asset + Decodable,
|
|
||||||
{
|
|
||||||
/// Asset containing the audio data to play.
|
|
||||||
pub source: AudioPlayer<Source>,
|
|
||||||
/// Initial settings that the audio starts playing with.
|
|
||||||
/// If you would like to control the audio while it is playing,
|
|
||||||
/// query for the [`AudioSink`][crate::AudioSink] component.
|
|
||||||
/// Changes to this component will *not* be applied to already-playing audio.
|
|
||||||
pub settings: PlaybackSettings,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Asset + Decodable> Clone for AudioSourceBundle<T> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
Self {
|
|
||||||
source: self.source.clone(),
|
|
||||||
settings: self.settings,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Decodable + Asset> Default for AudioSourceBundle<T> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
source: AudioPlayer(Handle::default()),
|
|
||||||
settings: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -39,13 +39,11 @@ mod volume;
|
|||||||
/// The audio prelude.
|
/// The audio prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
AudioBundle, AudioPlayer, AudioSink, AudioSinkPlayback, AudioSource, AudioSourceBundle,
|
AudioPlayer, AudioSink, AudioSinkPlayback, AudioSource, Decodable, GlobalVolume, Pitch,
|
||||||
Decodable, GlobalVolume, Pitch, PitchBundle, PlaybackSettings, SpatialAudioSink,
|
PlaybackSettings, SpatialAudioSink, SpatialListener,
|
||||||
SpatialListener,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#![expect(deprecated)]
|
use crate::Decodable;
|
||||||
|
|
||||||
use crate::{AudioSourceBundle, Decodable};
|
|
||||||
use bevy_asset::Asset;
|
use bevy_asset::Asset;
|
||||||
use bevy_reflect::TypePath;
|
use bevy_reflect::TypePath;
|
||||||
use rodio::{
|
use rodio::{
|
||||||
@ -35,10 +33,3 @@ impl Decodable for Pitch {
|
|||||||
SineWave::new(self.frequency).take_duration(self.duration)
|
SineWave::new(self.frequency).take_duration(self.duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bundle for playing a bevy note sound
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `AudioPlayer<Pitch>` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically."
|
|
||||||
)]
|
|
||||||
pub type PitchBundle = AudioSourceBundle<Pitch>;
|
|
||||||
|
@ -84,12 +84,6 @@ impl Color {
|
|||||||
(*self).into()
|
(*self).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `Color::srgba` instead"]
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color.
|
|
||||||
pub const fn rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
|
||||||
Self::srgba(red, green, blue, alpha)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color.
|
/// Creates a new [`Color`] object storing a [`Srgba`] color.
|
||||||
pub const fn srgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
pub const fn srgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
||||||
Self::Srgba(Srgba {
|
Self::Srgba(Srgba {
|
||||||
@ -100,12 +94,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `Color::srgb` instead"]
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
|
||||||
pub const fn rgb(red: f32, green: f32, blue: f32) -> Self {
|
|
||||||
Self::srgb(red, green, blue)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
/// Creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
||||||
pub const fn srgb(red: f32, green: f32, blue: f32) -> Self {
|
pub const fn srgb(red: f32, green: f32, blue: f32) -> Self {
|
||||||
Self::Srgba(Srgba {
|
Self::Srgba(Srgba {
|
||||||
@ -116,12 +104,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `Color::srgb_from_array` instead"]
|
|
||||||
/// Reads an array of floats to creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
|
||||||
pub fn rgb_from_array([r, g, b]: [f32; 3]) -> Self {
|
|
||||||
Self::Srgba(Srgba::rgb(r, g, b))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Reads an array of floats to creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
/// Reads an array of floats to creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0.
|
||||||
pub const fn srgb_from_array(array: [f32; 3]) -> Self {
|
pub const fn srgb_from_array(array: [f32; 3]) -> Self {
|
||||||
Self::Srgba(Srgba {
|
Self::Srgba(Srgba {
|
||||||
@ -132,14 +114,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `Color::srgba_u8` instead"]
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values.
|
|
||||||
///
|
|
||||||
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
|
||||||
pub fn rgba_u8(red: u8, green: u8, blue: u8, alpha: u8) -> Self {
|
|
||||||
Self::srgba_u8(red, green, blue, alpha)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values.
|
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values.
|
||||||
///
|
///
|
||||||
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
||||||
@ -152,14 +126,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use `Color::srgb_u8` instead"]
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values with an alpha of 1.0.
|
|
||||||
///
|
|
||||||
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
|
||||||
pub fn rgb_u8(red: u8, green: u8, blue: u8) -> Self {
|
|
||||||
Self::srgb_u8(red, green, blue)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values with an alpha of 1.0.
|
/// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values with an alpha of 1.0.
|
||||||
///
|
///
|
||||||
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
/// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0.
|
||||||
@ -172,12 +138,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use Color::linear_rgba instead."]
|
|
||||||
/// Creates a new [`Color`] object storing a [`LinearRgba`] color.
|
|
||||||
pub const fn rbga_linear(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
|
||||||
Self::linear_rgba(red, green, blue, alpha)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`LinearRgba`] color.
|
/// Creates a new [`Color`] object storing a [`LinearRgba`] color.
|
||||||
pub const fn linear_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
pub const fn linear_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
|
||||||
Self::LinearRgba(LinearRgba {
|
Self::LinearRgba(LinearRgba {
|
||||||
@ -188,12 +148,6 @@ impl Color {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "Use Color::linear_rgb instead."]
|
|
||||||
/// Creates a new [`Color`] object storing a [`LinearRgba`] color with an alpha of 1.0.
|
|
||||||
pub const fn rgb_linear(red: f32, green: f32, blue: f32) -> Self {
|
|
||||||
Self::linear_rgb(red, green, blue)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Color`] object storing a [`LinearRgba`] color with an alpha of 1.0.
|
/// Creates a new [`Color`] object storing a [`LinearRgba`] color with an alpha of 1.0.
|
||||||
pub const fn linear_rgb(red: f32, green: f32, blue: f32) -> Self {
|
pub const fn linear_rgb(red: f32, green: f32, blue: f32) -> Self {
|
||||||
Self::LinearRgba(LinearRgba {
|
Self::LinearRgba(LinearRgba {
|
||||||
|
@ -24,8 +24,7 @@ use node::AutoExposureNode;
|
|||||||
use pipeline::{
|
use pipeline::{
|
||||||
AutoExposurePass, AutoExposurePipeline, ViewAutoExposurePipeline, METERING_SHADER_HANDLE,
|
AutoExposurePass, AutoExposurePipeline, ViewAutoExposurePipeline, METERING_SHADER_HANDLE,
|
||||||
};
|
};
|
||||||
#[allow(deprecated)]
|
pub use settings::AutoExposure;
|
||||||
pub use settings::{AutoExposure, AutoExposureSettings};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
auto_exposure::compensation_curve::GpuAutoExposureCompensationCurve,
|
auto_exposure::compensation_curve::GpuAutoExposureCompensationCurve,
|
||||||
|
@ -88,9 +88,6 @@ pub struct AutoExposure {
|
|||||||
pub compensation_curve: Handle<AutoExposureCompensationCurve>,
|
pub compensation_curve: Handle<AutoExposureCompensationCurve>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `AutoExposure`")]
|
|
||||||
pub type AutoExposureSettings = AutoExposure;
|
|
||||||
|
|
||||||
impl Default for AutoExposure {
|
impl Default for AutoExposure {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -3,10 +3,7 @@ mod settings;
|
|||||||
mod upsampling_pipeline;
|
mod upsampling_pipeline;
|
||||||
|
|
||||||
use bevy_color::{Gray, LinearRgba};
|
use bevy_color::{Gray, LinearRgba};
|
||||||
#[allow(deprecated)]
|
pub use settings::{Bloom, BloomCompositeMode, BloomPrefilter};
|
||||||
pub use settings::{
|
|
||||||
Bloom, BloomCompositeMode, BloomPrefilter, BloomPrefilterSettings, BloomSettings,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core_2d::graph::{Core2d, Node2d},
|
core_2d::graph::{Core2d, Node2d},
|
||||||
|
@ -118,9 +118,6 @@ pub struct Bloom {
|
|||||||
pub uv_offset: f32,
|
pub uv_offset: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `Bloom`")]
|
|
||||||
pub type BloomSettings = Bloom;
|
|
||||||
|
|
||||||
impl Bloom {
|
impl Bloom {
|
||||||
const DEFAULT_MAX_MIP_DIMENSION: u32 = 512;
|
const DEFAULT_MAX_MIP_DIMENSION: u32 = 512;
|
||||||
const DEFAULT_UV_OFFSET: f32 = 0.004;
|
const DEFAULT_UV_OFFSET: f32 = 0.004;
|
||||||
@ -203,9 +200,6 @@ pub struct BloomPrefilter {
|
|||||||
pub threshold_softness: f32,
|
pub threshold_softness: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `BloomPrefilter`")]
|
|
||||||
pub type BloomPrefilterSettings = BloomPrefilter;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, Copy)]
|
#[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, Copy)]
|
||||||
pub enum BloomCompositeMode {
|
pub enum BloomCompositeMode {
|
||||||
EnergyConserving,
|
EnergyConserving,
|
||||||
|
@ -54,9 +54,6 @@ pub struct ContrastAdaptiveSharpening {
|
|||||||
pub denoise: bool,
|
pub denoise: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `ContrastAdaptiveSharpening`")]
|
|
||||||
pub type ContrastAdaptiveSharpeningSettings = ContrastAdaptiveSharpening;
|
|
||||||
|
|
||||||
impl Default for ContrastAdaptiveSharpening {
|
impl Default for ContrastAdaptiveSharpening {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ContrastAdaptiveSharpening {
|
ContrastAdaptiveSharpening {
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core_2d::graph::Core2d,
|
core_2d::graph::Core2d,
|
||||||
tonemapping::{DebandDither, Tonemapping},
|
tonemapping::{DebandDither, Tonemapping},
|
||||||
};
|
};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::sync_world::SyncToRenderWorld;
|
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::{
|
camera::{
|
||||||
Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph,
|
Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph,
|
||||||
OrthographicProjection, Projection,
|
OrthographicProjection, Projection,
|
||||||
},
|
},
|
||||||
extract_component::ExtractComponent,
|
extract_component::ExtractComponent,
|
||||||
prelude::Msaa,
|
|
||||||
primitives::Frustum,
|
primitives::Frustum,
|
||||||
view::VisibleEntities,
|
sync_world::SyncToRenderWorld,
|
||||||
|
view::{Msaa, VisibleEntities},
|
||||||
};
|
};
|
||||||
use bevy_transform::prelude::{GlobalTransform, Transform};
|
use bevy_transform::prelude::{GlobalTransform, Transform};
|
||||||
|
|
||||||
@ -34,10 +31,6 @@ use bevy_transform::prelude::{GlobalTransform, Transform};
|
|||||||
pub struct Camera2d;
|
pub struct Camera2d;
|
||||||
|
|
||||||
#[derive(Bundle, Clone)]
|
#[derive(Bundle, Clone)]
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Camera2d` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct Camera2dBundle {
|
pub struct Camera2dBundle {
|
||||||
pub camera: Camera,
|
pub camera: Camera,
|
||||||
pub camera_render_graph: CameraRenderGraph,
|
pub camera_render_graph: CameraRenderGraph,
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core_3d::graph::Core3d,
|
core_3d::graph::Core3d,
|
||||||
tonemapping::{DebandDither, Tonemapping},
|
tonemapping::{DebandDither, Tonemapping},
|
||||||
@ -7,14 +5,11 @@ use crate::{
|
|||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect, ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect, ReflectDeserialize, ReflectSerialize};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::{Camera, CameraMainTextureUsages, CameraRenderGraph, Exposure, Projection},
|
camera::{Camera, CameraRenderGraph, Exposure, Projection},
|
||||||
extract_component::ExtractComponent,
|
extract_component::ExtractComponent,
|
||||||
primitives::Frustum,
|
|
||||||
render_resource::{LoadOp, TextureUsages},
|
render_resource::{LoadOp, TextureUsages},
|
||||||
sync_world::SyncToRenderWorld,
|
view::ColorGrading,
|
||||||
view::{ColorGrading, Msaa, VisibleEntities},
|
|
||||||
};
|
};
|
||||||
use bevy_transform::prelude::{GlobalTransform, Transform};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// A 3D camera component. Enables the main 3D render graph for a [`Camera`].
|
/// A 3D camera component. Enables the main 3D render graph for a [`Camera`].
|
||||||
@ -147,52 +142,3 @@ pub enum ScreenSpaceTransmissionQuality {
|
|||||||
/// `num_taps` = 32
|
/// `num_taps` = 32
|
||||||
Ultra,
|
Ultra,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The camera coordinate space is right-handed x-right, y-up, z-back.
|
|
||||||
/// This means "forward" is -Z.
|
|
||||||
#[derive(Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Camera3d` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct Camera3dBundle {
|
|
||||||
pub camera: Camera,
|
|
||||||
pub camera_render_graph: CameraRenderGraph,
|
|
||||||
pub projection: Projection,
|
|
||||||
pub visible_entities: VisibleEntities,
|
|
||||||
pub frustum: Frustum,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
pub camera_3d: Camera3d,
|
|
||||||
pub tonemapping: Tonemapping,
|
|
||||||
pub deband_dither: DebandDither,
|
|
||||||
pub color_grading: ColorGrading,
|
|
||||||
pub exposure: Exposure,
|
|
||||||
pub main_texture_usages: CameraMainTextureUsages,
|
|
||||||
pub msaa: Msaa,
|
|
||||||
/// Marker component that indicates that its entity needs to be synchronized to the render world
|
|
||||||
pub sync: SyncToRenderWorld,
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: ideally Perspective and Orthographic defaults can share the same impl, but sadly it breaks rust's type inference
|
|
||||||
impl Default for Camera3dBundle {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
camera_render_graph: CameraRenderGraph::new(Core3d),
|
|
||||||
camera: Default::default(),
|
|
||||||
projection: Default::default(),
|
|
||||||
visible_entities: Default::default(),
|
|
||||||
frustum: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
camera_3d: Default::default(),
|
|
||||||
tonemapping: Default::default(),
|
|
||||||
color_grading: Default::default(),
|
|
||||||
exposure: Default::default(),
|
|
||||||
main_texture_usages: Default::default(),
|
|
||||||
deband_dither: DebandDither::Enabled,
|
|
||||||
msaa: Default::default(),
|
|
||||||
sync: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -119,9 +119,6 @@ pub struct DepthOfField {
|
|||||||
pub max_depth: f32,
|
pub max_depth: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `DepthOfField`")]
|
|
||||||
pub type DepthOfFieldSettings = DepthOfField;
|
|
||||||
|
|
||||||
/// Controls the appearance of the effect.
|
/// Controls the appearance of the effect.
|
||||||
#[derive(Clone, Copy, Default, PartialEq, Debug, Reflect)]
|
#[derive(Clone, Copy, Default, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(Default, PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
|
@ -33,11 +33,9 @@ pub use skybox::Skybox;
|
|||||||
///
|
///
|
||||||
/// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes.
|
/// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes.
|
||||||
pub mod experimental {
|
pub mod experimental {
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod taa {
|
pub mod taa {
|
||||||
pub use crate::taa::{
|
pub use crate::taa::{
|
||||||
TemporalAntiAliasBundle, TemporalAntiAliasNode, TemporalAntiAliasPlugin,
|
TemporalAntiAliasNode, TemporalAntiAliasPlugin, TemporalAntiAliasing,
|
||||||
TemporalAntiAliasSettings, TemporalAntiAliasing,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,13 +43,9 @@ pub mod experimental {
|
|||||||
/// The core pipeline prelude.
|
/// The core pipeline prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{core_2d::Camera2d, core_3d::Camera3d};
|
||||||
core_2d::{Camera2d, Camera2dBundle},
|
|
||||||
core_3d::{Camera3d, Camera3dBundle},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! Add the [`MotionBlur`] component to a camera to enable motion blur.
|
//! Add the [`MotionBlur`] component to a camera to enable motion blur.
|
||||||
|
|
||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core_3d::graph::{Core3d, Node3d},
|
core_3d::graph::{Core3d, Node3d},
|
||||||
prepass::{DepthPrepass, MotionVectorPrepass},
|
prepass::{DepthPrepass, MotionVectorPrepass},
|
||||||
@ -11,7 +9,6 @@ use crate::{
|
|||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, Handle};
|
use bevy_asset::{load_internal_asset, Handle};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
bundle::Bundle,
|
|
||||||
component::{require, Component},
|
component::{require, Component},
|
||||||
query::With,
|
query::With,
|
||||||
reflect::ReflectComponent,
|
reflect::ReflectComponent,
|
||||||
@ -29,18 +26,6 @@ use bevy_render::{
|
|||||||
pub mod node;
|
pub mod node;
|
||||||
pub mod pipeline;
|
pub mod pipeline;
|
||||||
|
|
||||||
/// Adds [`MotionBlur`] and the required depth and motion vector prepasses to a camera entity.
|
|
||||||
#[derive(Bundle, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `MotionBlur` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct MotionBlurBundle {
|
|
||||||
pub motion_blur: MotionBlur,
|
|
||||||
pub depth_prepass: DepthPrepass,
|
|
||||||
pub motion_vector_prepass: MotionVectorPrepass,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A component that enables and configures motion blur when added to a camera.
|
/// A component that enables and configures motion blur when added to a camera.
|
||||||
///
|
///
|
||||||
/// Motion blur is an effect that simulates how moving objects blur as they change position during
|
/// Motion blur is an effect that simulates how moving objects blur as they change position during
|
||||||
|
@ -101,9 +101,6 @@ pub struct Smaa {
|
|||||||
pub preset: SmaaPreset,
|
pub preset: SmaaPreset,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `Smaa`")]
|
|
||||||
pub type SmaaSettings = Smaa;
|
|
||||||
|
|
||||||
/// A preset quality level for SMAA.
|
/// A preset quality level for SMAA.
|
||||||
///
|
///
|
||||||
/// Higher values are slower but result in a higher-quality image.
|
/// Higher values are slower but result in a higher-quality image.
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core_3d::graph::{Core3d, Node3d},
|
core_3d::graph::{Core3d, Node3d},
|
||||||
fullscreen_vertex_shader::fullscreen_shader_vertex_state,
|
fullscreen_vertex_shader::fullscreen_shader_vertex_state,
|
||||||
@ -10,7 +8,7 @@ use bevy_app::{App, Plugin};
|
|||||||
use bevy_asset::{load_internal_asset, Handle};
|
use bevy_asset::{load_internal_asset, Handle};
|
||||||
use bevy_diagnostic::FrameCount;
|
use bevy_diagnostic::FrameCount;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::{require, Bundle, Component, Entity, ReflectComponent},
|
prelude::{require, Component, Entity, ReflectComponent},
|
||||||
query::{QueryItem, With},
|
query::{QueryItem, With},
|
||||||
schedule::IntoSystemConfigs,
|
schedule::IntoSystemConfigs,
|
||||||
system::{Commands, Query, Res, ResMut, Resource},
|
system::{Commands, Query, Res, ResMut, Resource},
|
||||||
@ -92,19 +90,6 @@ impl Plugin for TemporalAntiAliasPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bundle to apply temporal anti-aliasing.
|
|
||||||
#[derive(Bundle, Default, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `TemporalAntiAlias` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct TemporalAntiAliasBundle {
|
|
||||||
pub settings: TemporalAntiAliasing,
|
|
||||||
pub jitter: TemporalJitter,
|
|
||||||
pub depth_prepass: DepthPrepass,
|
|
||||||
pub motion_vector_prepass: MotionVectorPrepass,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Component to apply temporal anti-aliasing to a 3D perspective camera.
|
/// Component to apply temporal anti-aliasing to a 3D perspective camera.
|
||||||
///
|
///
|
||||||
/// Temporal anti-aliasing (TAA) is a form of image smoothing/filtering, like
|
/// Temporal anti-aliasing (TAA) is a form of image smoothing/filtering, like
|
||||||
@ -159,9 +144,6 @@ pub struct TemporalAntiAliasing {
|
|||||||
pub reset: bool,
|
pub reset: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `TemporalAntiAliasing`")]
|
|
||||||
pub type TemporalAntiAliasSettings = TemporalAntiAliasing;
|
|
||||||
|
|
||||||
impl Default for TemporalAntiAliasing {
|
impl Default for TemporalAntiAliasing {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self { reset: true }
|
Self { reset: true }
|
||||||
|
@ -81,7 +81,6 @@ impl<'w, D: QueryData, F: QueryFilter> QueryBuilder<'w, D, F> {
|
|||||||
.is_some_and(|info| info.storage_type() == StorageType::Table)
|
.is_some_and(|info| info.storage_type() == StorageType::Table)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
let (mut component_reads_and_writes, component_reads_and_writes_inverted) =
|
let (mut component_reads_and_writes, component_reads_and_writes_inverted) =
|
||||||
self.access.access().component_reads_and_writes();
|
self.access.access().component_reads_and_writes();
|
||||||
if component_reads_and_writes_inverted {
|
if component_reads_and_writes_inverted {
|
||||||
|
@ -566,7 +566,6 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
|
|||||||
) {
|
) {
|
||||||
// As a fast path, we can iterate directly over the components involved
|
// As a fast path, we can iterate directly over the components involved
|
||||||
// if the `access` isn't inverted.
|
// if the `access` isn't inverted.
|
||||||
#[allow(deprecated)]
|
|
||||||
let (component_reads_and_writes, component_reads_and_writes_inverted) =
|
let (component_reads_and_writes, component_reads_and_writes_inverted) =
|
||||||
self.component_access.access.component_reads_and_writes();
|
self.component_access.access.component_reads_and_writes();
|
||||||
let (component_writes, component_writes_inverted) =
|
let (component_writes, component_writes_inverted) =
|
||||||
|
@ -315,38 +315,6 @@ impl<'w, 's> Commands<'w, 's> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pushes a [`Command`] to the queue for creating a new [`Entity`] if the given one does not exists,
|
|
||||||
/// and returns its corresponding [`EntityCommands`].
|
|
||||||
///
|
|
||||||
/// This method silently fails by returning [`EntityCommands`]
|
|
||||||
/// even if the given `Entity` cannot be spawned.
|
|
||||||
///
|
|
||||||
/// See [`World::get_or_spawn`] for more details.
|
|
||||||
///
|
|
||||||
/// # Note
|
|
||||||
///
|
|
||||||
/// Spawning a specific `entity` value is rarely the right choice. Most apps should favor
|
|
||||||
/// [`Commands::spawn`]. This method should generally only be used for sharing entities across
|
|
||||||
/// apps, and only when they have a scheme worked out to share an ID space (which doesn't happen
|
|
||||||
/// by default).
|
|
||||||
#[deprecated(since = "0.15.0", note = "use Commands::spawn instead")]
|
|
||||||
#[track_caller]
|
|
||||||
pub fn get_or_spawn(&mut self, entity: Entity) -> EntityCommands {
|
|
||||||
#[cfg(feature = "track_location")]
|
|
||||||
let caller = Location::caller();
|
|
||||||
self.queue(move |world: &mut World| {
|
|
||||||
world.get_or_spawn_with_caller(
|
|
||||||
entity,
|
|
||||||
#[cfg(feature = "track_location")]
|
|
||||||
caller,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
EntityCommands {
|
|
||||||
entity,
|
|
||||||
commands: self.reborrow(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pushes a [`Command`] to the queue for creating a new entity with the given [`Bundle`]'s components,
|
/// Pushes a [`Command`] to the queue for creating a new entity with the given [`Bundle`]'s components,
|
||||||
/// and returns its corresponding [`EntityCommands`].
|
/// and returns its corresponding [`EntityCommands`].
|
||||||
///
|
///
|
||||||
@ -618,7 +586,7 @@ impl<'w, 's> Commands<'w, 's> {
|
|||||||
/// Then, the `Bundle` is added to the entity.
|
/// Then, the `Bundle` is added to the entity.
|
||||||
///
|
///
|
||||||
/// This method is equivalent to iterating `bundles_iter`,
|
/// This method is equivalent to iterating `bundles_iter`,
|
||||||
/// calling [`get_or_spawn`](Self::get_or_spawn) for each bundle,
|
/// calling [`spawn`](Self::spawn) for each bundle,
|
||||||
/// and passing it to [`insert`](EntityCommands::insert),
|
/// and passing it to [`insert`](EntityCommands::insert),
|
||||||
/// but it is faster due to memory pre-allocation.
|
/// but it is faster due to memory pre-allocation.
|
||||||
///
|
///
|
||||||
|
@ -23,8 +23,6 @@ use crate::{
|
|||||||
///
|
///
|
||||||
/// - The slice and array implementations perform an aliased mutability check
|
/// - The slice and array implementations perform an aliased mutability check
|
||||||
/// in [`WorldEntityFetch::fetch_mut`] that is `O(N^2)`.
|
/// in [`WorldEntityFetch::fetch_mut`] that is `O(N^2)`.
|
||||||
/// - The [`EntityHashSet`] implementation performs no such check as the type
|
|
||||||
/// itself guarantees no duplicates.
|
|
||||||
/// - The single [`Entity`] implementation performs no such check as only one
|
/// - The single [`Entity`] implementation performs no such check as only one
|
||||||
/// reference is returned.
|
/// reference is returned.
|
||||||
///
|
///
|
||||||
|
@ -612,8 +612,6 @@ impl World {
|
|||||||
/// - Pass an [`Entity`] to receive a single [`EntityRef`].
|
/// - Pass an [`Entity`] to receive a single [`EntityRef`].
|
||||||
/// - Pass a slice of [`Entity`]s to receive a [`Vec<EntityRef>`].
|
/// - Pass a slice of [`Entity`]s to receive a [`Vec<EntityRef>`].
|
||||||
/// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityRef`]s.
|
/// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityRef`]s.
|
||||||
/// - Pass a reference to a [`EntityHashSet`] to receive an
|
|
||||||
/// [`EntityHashMap<EntityRef>`](crate::entity::EntityHashMap).
|
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
@ -879,49 +877,6 @@ impl World {
|
|||||||
.filter_map(|id| self.components().get_info(id))
|
.filter_map(|id| self.components().get_info(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an [`EntityWorldMut`] for the given `entity` (if it exists) or spawns one if it doesn't exist.
|
|
||||||
/// This will return [`None`] if the `entity` exists with a different generation.
|
|
||||||
///
|
|
||||||
/// # Note
|
|
||||||
/// Spawning a specific `entity` value is rarely the right choice. Most apps should favor [`World::spawn`].
|
|
||||||
/// This method should generally only be used for sharing entities across apps, and only when they have a
|
|
||||||
/// scheme worked out to share an ID space (which doesn't happen by default).
|
|
||||||
#[inline]
|
|
||||||
#[deprecated(since = "0.15.0", note = "use `World::spawn` instead")]
|
|
||||||
pub fn get_or_spawn(&mut self, entity: Entity) -> Option<EntityWorldMut> {
|
|
||||||
self.get_or_spawn_with_caller(
|
|
||||||
entity,
|
|
||||||
#[cfg(feature = "track_location")]
|
|
||||||
Location::caller(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub(crate) fn get_or_spawn_with_caller(
|
|
||||||
&mut self,
|
|
||||||
entity: Entity,
|
|
||||||
#[cfg(feature = "track_location")] caller: &'static Location,
|
|
||||||
) -> Option<EntityWorldMut> {
|
|
||||||
self.flush();
|
|
||||||
match self.entities.alloc_at_without_replacement(entity) {
|
|
||||||
AllocAtWithoutReplacement::Exists(location) => {
|
|
||||||
// SAFETY: `entity` exists and `location` is that entity's location
|
|
||||||
Some(unsafe { EntityWorldMut::new(self, entity, location) })
|
|
||||||
}
|
|
||||||
AllocAtWithoutReplacement::DidNotExist => {
|
|
||||||
// SAFETY: entity was just allocated
|
|
||||||
Some(unsafe {
|
|
||||||
self.spawn_at_empty_internal(
|
|
||||||
entity,
|
|
||||||
#[cfg(feature = "track_location")]
|
|
||||||
caller,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
AllocAtWithoutReplacement::ExistsWithWrongGeneration => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns [`EntityRef`]s that expose read-only operations for the given
|
/// Returns [`EntityRef`]s that expose read-only operations for the given
|
||||||
/// `entities`, returning [`Err`] if any of the given entities do not exist.
|
/// `entities`, returning [`Err`] if any of the given entities do not exist.
|
||||||
/// Instead of immediately unwrapping the value returned from this function,
|
/// Instead of immediately unwrapping the value returned from this function,
|
||||||
|
@ -80,20 +80,6 @@ fn assert_is_normalized(message: &str, length_squared: f32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A normalized vector pointing in a direction in 2D space
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.14.0",
|
|
||||||
note = "`Direction2d` has been renamed. Please use `Dir2` instead."
|
|
||||||
)]
|
|
||||||
pub type Direction2d = Dir2;
|
|
||||||
|
|
||||||
/// A normalized vector pointing in a direction in 3D space
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.14.0",
|
|
||||||
note = "`Direction3d` has been renamed. Please use `Dir3` instead."
|
|
||||||
)]
|
|
||||||
pub type Direction3d = Dir3;
|
|
||||||
|
|
||||||
/// A normalized vector pointing in a direction in 2D space
|
/// A normalized vector pointing in a direction in 2D space
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||||
|
@ -329,16 +329,6 @@ impl Rot2 {
|
|||||||
self.cos > 0.0 && ops::abs(self.sin) < threshold_angle_sin
|
self.cos > 0.0 && ops::abs(self.sin) < threshold_angle_sin
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle in radians needed to make `self` and `other` coincide.
|
|
||||||
#[inline]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use `angle_to` instead, the semantics of `angle_between` will change in the future."
|
|
||||||
)]
|
|
||||||
pub fn angle_between(self, other: Self) -> f32 {
|
|
||||||
self.angle_to(other)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the angle in radians needed to make `self` and `other` coincide.
|
/// Returns the angle in radians needed to make `self` and `other` coincide.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn angle_to(self, other: Self) -> f32 {
|
pub fn angle_to(self, other: Self) -> f32 {
|
||||||
|
@ -1,214 +0,0 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
CascadeShadowConfig, Cascades, DirectionalLight, Material, MeshMaterial3d, PointLight,
|
|
||||||
SpotLight, StandardMaterial,
|
|
||||||
};
|
|
||||||
use bevy_derive::{Deref, DerefMut};
|
|
||||||
use bevy_ecs::{
|
|
||||||
bundle::Bundle,
|
|
||||||
component::Component,
|
|
||||||
entity::{Entity, EntityHashMap},
|
|
||||||
reflect::ReflectComponent,
|
|
||||||
};
|
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
|
||||||
use bevy_render::sync_world::MainEntity;
|
|
||||||
use bevy_render::{
|
|
||||||
mesh::Mesh3d,
|
|
||||||
primitives::{CascadesFrusta, CubemapFrusta, Frustum},
|
|
||||||
sync_world::SyncToRenderWorld,
|
|
||||||
view::{InheritedVisibility, ViewVisibility, Visibility},
|
|
||||||
};
|
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
/// A component bundle for PBR entities with a [`Mesh3d`] and a [`MeshMaterial3d<StandardMaterial>`].
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub type PbrBundle = MaterialMeshBundle<StandardMaterial>;
|
|
||||||
|
|
||||||
/// A component bundle for entities with a [`Mesh3d`] and a [`MeshMaterial3d`].
|
|
||||||
#[derive(Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub struct MaterialMeshBundle<M: Material> {
|
|
||||||
pub mesh: Mesh3d,
|
|
||||||
pub material: MeshMaterial3d<M>,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// User indication of whether an entity is visible
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<M: Material> Default for MaterialMeshBundle<M> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
mesh: Default::default(),
|
|
||||||
material: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
inherited_visibility: Default::default(),
|
|
||||||
view_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Collection of mesh entities visible for 3D lighting.
|
|
||||||
///
|
|
||||||
/// This component contains all mesh entities visible from the current light view.
|
|
||||||
/// The collection is updated automatically by [`crate::SimulationLightSystems`].
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)]
|
|
||||||
#[reflect(Component, Debug, Default)]
|
|
||||||
pub struct VisibleMeshEntities {
|
|
||||||
#[reflect(ignore)]
|
|
||||||
pub entities: Vec<Entity>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)]
|
|
||||||
#[reflect(Component, Debug, Default)]
|
|
||||||
pub struct RenderVisibleMeshEntities {
|
|
||||||
#[reflect(ignore)]
|
|
||||||
pub entities: Vec<(Entity, MainEntity)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect)]
|
|
||||||
#[reflect(Component, Debug, Default)]
|
|
||||||
pub struct CubemapVisibleEntities {
|
|
||||||
#[reflect(ignore)]
|
|
||||||
data: [VisibleMeshEntities; 6],
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CubemapVisibleEntities {
|
|
||||||
pub fn get(&self, i: usize) -> &VisibleMeshEntities {
|
|
||||||
&self.data[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_mut(&mut self, i: usize) -> &mut VisibleMeshEntities {
|
|
||||||
&mut self.data[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &VisibleMeshEntities> {
|
|
||||||
self.data.iter()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut VisibleMeshEntities> {
|
|
||||||
self.data.iter_mut()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect)]
|
|
||||||
#[reflect(Component, Debug, Default)]
|
|
||||||
pub struct RenderCubemapVisibleEntities {
|
|
||||||
#[reflect(ignore)]
|
|
||||||
pub(crate) data: [RenderVisibleMeshEntities; 6],
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RenderCubemapVisibleEntities {
|
|
||||||
pub fn get(&self, i: usize) -> &RenderVisibleMeshEntities {
|
|
||||||
&self.data[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_mut(&mut self, i: usize) -> &mut RenderVisibleMeshEntities {
|
|
||||||
&mut self.data[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &RenderVisibleMeshEntities> {
|
|
||||||
self.data.iter()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut RenderVisibleMeshEntities> {
|
|
||||||
self.data.iter_mut()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
pub struct CascadesVisibleEntities {
|
|
||||||
/// Map of view entity to the visible entities for each cascade frustum.
|
|
||||||
#[reflect(ignore)]
|
|
||||||
pub entities: EntityHashMap<Vec<VisibleMeshEntities>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default, Reflect)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
pub struct RenderCascadesVisibleEntities {
|
|
||||||
/// Map of view entity to the visible entities for each cascade frustum.
|
|
||||||
#[reflect(ignore)]
|
|
||||||
pub entities: EntityHashMap<Vec<RenderVisibleMeshEntities>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A component bundle for [`PointLight`] entities.
|
|
||||||
#[derive(Debug, Bundle, Default, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `PointLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct PointLightBundle {
|
|
||||||
pub point_light: PointLight,
|
|
||||||
pub cubemap_visible_entities: CubemapVisibleEntities,
|
|
||||||
pub cubemap_frusta: CubemapFrusta,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Enables or disables the light
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Marker component that indicates that its entity needs to be synchronized to the render world
|
|
||||||
pub sync: SyncToRenderWorld,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A component bundle for spot light entities
|
|
||||||
#[derive(Debug, Bundle, Default, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `SpotLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct SpotLightBundle {
|
|
||||||
pub spot_light: SpotLight,
|
|
||||||
pub visible_entities: VisibleMeshEntities,
|
|
||||||
pub frustum: Frustum,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Enables or disables the light
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Marker component that indicates that its entity needs to be synchronized to the render world
|
|
||||||
pub sync: SyncToRenderWorld,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A component bundle for [`DirectionalLight`] entities.
|
|
||||||
#[derive(Debug, Bundle, Default, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `DirectionalLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct DirectionalLightBundle {
|
|
||||||
pub directional_light: DirectionalLight,
|
|
||||||
pub frusta: CascadesFrusta,
|
|
||||||
pub cascades: Cascades,
|
|
||||||
pub cascade_shadow_config: CascadeShadowConfig,
|
|
||||||
pub visible_entities: CascadesVisibleEntities,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Enables or disables the light
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Marker component that indicates that its entity needs to be synchronized to the render world
|
|
||||||
pub sync: SyncToRenderWorld,
|
|
||||||
}
|
|
89
crates/bevy_pbr/src/components.rs
Normal file
89
crates/bevy_pbr/src/components.rs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
use bevy_derive::{Deref, DerefMut};
|
||||||
|
use bevy_ecs::component::Component;
|
||||||
|
use bevy_ecs::entity::{Entity, EntityHashMap};
|
||||||
|
use bevy_ecs::reflect::ReflectComponent;
|
||||||
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
|
use bevy_render::sync_world::MainEntity;
|
||||||
|
/// Collection of mesh entities visible for 3D lighting.
|
||||||
|
///
|
||||||
|
/// This component contains all mesh entities visible from the current light view.
|
||||||
|
/// The collection is updated automatically by [`crate::SimulationLightSystems`].
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)]
|
||||||
|
#[reflect(Component, Debug, Default)]
|
||||||
|
pub struct VisibleMeshEntities {
|
||||||
|
#[reflect(ignore)]
|
||||||
|
pub entities: Vec<Entity>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)]
|
||||||
|
#[reflect(Component, Debug, Default)]
|
||||||
|
pub struct RenderVisibleMeshEntities {
|
||||||
|
#[reflect(ignore)]
|
||||||
|
pub entities: Vec<(Entity, MainEntity)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect)]
|
||||||
|
#[reflect(Component, Debug, Default)]
|
||||||
|
pub struct CubemapVisibleEntities {
|
||||||
|
#[reflect(ignore)]
|
||||||
|
data: [VisibleMeshEntities; 6],
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CubemapVisibleEntities {
|
||||||
|
pub fn get(&self, i: usize) -> &VisibleMeshEntities {
|
||||||
|
&self.data[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_mut(&mut self, i: usize) -> &mut VisibleMeshEntities {
|
||||||
|
&mut self.data[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &VisibleMeshEntities> {
|
||||||
|
self.data.iter()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut VisibleMeshEntities> {
|
||||||
|
self.data.iter_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect)]
|
||||||
|
#[reflect(Component, Debug, Default)]
|
||||||
|
pub struct RenderCubemapVisibleEntities {
|
||||||
|
#[reflect(ignore)]
|
||||||
|
pub(crate) data: [RenderVisibleMeshEntities; 6],
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RenderCubemapVisibleEntities {
|
||||||
|
pub fn get(&self, i: usize) -> &RenderVisibleMeshEntities {
|
||||||
|
&self.data[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_mut(&mut self, i: usize) -> &mut RenderVisibleMeshEntities {
|
||||||
|
&mut self.data[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &RenderVisibleMeshEntities> {
|
||||||
|
self.data.iter()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut RenderVisibleMeshEntities> {
|
||||||
|
self.data.iter_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect)]
|
||||||
|
#[reflect(Component)]
|
||||||
|
pub struct CascadesVisibleEntities {
|
||||||
|
/// Map of view entity to the visible entities for each cascade frustum.
|
||||||
|
#[reflect(ignore)]
|
||||||
|
pub entities: EntityHashMap<Vec<VisibleMeshEntities>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Clone, Debug, Default, Reflect)]
|
||||||
|
#[reflect(Component)]
|
||||||
|
pub struct RenderCascadesVisibleEntities {
|
||||||
|
/// Map of view entity to the visible entities for each cascade frustum.
|
||||||
|
#[reflect(ignore)]
|
||||||
|
pub entities: EntityHashMap<Vec<RenderVisibleMeshEntities>>,
|
||||||
|
}
|
@ -70,9 +70,6 @@ pub struct DistanceFog {
|
|||||||
pub falloff: FogFalloff,
|
pub falloff: FogFalloff,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `DistanceFog`")]
|
|
||||||
pub type FogSettings = DistanceFog;
|
|
||||||
|
|
||||||
/// Allows switching between different fog falloff modes, and configuring their parameters.
|
/// Allows switching between different fog falloff modes, and configuring their parameters.
|
||||||
///
|
///
|
||||||
/// ## Convenience Methods
|
/// ## Convenience Methods
|
||||||
|
@ -24,8 +24,8 @@ pub mod experimental {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod bundle;
|
|
||||||
mod cluster;
|
mod cluster;
|
||||||
|
mod components;
|
||||||
pub mod deferred;
|
pub mod deferred;
|
||||||
mod extended_material;
|
mod extended_material;
|
||||||
mod fog;
|
mod fog;
|
||||||
@ -47,8 +47,8 @@ use crate::material_bind_groups::FallbackBindlessResources;
|
|||||||
|
|
||||||
use bevy_color::{Color, LinearRgba};
|
use bevy_color::{Color, LinearRgba};
|
||||||
|
|
||||||
pub use bundle::*;
|
|
||||||
pub use cluster::*;
|
pub use cluster::*;
|
||||||
|
pub use components::*;
|
||||||
pub use extended_material::*;
|
pub use extended_material::*;
|
||||||
pub use fog::*;
|
pub use fog::*;
|
||||||
pub use light::*;
|
pub use light::*;
|
||||||
@ -62,29 +62,17 @@ pub use prepass::*;
|
|||||||
pub use render::*;
|
pub use render::*;
|
||||||
pub use ssao::*;
|
pub use ssao::*;
|
||||||
pub use ssr::*;
|
pub use ssr::*;
|
||||||
#[allow(deprecated)]
|
pub use volumetric_fog::{FogVolume, VolumetricFog, VolumetricFogPlugin, VolumetricLight};
|
||||||
pub use volumetric_fog::{
|
|
||||||
FogVolume, FogVolumeBundle, VolumetricFog, VolumetricFogPlugin, VolumetricFogSettings,
|
|
||||||
VolumetricLight,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The PBR prelude.
|
/// The PBR prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
bundle::{
|
|
||||||
DirectionalLightBundle, MaterialMeshBundle, PbrBundle, PointLightBundle,
|
|
||||||
SpotLightBundle,
|
|
||||||
},
|
|
||||||
fog::{DistanceFog, FogFalloff},
|
fog::{DistanceFog, FogFalloff},
|
||||||
light::{light_consts, AmbientLight, DirectionalLight, PointLight, SpotLight},
|
light::{light_consts, AmbientLight, DirectionalLight, PointLight, SpotLight},
|
||||||
light_probe::{
|
light_probe::{environment_map::EnvironmentMapLight, LightProbe},
|
||||||
environment_map::{EnvironmentMapLight, ReflectionProbeBundle},
|
|
||||||
LightProbe,
|
|
||||||
},
|
|
||||||
material::{Material, MaterialPlugin},
|
material::{Material, MaterialPlugin},
|
||||||
mesh_material::MeshMaterial3d,
|
mesh_material::MeshMaterial3d,
|
||||||
parallax::ParallaxMappingMethod,
|
parallax::ParallaxMappingMethod,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
//! environment maps are added to every point of the scene, including
|
//! environment maps are added to every point of the scene, including
|
||||||
//! interior enclosed areas.
|
//! interior enclosed areas.
|
||||||
//!
|
//!
|
||||||
//! 2. If attached to a [`LightProbe`], environment maps represent the immediate
|
//! 2. If attached to a [`crate::LightProbe`], environment maps represent the immediate
|
||||||
//! surroundings of a specific location in the scene. These types of
|
//! surroundings of a specific location in the scene. These types of
|
||||||
//! environment maps are known as *reflection probes*.
|
//! environment maps are known as *reflection probes*.
|
||||||
//!
|
//!
|
||||||
@ -44,19 +44,15 @@
|
|||||||
//!
|
//!
|
||||||
//! [several pre-filtered environment maps]: https://github.com/KhronosGroup/glTF-Sample-Environments
|
//! [several pre-filtered environment maps]: https://github.com/KhronosGroup/glTF-Sample-Environments
|
||||||
|
|
||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use bevy_asset::{AssetId, Handle};
|
use bevy_asset::{AssetId, Handle};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
bundle::Bundle, component::Component, query::QueryItem, reflect::ReflectComponent,
|
component::Component, query::QueryItem, reflect::ReflectComponent, system::lifetimeless::Read,
|
||||||
system::lifetimeless::Read,
|
|
||||||
};
|
};
|
||||||
use bevy_image::Image;
|
use bevy_image::Image;
|
||||||
use bevy_math::Quat;
|
use bevy_math::Quat;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
extract_instances::ExtractInstance,
|
extract_instances::ExtractInstance,
|
||||||
prelude::SpatialBundle,
|
|
||||||
render_asset::RenderAssets,
|
render_asset::RenderAssets,
|
||||||
render_resource::{
|
render_resource::{
|
||||||
binding_types::{self, uniform_buffer},
|
binding_types::{self, uniform_buffer},
|
||||||
@ -70,7 +66,7 @@ use bevy_render::{
|
|||||||
use core::{num::NonZero, ops::Deref};
|
use core::{num::NonZero, ops::Deref};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
add_cubemap_texture_view, binding_arrays_are_usable, EnvironmentMapUniform, LightProbe,
|
add_cubemap_texture_view, binding_arrays_are_usable, EnvironmentMapUniform,
|
||||||
MAX_VIEW_LIGHT_PROBES,
|
MAX_VIEW_LIGHT_PROBES,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,26 +138,6 @@ pub struct EnvironmentMapIds {
|
|||||||
pub(crate) specular: AssetId<Image>,
|
pub(crate) specular: AssetId<Image>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A bundle that contains everything needed to make an entity a reflection
|
|
||||||
/// probe.
|
|
||||||
///
|
|
||||||
/// A reflection probe is a type of environment map that specifies the light
|
|
||||||
/// surrounding a region in space. For more information, see
|
|
||||||
/// [`crate::environment_map`].
|
|
||||||
#[derive(Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `LightProbe` and `EnvironmentMapLight` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub struct ReflectionProbeBundle {
|
|
||||||
/// Contains a transform that specifies the position of this reflection probe in space.
|
|
||||||
pub spatial: SpatialBundle,
|
|
||||||
/// Marks this environment map as a light probe.
|
|
||||||
pub light_probe: LightProbe,
|
|
||||||
/// The cubemaps that make up this environment map.
|
|
||||||
pub environment_map: EnvironmentMapLight,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// All the bind group entries necessary for PBR shaders to access the
|
/// All the bind group entries necessary for PBR shaders to access the
|
||||||
/// environment maps exposed to a view.
|
/// environment maps exposed to a view.
|
||||||
pub(crate) enum RenderViewEnvironmentMapBindGroupEntries<'a> {
|
pub(crate) enum RenderViewEnvironmentMapBindGroupEntries<'a> {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
//! Render high-poly 3d meshes using an efficient GPU-driven method. See [`MeshletPlugin`] and [`MeshletMesh`] for details.
|
//! Render high-poly 3d meshes using an efficient GPU-driven method. See [`MeshletPlugin`] and [`MeshletMesh`] for details.
|
||||||
|
|
||||||
mod asset;
|
mod asset;
|
||||||
@ -40,7 +39,6 @@ pub use self::asset::{
|
|||||||
pub use self::from_mesh::{
|
pub use self::from_mesh::{
|
||||||
MeshToMeshletMeshConversionError, MESHLET_DEFAULT_VERTEX_POSITION_QUANTIZATION_FACTOR,
|
MeshToMeshletMeshConversionError, MESHLET_DEFAULT_VERTEX_POSITION_QUANTIZATION_FACTOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::{
|
use self::{
|
||||||
graph::NodeMeshlet,
|
graph::NodeMeshlet,
|
||||||
instance_manager::extract_meshlet_mesh_entities,
|
instance_manager::extract_meshlet_mesh_entities,
|
||||||
@ -58,7 +56,8 @@ use self::{
|
|||||||
},
|
},
|
||||||
visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode,
|
visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode,
|
||||||
};
|
};
|
||||||
use crate::{graph::NodePbr, Material, MeshMaterial3d, PreviousGlobalTransform};
|
use crate::graph::NodePbr;
|
||||||
|
use crate::PreviousGlobalTransform;
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, AssetApp, AssetId, Handle};
|
use bevy_asset::{load_internal_asset, AssetApp, AssetId, Handle};
|
||||||
use bevy_core_pipeline::{
|
use bevy_core_pipeline::{
|
||||||
@ -67,7 +66,6 @@ use bevy_core_pipeline::{
|
|||||||
};
|
};
|
||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
bundle::Bundle,
|
|
||||||
component::{require, Component},
|
component::{require, Component},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
query::Has,
|
query::Has,
|
||||||
@ -81,13 +79,10 @@ use bevy_render::{
|
|||||||
render_resource::Shader,
|
render_resource::Shader,
|
||||||
renderer::RenderDevice,
|
renderer::RenderDevice,
|
||||||
settings::WgpuFeatures,
|
settings::WgpuFeatures,
|
||||||
view::{
|
view::{self, prepare_view_targets, Msaa, Visibility, VisibilityClass},
|
||||||
self, prepare_view_targets, InheritedVisibility, Msaa, ViewVisibility, Visibility,
|
|
||||||
VisibilityClass,
|
|
||||||
},
|
|
||||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
use bevy_transform::components::Transform;
|
||||||
use bevy_utils::tracing::error;
|
use bevy_utils::tracing::error;
|
||||||
use derive_more::From;
|
use derive_more::From;
|
||||||
|
|
||||||
@ -314,39 +309,6 @@ impl From<&MeshletMesh3d> for AssetId<MeshletMesh> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A component bundle for entities with a [`MeshletMesh`] and a [`Material`].
|
|
||||||
#[derive(Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `MeshletMesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub struct MaterialMeshletMeshBundle<M: Material> {
|
|
||||||
pub meshlet_mesh: MeshletMesh3d,
|
|
||||||
pub material: MeshMaterial3d<M>,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// User indication of whether an entity is visible
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<M: Material> Default for MaterialMeshletMeshBundle<M> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
meshlet_mesh: Default::default(),
|
|
||||||
material: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
inherited_visibility: Default::default(),
|
|
||||||
view_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn configure_meshlet_views(
|
fn configure_meshlet_views(
|
||||||
mut views_3d: Query<(
|
mut views_3d: Query<(
|
||||||
Entity,
|
Entity,
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::NodePbr;
|
use crate::NodePbr;
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, Handle};
|
use bevy_asset::{load_internal_asset, Handle};
|
||||||
@ -9,7 +7,7 @@ use bevy_core_pipeline::{
|
|||||||
prepass::{DepthPrepass, NormalPrepass, ViewPrepassTextures},
|
prepass::{DepthPrepass, NormalPrepass, ViewPrepassTextures},
|
||||||
};
|
};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::{require, Bundle, Component, Entity},
|
prelude::{require, Component, Entity},
|
||||||
query::{Has, QueryItem, With},
|
query::{Has, QueryItem, With},
|
||||||
reflect::ReflectComponent,
|
reflect::ReflectComponent,
|
||||||
schedule::IntoSystemConfigs,
|
schedule::IntoSystemConfigs,
|
||||||
@ -132,18 +130,6 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bundle to apply screen space ambient occlusion.
|
|
||||||
#[derive(Bundle, Default, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `ScreenSpaceAmbientOcclusion` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct ScreenSpaceAmbientOcclusionBundle {
|
|
||||||
pub settings: ScreenSpaceAmbientOcclusion,
|
|
||||||
pub depth_prepass: DepthPrepass,
|
|
||||||
pub normal_prepass: NormalPrepass,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Component to apply screen space ambient occlusion to a 3d camera.
|
/// Component to apply screen space ambient occlusion to a 3d camera.
|
||||||
///
|
///
|
||||||
/// Screen space ambient occlusion (SSAO) approximates small-scale,
|
/// Screen space ambient occlusion (SSAO) approximates small-scale,
|
||||||
@ -185,9 +171,6 @@ impl Default for ScreenSpaceAmbientOcclusion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `ScreenSpaceAmbientOcclusion`")]
|
|
||||||
pub type ScreenSpaceAmbientOcclusionSettings = ScreenSpaceAmbientOcclusion;
|
|
||||||
|
|
||||||
#[derive(Reflect, PartialEq, Eq, Hash, Clone, Copy, Default, Debug)]
|
#[derive(Reflect, PartialEq, Eq, Hash, Clone, Copy, Default, Debug)]
|
||||||
pub enum ScreenSpaceAmbientOcclusionQualityLevel {
|
pub enum ScreenSpaceAmbientOcclusionQualityLevel {
|
||||||
Low,
|
Low,
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
//! Screen space reflections implemented via raymarching.
|
//! Screen space reflections implemented via raymarching.
|
||||||
|
|
||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, Handle};
|
use bevy_asset::{load_internal_asset, Handle};
|
||||||
use bevy_core_pipeline::{
|
use bevy_core_pipeline::{
|
||||||
@ -14,7 +12,6 @@ use bevy_core_pipeline::{
|
|||||||
};
|
};
|
||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
bundle::Bundle,
|
|
||||||
component::{require, Component},
|
component::{require, Component},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
query::{Has, QueryItem, With},
|
query::{Has, QueryItem, With},
|
||||||
@ -58,22 +55,6 @@ const RAYMARCH_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(8517409683
|
|||||||
/// Screen-space reflections are currently only supported with deferred rendering.
|
/// Screen-space reflections are currently only supported with deferred rendering.
|
||||||
pub struct ScreenSpaceReflectionsPlugin;
|
pub struct ScreenSpaceReflectionsPlugin;
|
||||||
|
|
||||||
/// A convenient bundle to add screen space reflections to a camera, along with
|
|
||||||
/// the depth and deferred prepasses required to enable them.
|
|
||||||
#[derive(Bundle, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `ScreenSpaceReflections` components instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct ScreenSpaceReflectionsBundle {
|
|
||||||
/// The component that enables SSR.
|
|
||||||
pub settings: ScreenSpaceReflections,
|
|
||||||
/// The depth prepass, needed for SSR.
|
|
||||||
pub depth_prepass: DepthPrepass,
|
|
||||||
/// The deferred prepass, needed for SSR.
|
|
||||||
pub deferred_prepass: DeferredPrepass,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add this component to a camera to enable *screen-space reflections* (SSR).
|
/// Add this component to a camera to enable *screen-space reflections* (SSR).
|
||||||
///
|
///
|
||||||
/// Screen-space reflections currently require deferred rendering in order to
|
/// Screen-space reflections currently require deferred rendering in order to
|
||||||
@ -142,9 +123,6 @@ pub struct ScreenSpaceReflections {
|
|||||||
pub use_secant: bool,
|
pub use_secant: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `ScreenSpaceReflections`")]
|
|
||||||
pub type ScreenSpaceReflectionsSettings = ScreenSpaceReflections;
|
|
||||||
|
|
||||||
/// A version of [`ScreenSpaceReflections`] for upload to the GPU.
|
/// A version of [`ScreenSpaceReflections`] for upload to the GPU.
|
||||||
///
|
///
|
||||||
/// For more information on these fields, see the corresponding documentation in
|
/// For more information on these fields, see the corresponding documentation in
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
//!
|
//!
|
||||||
//! [Henyey-Greenstein phase function]: https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions#TheHenyeyndashGreensteinPhaseFunction
|
//! [Henyey-Greenstein phase function]: https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions#TheHenyeyndashGreensteinPhaseFunction
|
||||||
|
|
||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, Assets, Handle};
|
use bevy_asset::{load_internal_asset, Assets, Handle};
|
||||||
use bevy_color::Color;
|
use bevy_color::Color;
|
||||||
@ -39,7 +37,6 @@ use bevy_core_pipeline::core_3d::{
|
|||||||
prepare_core_3d_depth_textures,
|
prepare_core_3d_depth_textures,
|
||||||
};
|
};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
bundle::Bundle,
|
|
||||||
component::{require, Component},
|
component::{require, Component},
|
||||||
reflect::ReflectComponent,
|
reflect::ReflectComponent,
|
||||||
schedule::IntoSystemConfigs as _,
|
schedule::IntoSystemConfigs as _,
|
||||||
@ -55,10 +52,10 @@ use bevy_render::{
|
|||||||
render_graph::{RenderGraphApp, ViewNodeRunner},
|
render_graph::{RenderGraphApp, ViewNodeRunner},
|
||||||
render_resource::{Shader, SpecializedRenderPipelines},
|
render_resource::{Shader, SpecializedRenderPipelines},
|
||||||
sync_component::SyncComponentPlugin,
|
sync_component::SyncComponentPlugin,
|
||||||
view::{InheritedVisibility, ViewVisibility, Visibility},
|
view::Visibility,
|
||||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
use bevy_transform::components::Transform;
|
||||||
use render::{
|
use render::{
|
||||||
VolumetricFogNode, VolumetricFogPipeline, VolumetricFogUniformBuffer, CUBE_MESH, PLANE_MESH,
|
VolumetricFogNode, VolumetricFogPipeline, VolumetricFogUniformBuffer, CUBE_MESH, PLANE_MESH,
|
||||||
VOLUMETRIC_FOG_HANDLE,
|
VOLUMETRIC_FOG_HANDLE,
|
||||||
@ -120,32 +117,6 @@ pub struct VolumetricFog {
|
|||||||
pub step_count: u32,
|
pub step_count: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "Renamed to `VolumetricFog`")]
|
|
||||||
pub type VolumetricFogSettings = VolumetricFog;
|
|
||||||
|
|
||||||
/// A convenient [`Bundle`] that contains all components necessary to generate a
|
|
||||||
/// fog volume.
|
|
||||||
#[derive(Bundle, Clone, Debug, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `FogVolume` component instead. Inserting it will now also insert the other components required by it automatically."
|
|
||||||
)]
|
|
||||||
pub struct FogVolumeBundle {
|
|
||||||
/// The actual fog volume.
|
|
||||||
pub fog_volume: FogVolume,
|
|
||||||
/// Visibility.
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// View visibility.
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// The local transform. Set this to change the position, and scale of the
|
|
||||||
/// fog's axis-aligned bounding box (AABB).
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Component, Debug, Reflect)]
|
#[derive(Clone, Component, Debug, Reflect)]
|
||||||
#[reflect(Component, Default, Debug)]
|
#[reflect(Component, Default, Debug)]
|
||||||
#[require(Transform, Visibility)]
|
#[require(Transform, Visibility)]
|
||||||
|
@ -175,11 +175,6 @@ impl DynamicArray {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.15.0", note = "use from_iter")]
|
|
||||||
pub fn from_vec<T: PartialReflect>(values: Vec<T>) -> Self {
|
|
||||||
Self::from_iter(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the [type] to be represented by this `DynamicArray`.
|
/// Sets the [type] to be represented by this `DynamicArray`.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
|
@ -40,7 +40,6 @@ pub mod render_phase;
|
|||||||
pub mod render_resource;
|
pub mod render_resource;
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
mod spatial_bundle;
|
|
||||||
pub mod storage;
|
pub mod storage;
|
||||||
pub mod sync_component;
|
pub mod sync_component;
|
||||||
pub mod sync_world;
|
pub mod sync_world;
|
||||||
@ -50,7 +49,6 @@ pub mod view;
|
|||||||
/// The render prelude.
|
/// The render prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
@ -64,9 +62,8 @@ pub mod prelude {
|
|||||||
Mesh3d,
|
Mesh3d,
|
||||||
},
|
},
|
||||||
render_resource::Shader,
|
render_resource::Shader,
|
||||||
spatial_bundle::SpatialBundle,
|
|
||||||
texture::ImagePlugin,
|
texture::ImagePlugin,
|
||||||
view::{InheritedVisibility, Msaa, ViewVisibility, Visibility, VisibilityBundle},
|
view::{InheritedVisibility, Msaa, ViewVisibility, Visibility},
|
||||||
ExtractSchedule,
|
ExtractSchedule,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
use bevy_ecs::prelude::Bundle;
|
|
||||||
use bevy_transform::prelude::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
use crate::view::{InheritedVisibility, ViewVisibility, Visibility};
|
|
||||||
|
|
||||||
/// A [`Bundle`] that allows the correct positional rendering of an entity.
|
|
||||||
///
|
|
||||||
/// It consists of transform components,
|
|
||||||
/// controlling position, rotation and scale of the entity,
|
|
||||||
/// but also visibility components,
|
|
||||||
/// which determine whether the entity is visible or not.
|
|
||||||
///
|
|
||||||
/// Parent-child hierarchies of entities must contain
|
|
||||||
/// all the [`Component`]s in this `Bundle`
|
|
||||||
/// to be rendered correctly.
|
|
||||||
///
|
|
||||||
/// [`Component`]: bevy_ecs::component::Component
|
|
||||||
#[derive(Bundle, Clone, Debug, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Transform` and `Visibility` components instead.
|
|
||||||
Inserting `Transform` will now also insert a `GlobalTransform` automatically.
|
|
||||||
Inserting 'Visibility' will now also insert `InheritedVisibility` and `ViewVisibility` automatically."
|
|
||||||
)]
|
|
||||||
pub struct SpatialBundle {
|
|
||||||
/// The visibility of the entity.
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// The inherited visibility of the entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// The view visibility of the entity.
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// The transform of the entity.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform of the entity.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SpatialBundle {
|
|
||||||
/// Creates a new [`SpatialBundle`] from a [`Transform`].
|
|
||||||
///
|
|
||||||
/// This initializes [`GlobalTransform`] as identity, and visibility as visible
|
|
||||||
#[inline]
|
|
||||||
pub const fn from_transform(transform: Transform) -> Self {
|
|
||||||
SpatialBundle {
|
|
||||||
transform,
|
|
||||||
..Self::INHERITED_IDENTITY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A [`SpatialBundle`] with inherited visibility and identity transform.
|
|
||||||
pub const INHERITED_IDENTITY: Self = SpatialBundle {
|
|
||||||
visibility: Visibility::Inherited,
|
|
||||||
inherited_visibility: InheritedVisibility::HIDDEN,
|
|
||||||
view_visibility: ViewVisibility::HIDDEN,
|
|
||||||
transform: Transform::IDENTITY,
|
|
||||||
global_transform: GlobalTransform::IDENTITY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// An invisible [`SpatialBundle`] with identity transform.
|
|
||||||
pub const HIDDEN_IDENTITY: Self = SpatialBundle {
|
|
||||||
visibility: Visibility::Hidden,
|
|
||||||
..Self::INHERITED_IDENTITY
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Transform> for SpatialBundle {
|
|
||||||
#[inline]
|
|
||||||
fn from(transform: Transform) -> Self {
|
|
||||||
Self::from_transform(transform)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
mod range;
|
mod range;
|
||||||
mod render_layers;
|
mod render_layers;
|
||||||
|
|
||||||
@ -200,28 +198,6 @@ impl ViewVisibility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [`Bundle`] of the [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`]
|
|
||||||
/// [`Component`]s, which describe the visibility of an entity.
|
|
||||||
///
|
|
||||||
/// * To show or hide an entity, you should set its [`Visibility`].
|
|
||||||
/// * To get the inherited visibility of an entity, you should get its [`InheritedVisibility`].
|
|
||||||
/// * For visibility hierarchies to work correctly, you must have both all of [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`].
|
|
||||||
/// * ~~You may use the [`VisibilityBundle`] to guarantee this.~~ [`VisibilityBundle`] is now deprecated.
|
|
||||||
/// [`InheritedVisibility`] and [`ViewVisibility`] are automatically inserted whenever [`Visibility`] is inserted.
|
|
||||||
#[derive(Bundle, Debug, Clone, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Visibility` component instead. Inserting it will now also insert `InheritedVisibility` and `ViewVisibility` automatically."
|
|
||||||
)]
|
|
||||||
pub struct VisibilityBundle {
|
|
||||||
/// The visibility of the entity.
|
|
||||||
pub visibility: Visibility,
|
|
||||||
// The inherited visibility of the entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
// The computed visibility of the entity.
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Use this component to opt-out of built-in frustum culling for entities, see
|
/// Use this component to opt-out of built-in frustum culling for entities, see
|
||||||
/// [`Frustum`].
|
/// [`Frustum`].
|
||||||
///
|
///
|
||||||
|
@ -1,188 +0,0 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use bevy_derive::{Deref, DerefMut};
|
|
||||||
use bevy_ecs::{
|
|
||||||
bundle::Bundle,
|
|
||||||
change_detection::ResMut,
|
|
||||||
entity::Entity,
|
|
||||||
prelude::{Changed, Component, Without},
|
|
||||||
system::{Commands, Query},
|
|
||||||
};
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
use bevy_render::prelude::{InheritedVisibility, ViewVisibility, Visibility};
|
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
use crate::{DynamicSceneRoot, InstanceId, SceneRoot, SceneSpawner};
|
|
||||||
|
|
||||||
/// [`InstanceId`] of a spawned scene. It can be used with the [`SceneSpawner`] to
|
|
||||||
/// interact with the spawned scene.
|
|
||||||
#[derive(Component, Deref, DerefMut)]
|
|
||||||
pub struct SceneInstance(pub(crate) InstanceId);
|
|
||||||
|
|
||||||
/// A component bundle for a [`Scene`](crate::Scene) root.
|
|
||||||
///
|
|
||||||
/// The scene from `scene` will be spawned as a child of the entity with this component.
|
|
||||||
/// Once it's spawned, the entity will have a [`SceneInstance`] component.
|
|
||||||
#[derive(Default, Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `SceneRoot` component instead. Inserting `SceneRoot` will also insert the other components required by scenes automatically."
|
|
||||||
)]
|
|
||||||
pub struct SceneBundle {
|
|
||||||
/// Handle to the scene to spawn.
|
|
||||||
pub scene: SceneRoot,
|
|
||||||
/// Transform of the scene root entity.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// Global transform of the scene root entity.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
|
|
||||||
/// User-driven visibility of the scene root entity.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of the scene root entity.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed visibility of the scene root entity for rendering.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A component bundle for a [`DynamicScene`](crate::DynamicScene) root.
|
|
||||||
///
|
|
||||||
/// The dynamic scene from `scene` will be spawn as a child of the entity with this component.
|
|
||||||
/// Once it's spawned, the entity will have a [`SceneInstance`] component.
|
|
||||||
#[derive(Default, Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `DynamicSceneRoot` component instead. Inserting `DynamicSceneRoot` will also insert the other components required by scenes automatically."
|
|
||||||
)]
|
|
||||||
pub struct DynamicSceneBundle {
|
|
||||||
/// Handle to the scene to spawn.
|
|
||||||
pub scene: DynamicSceneRoot,
|
|
||||||
/// Transform of the scene root entity.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// Global transform of the scene root entity.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
|
|
||||||
/// User-driven visibility of the scene root entity.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of the scene root entity.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed visibility of the scene root entity for rendering.
|
|
||||||
#[cfg(feature = "bevy_render")]
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// System that will spawn scenes from the [`SceneRoot`] and [`DynamicSceneRoot`] components.
|
|
||||||
pub fn scene_spawner(
|
|
||||||
mut commands: Commands,
|
|
||||||
mut scene_to_spawn: Query<
|
|
||||||
(Entity, &SceneRoot, Option<&mut SceneInstance>),
|
|
||||||
(Changed<SceneRoot>, Without<DynamicSceneRoot>),
|
|
||||||
>,
|
|
||||||
mut dynamic_scene_to_spawn: Query<
|
|
||||||
(Entity, &DynamicSceneRoot, Option<&mut SceneInstance>),
|
|
||||||
(Changed<DynamicSceneRoot>, Without<SceneRoot>),
|
|
||||||
>,
|
|
||||||
mut scene_spawner: ResMut<SceneSpawner>,
|
|
||||||
) {
|
|
||||||
for (entity, scene, instance) in &mut scene_to_spawn {
|
|
||||||
let new_instance = scene_spawner.spawn_as_child(scene.0.clone(), entity);
|
|
||||||
if let Some(mut old_instance) = instance {
|
|
||||||
scene_spawner.despawn_instance(**old_instance);
|
|
||||||
*old_instance = SceneInstance(new_instance);
|
|
||||||
} else {
|
|
||||||
commands.entity(entity).insert(SceneInstance(new_instance));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (entity, dynamic_scene, instance) in &mut dynamic_scene_to_spawn {
|
|
||||||
let new_instance = scene_spawner.spawn_dynamic_as_child(dynamic_scene.0.clone(), entity);
|
|
||||||
if let Some(mut old_instance) = instance {
|
|
||||||
scene_spawner.despawn_instance(**old_instance);
|
|
||||||
*old_instance = SceneInstance(new_instance);
|
|
||||||
} else {
|
|
||||||
commands.entity(entity).insert(SceneInstance(new_instance));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use crate::{DynamicScene, DynamicSceneRoot, ScenePlugin, SceneSpawner};
|
|
||||||
use bevy_app::{App, ScheduleRunnerPlugin};
|
|
||||||
use bevy_asset::{AssetPlugin, Assets};
|
|
||||||
use bevy_ecs::{
|
|
||||||
component::Component,
|
|
||||||
entity::Entity,
|
|
||||||
prelude::{AppTypeRegistry, ReflectComponent, World},
|
|
||||||
};
|
|
||||||
use bevy_hierarchy::{Children, HierarchyPlugin};
|
|
||||||
use bevy_reflect::Reflect;
|
|
||||||
|
|
||||||
#[derive(Component, Reflect, Default)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
struct ComponentA {
|
|
||||||
pub x: f32,
|
|
||||||
pub y: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn spawn_and_delete() {
|
|
||||||
let mut app = App::new();
|
|
||||||
|
|
||||||
app.add_plugins(ScheduleRunnerPlugin::default())
|
|
||||||
.add_plugins(HierarchyPlugin)
|
|
||||||
.add_plugins(AssetPlugin::default())
|
|
||||||
.add_plugins(ScenePlugin)
|
|
||||||
.register_type::<ComponentA>();
|
|
||||||
app.update();
|
|
||||||
|
|
||||||
let mut scene_world = World::new();
|
|
||||||
|
|
||||||
// create a new DynamicScene manually
|
|
||||||
let type_registry = app.world().resource::<AppTypeRegistry>().clone();
|
|
||||||
scene_world.insert_resource(type_registry);
|
|
||||||
scene_world.spawn(ComponentA { x: 3.0, y: 4.0 });
|
|
||||||
let scene = DynamicScene::from_world(&scene_world);
|
|
||||||
let scene_handle = app
|
|
||||||
.world_mut()
|
|
||||||
.resource_mut::<Assets<DynamicScene>>()
|
|
||||||
.add(scene);
|
|
||||||
|
|
||||||
// spawn the scene as a child of `entity` using `DynamicSceneRoot`
|
|
||||||
let entity = app
|
|
||||||
.world_mut()
|
|
||||||
.spawn(DynamicSceneRoot(scene_handle.clone()))
|
|
||||||
.id();
|
|
||||||
|
|
||||||
// run the app's schedule once, so that the scene gets spawned
|
|
||||||
app.update();
|
|
||||||
|
|
||||||
// make sure that the scene was added as a child of the root entity
|
|
||||||
let (scene_entity, scene_component_a) = app
|
|
||||||
.world_mut()
|
|
||||||
.query::<(Entity, &ComponentA)>()
|
|
||||||
.single(app.world());
|
|
||||||
assert_eq!(scene_component_a.x, 3.0);
|
|
||||||
assert_eq!(scene_component_a.y, 4.0);
|
|
||||||
assert_eq!(
|
|
||||||
app.world().entity(entity).get::<Children>().unwrap().len(),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
// let's try to delete the scene
|
|
||||||
let mut scene_spawner = app.world_mut().resource_mut::<SceneSpawner>();
|
|
||||||
scene_spawner.despawn(&scene_handle);
|
|
||||||
|
|
||||||
// run the scene spawner system to despawn the scene
|
|
||||||
app.update();
|
|
||||||
|
|
||||||
// the scene entity does not exist anymore
|
|
||||||
assert!(app.world().get_entity(scene_entity).is_err());
|
|
||||||
|
|
||||||
// the root entity does not have any children anymore
|
|
||||||
assert!(app.world().entity(entity).get::<Children>().is_none());
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
mod bundle;
|
|
||||||
mod components;
|
mod components;
|
||||||
mod dynamic_scene;
|
mod dynamic_scene;
|
||||||
mod dynamic_scene_builder;
|
mod dynamic_scene_builder;
|
||||||
@ -29,7 +28,6 @@ pub mod serde;
|
|||||||
pub use bevy_asset::ron;
|
pub use bevy_asset::ron;
|
||||||
|
|
||||||
use bevy_ecs::schedule::IntoSystemConfigs;
|
use bevy_ecs::schedule::IntoSystemConfigs;
|
||||||
pub use bundle::*;
|
|
||||||
pub use components::*;
|
pub use components::*;
|
||||||
pub use dynamic_scene::*;
|
pub use dynamic_scene::*;
|
||||||
pub use dynamic_scene_builder::*;
|
pub use dynamic_scene_builder::*;
|
||||||
@ -41,12 +39,11 @@ pub use scene_spawner::*;
|
|||||||
/// The scene prelude.
|
/// The scene prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
DynamicScene, DynamicSceneBuilder, DynamicSceneBundle, DynamicSceneRoot, Scene,
|
DynamicScene, DynamicSceneBuilder, DynamicSceneRoot, Scene, SceneFilter, SceneRoot,
|
||||||
SceneBundle, SceneFilter, SceneRoot, SceneSpawner,
|
SceneSpawner,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@ use bevy_utils::{HashMap, HashSet};
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{DynamicSceneRoot, SceneRoot};
|
||||||
|
use bevy_derive::{Deref, DerefMut};
|
||||||
|
use bevy_ecs::{
|
||||||
|
change_detection::ResMut,
|
||||||
|
prelude::{Changed, Component, Without},
|
||||||
|
system::{Commands, Query},
|
||||||
|
};
|
||||||
/// Triggered on a scene's parent entity when [`crate::SceneInstance`] becomes ready to use.
|
/// Triggered on a scene's parent entity when [`crate::SceneInstance`] becomes ready to use.
|
||||||
///
|
///
|
||||||
/// See also [`Trigger`], [`SceneSpawner::instance_is_ready`].
|
/// See also [`Trigger`], [`SceneSpawner::instance_is_ready`].
|
||||||
@ -468,6 +475,44 @@ pub fn scene_spawner_system(world: &mut World) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [`InstanceId`] of a spawned scene. It can be used with the [`SceneSpawner`] to
|
||||||
|
/// interact with the spawned scene.
|
||||||
|
#[derive(Component, Deref, DerefMut)]
|
||||||
|
pub struct SceneInstance(pub(crate) InstanceId);
|
||||||
|
|
||||||
|
/// System that will spawn scenes from the [`SceneRoot`] and [`DynamicSceneRoot`] components.
|
||||||
|
pub fn scene_spawner(
|
||||||
|
mut commands: Commands,
|
||||||
|
mut scene_to_spawn: Query<
|
||||||
|
(Entity, &SceneRoot, Option<&mut SceneInstance>),
|
||||||
|
(Changed<SceneRoot>, Without<DynamicSceneRoot>),
|
||||||
|
>,
|
||||||
|
mut dynamic_scene_to_spawn: Query<
|
||||||
|
(Entity, &DynamicSceneRoot, Option<&mut SceneInstance>),
|
||||||
|
(Changed<DynamicSceneRoot>, Without<SceneRoot>),
|
||||||
|
>,
|
||||||
|
mut scene_spawner: ResMut<SceneSpawner>,
|
||||||
|
) {
|
||||||
|
for (entity, scene, instance) in &mut scene_to_spawn {
|
||||||
|
let new_instance = scene_spawner.spawn_as_child(scene.0.clone(), entity);
|
||||||
|
if let Some(mut old_instance) = instance {
|
||||||
|
scene_spawner.despawn_instance(**old_instance);
|
||||||
|
*old_instance = SceneInstance(new_instance);
|
||||||
|
} else {
|
||||||
|
commands.entity(entity).insert(SceneInstance(new_instance));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (entity, dynamic_scene, instance) in &mut dynamic_scene_to_spawn {
|
||||||
|
let new_instance = scene_spawner.spawn_dynamic_as_child(dynamic_scene.0.clone(), entity);
|
||||||
|
if let Some(mut old_instance) = instance {
|
||||||
|
scene_spawner.despawn_instance(**old_instance);
|
||||||
|
*old_instance = SceneInstance(new_instance);
|
||||||
|
} else {
|
||||||
|
commands.entity(entity).insert(SceneInstance(new_instance));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bevy_app::App;
|
use bevy_app::App;
|
||||||
@ -484,6 +529,79 @@ mod tests {
|
|||||||
use crate::{DynamicSceneBuilder, DynamicSceneRoot, ScenePlugin};
|
use crate::{DynamicSceneBuilder, DynamicSceneRoot, ScenePlugin};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::{DynamicScene, SceneSpawner};
|
||||||
|
use bevy_app::ScheduleRunnerPlugin;
|
||||||
|
use bevy_asset::Assets;
|
||||||
|
use bevy_ecs::{
|
||||||
|
entity::Entity,
|
||||||
|
prelude::{AppTypeRegistry, World},
|
||||||
|
};
|
||||||
|
use bevy_hierarchy::{Children, HierarchyPlugin};
|
||||||
|
|
||||||
|
#[derive(Component, Reflect, Default)]
|
||||||
|
#[reflect(Component)]
|
||||||
|
struct ComponentA {
|
||||||
|
pub x: f32,
|
||||||
|
pub y: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn spawn_and_delete() {
|
||||||
|
let mut app = App::new();
|
||||||
|
|
||||||
|
app.add_plugins(ScheduleRunnerPlugin::default())
|
||||||
|
.add_plugins(HierarchyPlugin)
|
||||||
|
.add_plugins(AssetPlugin::default())
|
||||||
|
.add_plugins(ScenePlugin)
|
||||||
|
.register_type::<ComponentA>();
|
||||||
|
app.update();
|
||||||
|
|
||||||
|
let mut scene_world = World::new();
|
||||||
|
|
||||||
|
// create a new DynamicScene manually
|
||||||
|
let type_registry = app.world().resource::<AppTypeRegistry>().clone();
|
||||||
|
scene_world.insert_resource(type_registry);
|
||||||
|
scene_world.spawn(ComponentA { x: 3.0, y: 4.0 });
|
||||||
|
let scene = DynamicScene::from_world(&scene_world);
|
||||||
|
let scene_handle = app
|
||||||
|
.world_mut()
|
||||||
|
.resource_mut::<Assets<DynamicScene>>()
|
||||||
|
.add(scene);
|
||||||
|
|
||||||
|
// spawn the scene as a child of `entity` using `DynamicSceneRoot`
|
||||||
|
let entity = app
|
||||||
|
.world_mut()
|
||||||
|
.spawn(DynamicSceneRoot(scene_handle.clone()))
|
||||||
|
.id();
|
||||||
|
|
||||||
|
// run the app's schedule once, so that the scene gets spawned
|
||||||
|
app.update();
|
||||||
|
|
||||||
|
// make sure that the scene was added as a child of the root entity
|
||||||
|
let (scene_entity, scene_component_a) = app
|
||||||
|
.world_mut()
|
||||||
|
.query::<(Entity, &ComponentA)>()
|
||||||
|
.single(app.world());
|
||||||
|
assert_eq!(scene_component_a.x, 3.0);
|
||||||
|
assert_eq!(scene_component_a.y, 4.0);
|
||||||
|
assert_eq!(
|
||||||
|
app.world().entity(entity).get::<Children>().unwrap().len(),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
// let's try to delete the scene
|
||||||
|
let mut scene_spawner = app.world_mut().resource_mut::<SceneSpawner>();
|
||||||
|
scene_spawner.despawn(&scene_handle);
|
||||||
|
|
||||||
|
// run the scene spawner system to despawn the scene
|
||||||
|
app.update();
|
||||||
|
|
||||||
|
// the scene entity does not exist anymore
|
||||||
|
assert!(app.world().get_entity(scene_entity).is_err());
|
||||||
|
|
||||||
|
// the root entity does not have any children anymore
|
||||||
|
assert!(app.world().entity(entity).get::<Children>().is_none());
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Reflect, Component, Debug, PartialEq, Eq, Clone, Copy, Default)]
|
#[derive(Reflect, Component, Debug, PartialEq, Eq, Clone, Copy, Default)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component)]
|
||||||
@ -538,7 +656,7 @@ mod tests {
|
|||||||
|
|
||||||
#[derive(Component, Reflect, Default)]
|
#[derive(Component, Reflect, Default)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component)]
|
||||||
struct ComponentA;
|
struct ComponentF;
|
||||||
|
|
||||||
#[derive(Resource, Default)]
|
#[derive(Resource, Default)]
|
||||||
struct TriggerCount(u32);
|
struct TriggerCount(u32);
|
||||||
@ -548,9 +666,9 @@ mod tests {
|
|||||||
app.add_plugins((AssetPlugin::default(), ScenePlugin));
|
app.add_plugins((AssetPlugin::default(), ScenePlugin));
|
||||||
app.init_resource::<TriggerCount>();
|
app.init_resource::<TriggerCount>();
|
||||||
|
|
||||||
app.register_type::<ComponentA>();
|
app.register_type::<ComponentF>();
|
||||||
app.world_mut().spawn(ComponentA);
|
app.world_mut().spawn(ComponentF);
|
||||||
app.world_mut().spawn(ComponentA);
|
app.world_mut().spawn(ComponentF);
|
||||||
|
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
@ -704,7 +822,7 @@ mod tests {
|
|||||||
fn despawn_scene() {
|
fn despawn_scene() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.add_plugins((AssetPlugin::default(), ScenePlugin));
|
app.add_plugins((AssetPlugin::default(), ScenePlugin));
|
||||||
app.register_type::<ComponentA>();
|
app.register_type::<ComponentF>();
|
||||||
|
|
||||||
let asset_server = app.world().resource::<AssetServer>();
|
let asset_server = app.world().resource::<AssetServer>();
|
||||||
|
|
||||||
@ -725,7 +843,7 @@ mod tests {
|
|||||||
// Spawn scene.
|
// Spawn scene.
|
||||||
for _ in 0..count {
|
for _ in 0..count {
|
||||||
app.world_mut()
|
app.world_mut()
|
||||||
.spawn((ComponentA, DynamicSceneRoot(scene.clone())));
|
.spawn((ComponentF, DynamicSceneRoot(scene.clone())));
|
||||||
}
|
}
|
||||||
|
|
||||||
app.update();
|
app.update();
|
||||||
@ -734,7 +852,7 @@ mod tests {
|
|||||||
// Despawn scene.
|
// Despawn scene.
|
||||||
app.world_mut()
|
app.world_mut()
|
||||||
.run_system_once(
|
.run_system_once(
|
||||||
|mut commands: Commands, query: Query<Entity, With<ComponentA>>| {
|
|mut commands: Commands, query: Query<Entity, With<ComponentF>>| {
|
||||||
for entity in query.iter() {
|
for entity in query.iter() {
|
||||||
commands.entity(entity).despawn_recursive();
|
commands.entity(entity).despawn_recursive();
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
use crate::Sprite;
|
|
||||||
use bevy_ecs::bundle::Bundle;
|
|
||||||
use bevy_render::{
|
|
||||||
sync_world::SyncToRenderWorld,
|
|
||||||
view::{InheritedVisibility, ViewVisibility, Visibility},
|
|
||||||
};
|
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
/// A [`Bundle`] of components for drawing a single sprite from an image.
|
|
||||||
#[derive(Bundle, Clone, Debug, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Sprite` component instead. Inserting it will now also insert `Transform` and `Visibility` automatically."
|
|
||||||
)]
|
|
||||||
pub struct SpriteBundle {
|
|
||||||
/// Specifies the rendering properties of the sprite, such as color tint and flip.
|
|
||||||
pub sprite: Sprite,
|
|
||||||
/// The local transform of the sprite, relative to its parent.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The absolute transform of the sprite. This should generally not be written to directly.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// User indication of whether an entity is visible
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Marker component that indicates that its entity needs to be synchronized to the render world
|
|
||||||
pub sync: SyncToRenderWorld,
|
|
||||||
}
|
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
mod bundle;
|
|
||||||
mod dynamic_texture_atlas_builder;
|
mod dynamic_texture_atlas_builder;
|
||||||
mod mesh2d;
|
mod mesh2d;
|
||||||
#[cfg(feature = "bevy_sprite_picking_backend")]
|
#[cfg(feature = "bevy_sprite_picking_backend")]
|
||||||
@ -24,19 +23,16 @@ mod texture_slice;
|
|||||||
/// The sprite prelude.
|
/// The sprite prelude.
|
||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
bundle::SpriteBundle,
|
|
||||||
sprite::{Sprite, SpriteImageMode},
|
sprite::{Sprite, SpriteImageMode},
|
||||||
texture_atlas::{TextureAtlas, TextureAtlasLayout, TextureAtlasSources},
|
texture_atlas::{TextureAtlas, TextureAtlasLayout, TextureAtlasSources},
|
||||||
texture_slice::{BorderRect, SliceScaleMode, TextureSlice, TextureSlicer},
|
texture_slice::{BorderRect, SliceScaleMode, TextureSlice, TextureSlicer},
|
||||||
ColorMaterial, ColorMesh2dBundle, MeshMaterial2d, TextureAtlasBuilder,
|
ColorMaterial, MeshMaterial2d, TextureAtlasBuilder,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use bundle::*;
|
|
||||||
pub use dynamic_texture_atlas_builder::*;
|
pub use dynamic_texture_atlas_builder::*;
|
||||||
pub use mesh2d::*;
|
pub use mesh2d::*;
|
||||||
#[cfg(feature = "bevy_sprite_picking_backend")]
|
#[cfg(feature = "bevy_sprite_picking_backend")]
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#![expect(deprecated)]
|
use crate::{AlphaMode2d, Material2d, Material2dPlugin};
|
||||||
|
|
||||||
use crate::{AlphaMode2d, Material2d, Material2dPlugin, MaterialMesh2dBundle};
|
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle};
|
use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle};
|
||||||
use bevy_color::{Alpha, Color, ColorToComponents, LinearRgba};
|
use bevy_color::{Alpha, Color, ColorToComponents, LinearRgba};
|
||||||
@ -157,10 +155,3 @@ impl Material2d for ColorMaterial {
|
|||||||
self.alpha_mode
|
self.alpha_mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A component bundle for entities with a [`Mesh2d`](crate::Mesh2d) and a [`ColorMaterial`].
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub type ColorMesh2dBundle = MaterialMesh2dBundle<ColorMaterial>;
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances,
|
DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances,
|
||||||
SetMesh2dBindGroup, SetMesh2dViewBindGroup,
|
SetMesh2dBindGroup, SetMesh2dViewBindGroup,
|
||||||
@ -34,11 +32,10 @@ use bevy_render::{
|
|||||||
SpecializedMeshPipelineError, SpecializedMeshPipelines,
|
SpecializedMeshPipelineError, SpecializedMeshPipelines,
|
||||||
},
|
},
|
||||||
renderer::RenderDevice,
|
renderer::RenderDevice,
|
||||||
view::{ExtractedView, InheritedVisibility, Msaa, ViewVisibility, Visibility},
|
view::{ExtractedView, Msaa, ViewVisibility},
|
||||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_render::{render_resource::BindingResources, sync_world::MainEntityHashMap};
|
use bevy_render::{render_resource::BindingResources, sync_world::MainEntityHashMap};
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
|
||||||
use bevy_utils::tracing::error;
|
use bevy_utils::tracing::error;
|
||||||
use core::{hash::Hash, marker::PhantomData};
|
use core::{hash::Hash, marker::PhantomData};
|
||||||
use derive_more::derive::From;
|
use derive_more::derive::From;
|
||||||
@ -674,36 +671,3 @@ impl<M: Material2d> RenderAsset for PreparedMaterial2d<M> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A component bundle for entities with a [`Mesh2d`] and a [`MeshMaterial2d`].
|
|
||||||
#[derive(Bundle, Clone)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Mesh2d` and `MeshMaterial2d` components instead. Inserting them will now also insert the other components required by them automatically."
|
|
||||||
)]
|
|
||||||
pub struct MaterialMesh2dBundle<M: Material2d> {
|
|
||||||
pub mesh: Mesh2d,
|
|
||||||
pub material: MeshMaterial2d<M>,
|
|
||||||
pub transform: Transform,
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// User indication of whether an entity is visible
|
|
||||||
pub visibility: Visibility,
|
|
||||||
// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
// Indication of whether an entity is visible in any view.
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<M: Material2d> Default for MaterialMesh2dBundle<M> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
mesh: Default::default(),
|
|
||||||
material: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
inherited_visibility: Default::default(),
|
|
||||||
view_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -155,16 +155,6 @@ impl<'a> TextureAtlasBuilder<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.14.0",
|
|
||||||
note = "TextureAtlasBuilder::finish() was not idiomatic. Use TextureAtlasBuilder::build() instead."
|
|
||||||
)]
|
|
||||||
pub fn finish(
|
|
||||||
&mut self,
|
|
||||||
) -> Result<(TextureAtlasLayout, TextureAtlasSources, Image), TextureAtlasBuilderError> {
|
|
||||||
self.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Consumes the builder, and returns the newly created texture atlas and
|
/// Consumes the builder, and returns the newly created texture atlas and
|
||||||
/// the associated atlas layout.
|
/// the associated atlas layout.
|
||||||
///
|
///
|
||||||
|
@ -61,9 +61,6 @@ pub use text_access::*;
|
|||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
pub use crate::Text2dBundle;
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
Font, JustifyText, LineBreak, Text2d, Text2dReader, Text2dWriter, TextColor, TextError,
|
Font, JustifyText, LineBreak, Text2d, Text2dReader, Text2dWriter, TextColor, TextError,
|
||||||
|
@ -31,18 +31,6 @@ use bevy_transform::components::Transform;
|
|||||||
use bevy_transform::prelude::GlobalTransform;
|
use bevy_transform::prelude::GlobalTransform;
|
||||||
use bevy_window::{PrimaryWindow, Window};
|
use bevy_window::{PrimaryWindow, Window};
|
||||||
|
|
||||||
/// [`Text2dBundle`] was removed in favor of required components.
|
|
||||||
/// The core component is now [`Text2d`] which can contain a single text segment.
|
|
||||||
/// Indexed access to segments can be done with the new [`Text2dReader`] and [`Text2dWriter`] system params.
|
|
||||||
/// Additional segments can be added through children with [`TextSpan`](crate::text::TextSpan).
|
|
||||||
/// Text configuration can be done with [`TextLayout`], [`TextFont`] and [`TextColor`],
|
|
||||||
/// while sprite-related configuration uses [`TextBounds`] and [`Anchor`] components.
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Text2dBundle has been migrated to required components. Follow the documentation for more information."
|
|
||||||
)]
|
|
||||||
pub struct Text2dBundle {}
|
|
||||||
|
|
||||||
/// The top-level 2D text component.
|
/// The top-level 2D text component.
|
||||||
///
|
///
|
||||||
/// Adding `Text2d` to an entity will pull in required components for setting up 2d text.
|
/// Adding `Text2d` to an entity will pull in required components for setting up 2d text.
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
#![expect(deprecated)]
|
|
||||||
use bevy_ecs::bundle::Bundle;
|
|
||||||
|
|
||||||
use crate::prelude::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
/// A [`Bundle`] of the [`Transform`] and [`GlobalTransform`]
|
|
||||||
/// [`Component`](bevy_ecs::component::Component)s, which describe the position of an entity.
|
|
||||||
///
|
|
||||||
/// * To place or move an entity, you should set its [`Transform`].
|
|
||||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
|
||||||
/// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`].
|
|
||||||
/// * ~You may use the [`TransformBundle`] to guarantee this.~
|
|
||||||
/// [`TransformBundle`] is now deprecated.
|
|
||||||
/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted.
|
|
||||||
///
|
|
||||||
/// ## [`Transform`] and [`GlobalTransform`]
|
|
||||||
///
|
|
||||||
/// [`Transform`] is the position of an entity relative to its parent position, or the reference
|
|
||||||
/// frame if it doesn't have a parent.
|
|
||||||
///
|
|
||||||
/// [`GlobalTransform`] is the position of an entity relative to the reference frame.
|
|
||||||
///
|
|
||||||
/// [`GlobalTransform`] is updated from [`Transform`] by systems in the system set
|
|
||||||
/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate).
|
|
||||||
///
|
|
||||||
/// This system runs during [`PostUpdate`](bevy_app::PostUpdate). If you
|
|
||||||
/// update the [`Transform`] of an entity in this schedule or after, you will notice a 1 frame lag
|
|
||||||
/// before the [`GlobalTransform`] is updated.
|
|
||||||
#[derive(Clone, Copy, Debug, Default, Bundle)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Transform` component instead. Inserting `Transform` will now also insert a `GlobalTransform` automatically."
|
|
||||||
)]
|
|
||||||
pub struct TransformBundle {
|
|
||||||
/// The transform of the entity.
|
|
||||||
pub local: Transform,
|
|
||||||
/// The global transform of the entity.
|
|
||||||
pub global: GlobalTransform,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TransformBundle {
|
|
||||||
/// An identity [`TransformBundle`] with no translation, rotation, and a scale of 1 on all axes.
|
|
||||||
pub const IDENTITY: Self = TransformBundle {
|
|
||||||
local: Transform::IDENTITY,
|
|
||||||
global: GlobalTransform::IDENTITY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Creates a new [`TransformBundle`] from a [`Transform`].
|
|
||||||
///
|
|
||||||
/// This initializes [`GlobalTransform`] as identity, to be updated later by the
|
|
||||||
/// [`bevy_app::PostUpdate`] schedule.
|
|
||||||
#[inline]
|
|
||||||
pub const fn from_transform(transform: Transform) -> Self {
|
|
||||||
TransformBundle {
|
|
||||||
local: transform,
|
|
||||||
..Self::IDENTITY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Transform> for TransformBundle {
|
|
||||||
#[inline]
|
|
||||||
fn from(transform: Transform) -> Self {
|
|
||||||
Self::from_transform(transform)
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,8 +23,6 @@ use {
|
|||||||
///
|
///
|
||||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
||||||
/// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`].
|
/// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`].
|
||||||
/// * ~You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.~
|
|
||||||
/// [`TransformBundle`](crate::bundles::TransformBundle) is now deprecated.
|
|
||||||
/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted.
|
/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted.
|
||||||
///
|
///
|
||||||
/// ## [`Transform`] and [`GlobalTransform`]
|
/// ## [`Transform`] and [`GlobalTransform`]
|
||||||
|
@ -14,8 +14,6 @@ use {bevy_ecs::reflect::ReflectComponent, bevy_reflect::prelude::*};
|
|||||||
/// * To place or move an entity, you should set its [`Transform`].
|
/// * To place or move an entity, you should set its [`Transform`].
|
||||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
||||||
/// * To be displayed, an entity must have both a [`Transform`] and a [`GlobalTransform`].
|
/// * To be displayed, an entity must have both a [`Transform`] and a [`GlobalTransform`].
|
||||||
/// * ~You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.~
|
|
||||||
/// [`TransformBundle`](crate::bundles::TransformBundle) is now deprecated.
|
|
||||||
/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted.
|
/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted.
|
||||||
///
|
///
|
||||||
/// ## [`Transform`] and [`GlobalTransform`]
|
/// ## [`Transform`] and [`GlobalTransform`]
|
||||||
|
@ -17,10 +17,6 @@ pub mod commands;
|
|||||||
/// The basic components of the transform crate
|
/// The basic components of the transform crate
|
||||||
pub mod components;
|
pub mod components;
|
||||||
|
|
||||||
/// Transform related bundles
|
|
||||||
#[cfg(feature = "bevy-support")]
|
|
||||||
pub mod bundles;
|
|
||||||
|
|
||||||
/// Transform related traits
|
/// Transform related traits
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
|
|
||||||
@ -40,7 +36,6 @@ pub mod systems;
|
|||||||
///
|
///
|
||||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[expect(deprecated)]
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::components::*;
|
pub use crate::components::*;
|
||||||
@ -48,7 +43,6 @@ pub mod prelude {
|
|||||||
#[cfg(feature = "bevy-support")]
|
#[cfg(feature = "bevy-support")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
bundles::TransformBundle,
|
|
||||||
commands::BuildChildrenTransformExt,
|
commands::BuildChildrenTransformExt,
|
||||||
helper::TransformHelper,
|
helper::TransformHelper,
|
||||||
plugins::{TransformPlugin, TransformSystem},
|
plugins::{TransformPlugin, TransformSystem},
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
//! This UI is laid out with the Flexbox and CSS Grid layout models (see <https://cssreference.io/flexbox/>)
|
//! This UI is laid out with the Flexbox and CSS Grid layout models (see <https://cssreference.io/flexbox/>)
|
||||||
|
|
||||||
pub mod measurement;
|
pub mod measurement;
|
||||||
pub mod node_bundles;
|
|
||||||
pub mod ui_material;
|
pub mod ui_material;
|
||||||
pub mod update;
|
pub mod update;
|
||||||
pub mod widget;
|
pub mod widget;
|
||||||
@ -49,16 +48,12 @@ pub mod prelude {
|
|||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[cfg(feature = "bevy_ui_debug")]
|
#[cfg(feature = "bevy_ui_debug")]
|
||||||
pub use crate::render::UiDebugOptions;
|
pub use crate::render::UiDebugOptions;
|
||||||
#[allow(deprecated)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub use crate::widget::TextBundle;
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::widget::{Text, TextUiReader, TextUiWriter};
|
pub use crate::widget::{Text, TextUiReader, TextUiWriter};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use {
|
pub use {
|
||||||
crate::{
|
crate::{
|
||||||
geometry::*,
|
geometry::*,
|
||||||
node_bundles::*,
|
|
||||||
ui_material::*,
|
ui_material::*,
|
||||||
ui_node::*,
|
ui_node::*,
|
||||||
widget::{Button, ImageNode, Label},
|
widget::{Button, ImageNode, Label},
|
||||||
|
@ -1,227 +0,0 @@
|
|||||||
//! This module contains basic node bundles used to build UIs
|
|
||||||
#![expect(deprecated)]
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
widget::{Button, ImageNodeSize},
|
|
||||||
BackgroundColor, BorderColor, BorderRadius, ComputedNode, ContentSize, FocusPolicy, ImageNode,
|
|
||||||
Interaction, MaterialNode, Node, ScrollPosition, UiMaterial, ZIndex,
|
|
||||||
};
|
|
||||||
use bevy_ecs::bundle::Bundle;
|
|
||||||
use bevy_render::view::{InheritedVisibility, ViewVisibility, Visibility};
|
|
||||||
use bevy_transform::prelude::{GlobalTransform, Transform};
|
|
||||||
|
|
||||||
/// The basic UI node.
|
|
||||||
///
|
|
||||||
/// Contains the [`Node`] component and other components required to make a container.
|
|
||||||
///
|
|
||||||
/// See [`node_bundles`](crate::node_bundles) for more specialized bundles like [`ImageBundle`].
|
|
||||||
#[derive(Bundle, Clone, Debug, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Node` component instead. Inserting `Node` will also insert the other components required automatically."
|
|
||||||
)]
|
|
||||||
pub struct NodeBundle {
|
|
||||||
/// Controls the layout (size and position) of the node and its children
|
|
||||||
/// This also affect how the node is drawn/painted.
|
|
||||||
pub node: Node,
|
|
||||||
/// Describes the logical size of the node
|
|
||||||
pub computed_node: ComputedNode,
|
|
||||||
/// The background color, which serves as a "fill" for this node
|
|
||||||
pub background_color: BackgroundColor,
|
|
||||||
/// The color of the Node's border
|
|
||||||
pub border_color: BorderColor,
|
|
||||||
/// The border radius of the node
|
|
||||||
pub border_radius: BorderRadius,
|
|
||||||
/// Whether this node should block interaction with lower nodes
|
|
||||||
pub focus_policy: FocusPolicy,
|
|
||||||
/// The scroll position of the node,
|
|
||||||
pub scroll_position: ScrollPosition,
|
|
||||||
/// The transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically managed by the UI layout system.
|
|
||||||
/// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems.
|
|
||||||
/// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Describes the visibility properties of the node
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Indicates the depth at which the node should appear in the UI
|
|
||||||
pub z_index: ZIndex,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A UI node that is an image
|
|
||||||
#[derive(Bundle, Debug, Default)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `ImageNode` component instead. Inserting `ImageNode` will also insert the other components required automatically."
|
|
||||||
)]
|
|
||||||
pub struct ImageBundle {
|
|
||||||
/// Describes the logical size of the node
|
|
||||||
pub computed_node: ComputedNode,
|
|
||||||
/// Controls the layout (size and position) of the node and its children
|
|
||||||
/// This also affects how the node is drawn/painted.
|
|
||||||
pub node: Node,
|
|
||||||
/// The calculated size based on the given image
|
|
||||||
pub calculated_size: ContentSize,
|
|
||||||
/// The image of the node.
|
|
||||||
///
|
|
||||||
/// To tint the image, change the `color` field of this component.
|
|
||||||
pub image: ImageNode,
|
|
||||||
/// The color of the background that will fill the containing node.
|
|
||||||
pub background_color: BackgroundColor,
|
|
||||||
/// The border radius of the node
|
|
||||||
pub border_radius: BorderRadius,
|
|
||||||
/// The size of the image in pixels
|
|
||||||
///
|
|
||||||
/// This component is set automatically
|
|
||||||
pub image_size: ImageNodeSize,
|
|
||||||
/// Whether this node should block interaction with lower nodes
|
|
||||||
pub focus_policy: FocusPolicy,
|
|
||||||
/// The transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically managed by the UI layout system.
|
|
||||||
/// To alter the position of the `ImageBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Describes the visibility properties of the node
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Indicates the depth at which the node should appear in the UI
|
|
||||||
pub z_index: ZIndex,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A UI node that is a button
|
|
||||||
#[derive(Bundle, Clone, Debug)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `Button` component instead. Inserting `Button` will also insert the other components required automatically."
|
|
||||||
)]
|
|
||||||
pub struct ButtonBundle {
|
|
||||||
/// Describes the logical size of the node
|
|
||||||
pub computed_node: ComputedNode,
|
|
||||||
/// Marker component that signals this node is a button
|
|
||||||
pub button: Button,
|
|
||||||
/// Controls the layout (size and position) of the node and its children
|
|
||||||
/// Also affect how the node is drawn/painted.
|
|
||||||
pub node: Node,
|
|
||||||
/// Describes whether and how the button has been interacted with by the input
|
|
||||||
pub interaction: Interaction,
|
|
||||||
/// Whether this node should block interaction with lower nodes
|
|
||||||
pub focus_policy: FocusPolicy,
|
|
||||||
/// The color of the Node's border
|
|
||||||
pub border_color: BorderColor,
|
|
||||||
/// The border radius of the node
|
|
||||||
pub border_radius: BorderRadius,
|
|
||||||
/// The image of the node
|
|
||||||
pub image: ImageNode,
|
|
||||||
/// The background color that will fill the containing node
|
|
||||||
pub background_color: BackgroundColor,
|
|
||||||
/// The transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically managed by the UI layout system.
|
|
||||||
/// To alter the position of the `ButtonBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform of the node
|
|
||||||
///
|
|
||||||
/// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Describes the visibility properties of the node
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Indicates the depth at which the node should appear in the UI
|
|
||||||
pub z_index: ZIndex,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for ButtonBundle {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
node: Default::default(),
|
|
||||||
computed_node: Default::default(),
|
|
||||||
button: Default::default(),
|
|
||||||
interaction: Default::default(),
|
|
||||||
focus_policy: FocusPolicy::Block,
|
|
||||||
border_color: Default::default(),
|
|
||||||
border_radius: Default::default(),
|
|
||||||
image: Default::default(),
|
|
||||||
background_color: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
inherited_visibility: Default::default(),
|
|
||||||
view_visibility: Default::default(),
|
|
||||||
z_index: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A UI node that is rendered using a [`UiMaterial`]
|
|
||||||
///
|
|
||||||
/// Adding a `BackgroundColor` component to an entity with this bundle will ignore the custom
|
|
||||||
/// material and use the background color instead.
|
|
||||||
#[derive(Bundle, Clone, Debug)]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "Use the `MaterialNode` component instead. Inserting `MaterialNode` will also insert the other components required automatically."
|
|
||||||
)]
|
|
||||||
pub struct MaterialNodeBundle<M: UiMaterial> {
|
|
||||||
/// Describes the logical size of the node
|
|
||||||
pub computed_node: ComputedNode,
|
|
||||||
/// Controls the layout (size and position) of the node and its children
|
|
||||||
/// Also affects how the node is drawn/painted.
|
|
||||||
pub node: Node,
|
|
||||||
/// The [`UiMaterial`] used to render the node.
|
|
||||||
pub material: MaterialNode<M>,
|
|
||||||
/// Whether this node should block interaction with lower nodes
|
|
||||||
pub focus_policy: FocusPolicy,
|
|
||||||
/// The transform of the node
|
|
||||||
///
|
|
||||||
/// This field is automatically managed by the UI layout system.
|
|
||||||
/// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub transform: Transform,
|
|
||||||
/// The global transform of the node
|
|
||||||
///
|
|
||||||
/// This field is automatically managed by the UI layout system.
|
|
||||||
/// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component.
|
|
||||||
pub global_transform: GlobalTransform,
|
|
||||||
/// Describes the visibility properties of the node
|
|
||||||
pub visibility: Visibility,
|
|
||||||
/// Inherited visibility of an entity.
|
|
||||||
pub inherited_visibility: InheritedVisibility,
|
|
||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
|
||||||
pub view_visibility: ViewVisibility,
|
|
||||||
/// Indicates the depth at which the node should appear in the UI
|
|
||||||
pub z_index: ZIndex,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<M: UiMaterial> Default for MaterialNodeBundle<M> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
node: Default::default(),
|
|
||||||
computed_node: Default::default(),
|
|
||||||
material: Default::default(),
|
|
||||||
focus_policy: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
inherited_visibility: Default::default(),
|
|
||||||
view_visibility: Default::default(),
|
|
||||||
z_index: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -48,18 +48,6 @@ impl Default for TextNodeFlags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [`TextBundle`] was removed in favor of required components.
|
|
||||||
/// The core component is now [`Text`] which can contain a single text segment.
|
|
||||||
/// Indexed access to segments can be done with the new [`TextUiReader`] and [`TextUiWriter`] system params.
|
|
||||||
/// Additional segments can be added through children with [`TextSpan`](bevy_text::TextSpan).
|
|
||||||
/// Text configuration can be done with [`TextLayout`], [`TextFont`] and [`TextColor`],
|
|
||||||
/// while node-related configuration uses [`TextNodeFlags`] component.
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.15.0",
|
|
||||||
note = "TextBundle has been migrated to required components. Follow the documentation for more information."
|
|
||||||
)]
|
|
||||||
pub struct TextBundle {}
|
|
||||||
|
|
||||||
/// The top-level UI text component.
|
/// The top-level UI text component.
|
||||||
///
|
///
|
||||||
/// Adding [`Text`] to an entity will pull in required components for setting up a UI text node.
|
/// Adding [`Text`] to an entity will pull in required components for setting up a UI text node.
|
||||||
|
@ -34,7 +34,7 @@ fn setup_cube(
|
|||||||
// cube
|
// cube
|
||||||
parent.spawn((
|
parent.spawn((
|
||||||
Mesh3d(meshes.add(Cuboid::default())),
|
Mesh3d(meshes.add(Cuboid::default())),
|
||||||
MeshMaterial3d(materials.add(Color::rgb(0.8, 0.7, 0.6))),
|
MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
|
||||||
Transform::from_xyz(0.0, 0.5, 0.0),
|
Transform::from_xyz(0.0, 0.5, 0.0),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
@ -77,7 +77,7 @@ fn setup_cube(
|
|||||||
// cube
|
// cube
|
||||||
parent.spawn((
|
parent.spawn((
|
||||||
Mesh3d(meshes.add(Cuboid::default())),
|
Mesh3d(meshes.add(Cuboid::default())),
|
||||||
MeshMaterial3d(materials.add(Color::rgb(0.8, 0.7, 0.6))),
|
MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
|
||||||
Transform::from_xyz(0.0, 0.5, 0.0),
|
Transform::from_xyz(0.0, 0.5, 0.0),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
@ -148,9 +148,7 @@ fn main() {
|
|||||||
let mut builder = QueryBuilder::<FilteredEntityMut>::new(&mut world);
|
let mut builder = QueryBuilder::<FilteredEntityMut>::new(&mut world);
|
||||||
parse_query(rest, &mut builder, &component_names);
|
parse_query(rest, &mut builder, &component_names);
|
||||||
let mut query = builder.build();
|
let mut query = builder.build();
|
||||||
|
|
||||||
query.iter_mut(&mut world).for_each(|filtered_entity| {
|
query.iter_mut(&mut world).for_each(|filtered_entity| {
|
||||||
#[allow(deprecated)]
|
|
||||||
let terms = filtered_entity
|
let terms = filtered_entity
|
||||||
.access()
|
.access()
|
||||||
.component_reads_and_writes()
|
.component_reads_and_writes()
|
||||||
|
Loading…
Reference in New Issue
Block a user