Migrate fog volumes to required components (#15568)
# Objective Another part of the migration to required components: fog volumes! ## Solution Deprecate `FogVolumeBundle` and make `FogVolume` require `Transform` and `Visibility`, as per the [chosen proposal](https://hackmd.io/@bevy/required_components/%2FcO7JPSAQR5G0J_j5wNwtOQ). --- ## Migration Guide Replace all insertions of `FogVolumeBundle` with the `Visibility` component. The other components required by it will now be inserted automatically.
This commit is contained in:
parent
40e88dceff
commit
0fe17b8b30
@ -29,6 +29,8 @@
|
||||
//!
|
||||
//! [Henyey-Greenstein phase function]: https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions#TheHenyeyndashGreensteinPhaseFunction
|
||||
|
||||
#![expect(deprecated)]
|
||||
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_asset::{load_internal_asset, Assets, Handle};
|
||||
use bevy_color::Color;
|
||||
@ -121,6 +123,10 @@ 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,
|
||||
@ -139,6 +145,7 @@ pub struct FogVolumeBundle {
|
||||
|
||||
#[derive(Clone, Component, Debug, Reflect)]
|
||||
#[reflect(Component, Default, Debug)]
|
||||
#[require(Transform, Visibility)]
|
||||
pub struct FogVolume {
|
||||
/// The color of the fog.
|
||||
///
|
||||
|
@ -4,7 +4,7 @@ use bevy::{
|
||||
color::palettes::css::RED,
|
||||
core_pipeline::{bloom::Bloom, tonemapping::Tonemapping, Skybox},
|
||||
math::vec3,
|
||||
pbr::{FogVolumeBundle, VolumetricFog, VolumetricLight},
|
||||
pbr::{FogVolume, VolumetricFog, VolumetricLight},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
@ -122,10 +122,10 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, app_settings: R
|
||||
));
|
||||
|
||||
// Add the fog volume.
|
||||
commands.spawn(FogVolumeBundle {
|
||||
transform: Transform::from_scale(Vec3::splat(35.0)),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
FogVolume::default(),
|
||||
Transform::from_scale(Vec3::splat(35.0)),
|
||||
));
|
||||
|
||||
// Add the help text.
|
||||
commands.spawn(
|
||||
|
Loading…
Reference in New Issue
Block a user