Make TemporalJitter and MipBias reflectable (#12132)

# Objective

- Make these types usable in reflection-based workflows.

## Solution

- The usual. Also reflect `Default` and `Component` behaviors so that
the types can be constructed, inserted, and removed.
This commit is contained in:
Sludge 2024-02-26 19:09:06 +01:00 committed by GitHub
parent 1f2b5fcb2f
commit 881f660433
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -975,7 +975,8 @@ pub fn sort_cameras(
/// Do not use with [`OrthographicProjection`]. /// Do not use with [`OrthographicProjection`].
/// ///
/// [`OrthographicProjection`]: crate::camera::OrthographicProjection /// [`OrthographicProjection`]: crate::camera::OrthographicProjection
#[derive(Component, Clone, Default)] #[derive(Component, Clone, Default, Reflect)]
#[reflect(Default, Component)]
pub struct TemporalJitter { pub struct TemporalJitter {
/// Offset is in range [-0.5, 0.5]. /// Offset is in range [-0.5, 0.5].
pub offset: Vec2, pub offset: Vec2,
@ -1001,5 +1002,6 @@ impl TemporalJitter {
/// Camera component specifying a mip bias to apply when sampling from material textures. /// Camera component specifying a mip bias to apply when sampling from material textures.
/// ///
/// Often used in conjunction with antialiasing post-process effects to reduce textures blurriness. /// Often used in conjunction with antialiasing post-process effects to reduce textures blurriness.
#[derive(Component)] #[derive(Default, Component, Reflect)]
#[reflect(Default, Component)]
pub struct MipBias(pub f32); pub struct MipBias(pub f32);

View file

@ -33,6 +33,8 @@ impl Plugin for CameraPlugin {
.register_type::<CameraRenderGraph>() .register_type::<CameraRenderGraph>()
.register_type::<CameraMainTextureUsages>() .register_type::<CameraMainTextureUsages>()
.register_type::<Exposure>() .register_type::<Exposure>()
.register_type::<TemporalJitter>()
.register_type::<MipBias>()
.init_resource::<ManualTextureViews>() .init_resource::<ManualTextureViews>()
.init_resource::<ClearColor>() .init_resource::<ClearColor>()
.add_plugins(( .add_plugins((