From 6ab8e0d9c745aa87379cee418d0a684895a4f304 Mon Sep 17 00:00:00 2001 From: atlv Date: Sat, 5 Jul 2025 13:05:14 -0400 Subject: [PATCH] move ShadowsEnabled to material (#19963) # Objective - Make bevy_light possible ## Solution - Move non-light stuff out of light module (its a marker for whether a material should cast shadows: thats a material property not a light property) ## Testing - 3d_scene runs --- crates/bevy_pbr/src/light/mod.rs | 12 +----------- crates/bevy_pbr/src/material.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/bevy_pbr/src/light/mod.rs b/crates/bevy_pbr/src/light/mod.rs index 663b9f52c3..f73cebdba3 100644 --- a/crates/bevy_pbr/src/light/mod.rs +++ b/crates/bevy_pbr/src/light/mod.rs @@ -17,7 +17,7 @@ use bevy_render::{ }; use bevy_transform::components::{GlobalTransform, Transform}; use bevy_utils::Parallel; -use core::{marker::PhantomData, ops::DerefMut}; +use core::ops::DerefMut; use crate::*; pub use light::spot_light::{spot_light_clip_from_view, spot_light_world_from_view}; @@ -91,16 +91,6 @@ pub mod light_consts { } } -/// Marker resource for whether shadows are enabled for this material type -#[derive(Resource, Debug)] -pub struct ShadowsEnabled(PhantomData); - -impl Default for ShadowsEnabled { - fn default() -> Self { - Self(PhantomData) - } -} - /// Controls the resolution of [`PointLight`] shadow maps. /// /// ``` diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index bb1f9afde3..cc3a69a0ad 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -1717,3 +1717,13 @@ pub fn write_material_bind_group_buffers( allocator.write_buffers(&render_device, &render_queue); } } + +/// Marker resource for whether shadows are enabled for this material type +#[derive(Resource, Debug)] +pub struct ShadowsEnabled(PhantomData); + +impl Default for ShadowsEnabled { + fn default() -> Self { + Self(PhantomData) + } +}