From 881f660433f07789840f8d0e83d2f7186e3640be Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:09:06 +0100 Subject: [PATCH] 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. --- crates/bevy_render/src/camera/camera.rs | 6 ++++-- crates/bevy_render/src/camera/mod.rs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index f12faea44e..8b7f222a81 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -975,7 +975,8 @@ pub fn sort_cameras( /// Do not use with [`OrthographicProjection`]. /// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection -#[derive(Component, Clone, Default)] +#[derive(Component, Clone, Default, Reflect)] +#[reflect(Default, Component)] pub struct TemporalJitter { /// Offset is in range [-0.5, 0.5]. pub offset: Vec2, @@ -1001,5 +1002,6 @@ impl TemporalJitter { /// 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. -#[derive(Component)] +#[derive(Default, Component, Reflect)] +#[reflect(Default, Component)] pub struct MipBias(pub f32); diff --git a/crates/bevy_render/src/camera/mod.rs b/crates/bevy_render/src/camera/mod.rs index a0ea405400..a1e02be219 100644 --- a/crates/bevy_render/src/camera/mod.rs +++ b/crates/bevy_render/src/camera/mod.rs @@ -33,6 +33,8 @@ impl Plugin for CameraPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() + .register_type::() .init_resource::() .init_resource::() .add_plugins((