From f987920bbd073af6ceeffa2c48459b7df0c0442b Mon Sep 17 00:00:00 2001 From: atlv Date: Sat, 5 Jul 2025 10:40:28 -0400 Subject: [PATCH] Move CubemapLayout out of decal code (#19960) # Objective - Make bevy_light possible by making it possible to split out clusterable into bevy_camera ## Solution - Move cubemap stuff next to cubemap stuff. ## Testing - 3d_scene runs Note: no breaking changes thanks to re-exports --- crates/bevy_camera/src/primitives.rs | 36 +++++++++++++++++++++++++ crates/bevy_pbr/src/decal/clustered.rs | 37 +------------------------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/crates/bevy_camera/src/primitives.rs b/crates/bevy_camera/src/primitives.rs index ddde695423..e08422b052 100644 --- a/crates/bevy_camera/src/primitives.rs +++ b/crates/bevy_camera/src/primitives.rs @@ -363,6 +363,42 @@ impl CubemapFrusta { } } +/// Cubemap layout defines the order of images in a packed cubemap image. +#[derive(Default, Reflect, Debug, Clone, Copy)] +pub enum CubemapLayout { + /// layout in a vertical cross format + /// ```text + /// +y + /// -x -z +x + /// -y + /// +z + /// ``` + #[default] + CrossVertical = 0, + /// layout in a horizontal cross format + /// ```text + /// +y + /// -x -z +x +z + /// -y + /// ``` + CrossHorizontal = 1, + /// layout in a vertical sequence + /// ```text + /// +x + /// -y + /// +y + /// -y + /// -z + /// +z + /// ``` + SequenceVertical = 2, + /// layout in a horizontal sequence + /// ```text + /// +x -y +y -y -z +z + /// ``` + SequenceHorizontal = 3, +} + #[derive(Component, Debug, Default, Reflect, Clone)] #[reflect(Component, Default, Debug, Clone)] pub struct CascadesFrusta { diff --git a/crates/bevy_pbr/src/decal/clustered.rs b/crates/bevy_pbr/src/decal/clustered.rs index ec386670ec..d89c91c7ab 100644 --- a/crates/bevy_pbr/src/decal/clustered.rs +++ b/crates/bevy_pbr/src/decal/clustered.rs @@ -32,6 +32,7 @@ use bevy_image::Image; use bevy_math::Mat4; use bevy_platform::collections::HashMap; use bevy_reflect::Reflect; +pub use bevy_render::primitives::CubemapLayout; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin}, load_shader_library, @@ -95,42 +96,6 @@ pub struct ClusteredDecal { pub tag: u32, } -/// Cubemap layout defines the order of images in a packed cubemap image. -#[derive(Default, Reflect, Debug, Clone, Copy)] -pub enum CubemapLayout { - /// layout in a vertical cross format - /// ```text - /// +y - /// -x -z +x - /// -y - /// +z - /// ``` - #[default] - CrossVertical = 0, - /// layout in a horizontal cross format - /// ```text - /// +y - /// -x -z +x +z - /// -y - /// ``` - CrossHorizontal = 1, - /// layout in a vertical sequence - /// ```text - /// +x - /// -y - /// +y - /// -y - /// -z - /// +z - /// ``` - SequenceVertical = 2, - /// layout in a horizontal sequence - /// ```text - /// +x -y +y -y -z +z - /// ``` - SequenceHorizontal = 3, -} - /// Add to a [`PointLight`] to add a light texture effect. /// A texture mask is applied to the light source to modulate its intensity, /// simulating patterns like window shadows, gobo/cookie effects, or soft falloffs.