pub struct BackgroundSettings { /* private fields */ }Expand description
Background rendering configuration (mode + automatic uniform version control).
Wraps BackgroundMode together with a CpuBuffer<SkyboxParamsUniforms>
whose version is automatically bumped only when setter methods write new
values. The render pass only calls ensure_buffer_id() — no per-frame
buffer writes occur in the render pipeline.
§Usage
// Set mode (automatically syncs uniform values)
scene.background.set_mode(BackgroundMode::equirectangular(tex, 1.0));
// Fine-tune individual parameters
scene.background.set_rotation(0.5);
scene.background.set_intensity(2.0);Implementations§
Source§impl BackgroundSettings
impl BackgroundSettings
Sourcepub fn mode(&self) -> &BackgroundMode
pub fn mode(&self) -> &BackgroundMode
Returns a reference to the current background mode.
Sourcepub fn set_mode(&mut self, mode: BackgroundMode)
pub fn set_mode(&mut self, mode: BackgroundMode)
Sets the background mode and syncs uniform values accordingly.
The CpuBuffer version is bumped only if the derived uniform values
actually differ from the current state.
Sourcepub fn set_rotation(&mut self, rotation: f32)
pub fn set_rotation(&mut self, rotation: f32)
Sets the Y-axis rotation (radians) for texture-based backgrounds.
Also updates the rotation field inside BackgroundMode::Texture
to keep the enum and buffer in sync.
Sourcepub fn set_intensity(&mut self, intensity: f32)
pub fn set_intensity(&mut self, intensity: f32)
Sets the brightness/exposure multiplier for texture-based backgrounds.
Also updates the intensity field inside BackgroundMode::Texture
to keep the enum and buffer in sync.
Sourcepub fn set_gradient_colors(&mut self, top: Vec4, bottom: Vec4)
pub fn set_gradient_colors(&mut self, top: Vec4, bottom: Vec4)
Sets gradient colors (top and bottom).
Switches the mode to Gradient if it isn’t already.
Sourcepub fn clear_color(&self) -> Color
pub fn clear_color(&self) -> Color
Returns the clear color for the RenderPass.
Sourcepub fn needs_skybox_pass(&self) -> bool
pub fn needs_skybox_pass(&self) -> bool
Returns true if the current mode requires a skybox draw call.
Trait Implementations§
Source§impl Clone for BackgroundSettings
impl Clone for BackgroundSettings
Source§fn clone(&self) -> BackgroundSettings
fn clone(&self) -> BackgroundSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BackgroundSettings
impl Debug for BackgroundSettings
Source§impl Default for BackgroundSettings
impl Default for BackgroundSettings
Source§fn default() -> BackgroundSettings
fn default() -> BackgroundSettings
Auto Trait Implementations§
impl !Freeze for BackgroundSettings
impl !RefUnwindSafe for BackgroundSettings
impl Send for BackgroundSettings
impl Sync for BackgroundSettings
impl Unpin for BackgroundSettings
impl UnsafeUnpin for BackgroundSettings
impl UnwindSafe for BackgroundSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().