pub enum BackgroundMode {
Color(Vec4),
Gradient {
top: Vec4,
bottom: Vec4,
},
Texture {
source: TextureSource,
rotation: f32,
intensity: f32,
mapping: BackgroundMapping,
},
}Expand description
Background rendering mode.
Determines how the scene background is rendered. Each variant maps to a different shader pipeline variant for optimal performance.
§Performance
Color: Uses GPU hardware clear — zero draw calls, maximum throughput.Gradient: Renders a fullscreen triangle with per-vertex interpolation.Texture: Renders a fullscreen triangle with texture sampling + ray reconstruction.
Variants§
Color(Vec4)
Solid color clear (most efficient).
Uses the GPU’s hardware clear operation — no draw calls needed. Alpha channel can be used for post-composition (typically 1.0).
Gradient
Vertical gradient (sky color → ground color).
Renders a fullscreen triangle with smooth interpolation based on view direction’s Y component.
Fields
Texture
Texture-based background (skybox / panorama / planar).
Renders a fullscreen triangle with ray reconstruction from the depth buffer, sampling the background texture along the view direction.
Fields
source: TextureSourceTexture source (asset handle or attachment)
mapping: BackgroundMappingTexture mapping method
Implementations§
Source§impl BackgroundMode
impl BackgroundMode
Sourcepub fn color_with_alpha(r: f32, g: f32, b: f32, a: f32) -> BackgroundMode
pub fn color_with_alpha(r: f32, g: f32, b: f32, a: f32) -> BackgroundMode
Creates a solid color background with alpha.
Sourcepub fn gradient(top: Vec4, bottom: Vec4) -> BackgroundMode
pub fn gradient(top: Vec4, bottom: Vec4) -> BackgroundMode
Creates a vertical gradient background.
Sourcepub fn cubemap(
source: impl Into<TextureSource>,
intensity: f32,
) -> BackgroundMode
pub fn cubemap( source: impl Into<TextureSource>, intensity: f32, ) -> BackgroundMode
Creates a cubemap skybox background.
Sourcepub fn equirectangular(
source: impl Into<TextureSource>,
intensity: f32,
) -> BackgroundMode
pub fn equirectangular( source: impl Into<TextureSource>, intensity: f32, ) -> BackgroundMode
Creates an equirectangular panorama background.
Sourcepub fn planar(
source: impl Into<TextureSource>,
intensity: f32,
) -> BackgroundMode
pub fn planar( source: impl Into<TextureSource>, intensity: f32, ) -> BackgroundMode
Creates a planar (screen-space) background.
Sourcepub fn clear_color(&self) -> Color
pub fn clear_color(&self) -> Color
Returns the clear color for the RenderPass.
Colormode: returns the specified color (hardware clear).- Other modes: returns black (skybox pass will overdraw).
Sourcepub fn needs_skybox_pass(&self) -> bool
pub fn needs_skybox_pass(&self) -> bool
Returns true if this mode requires a skybox draw call.
Color mode uses hardware clear and needs no draw call.
Trait Implementations§
Source§impl Clone for BackgroundMode
impl Clone for BackgroundMode
Source§fn clone(&self) -> BackgroundMode
fn clone(&self) -> BackgroundMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BackgroundMode
impl Debug for BackgroundMode
Source§impl Default for BackgroundMode
impl Default for BackgroundMode
Source§fn default() -> BackgroundMode
fn default() -> BackgroundMode
Auto Trait Implementations§
impl Freeze for BackgroundMode
impl RefUnwindSafe for BackgroundMode
impl Send for BackgroundMode
impl Sync for BackgroundMode
impl Unpin for BackgroundMode
impl UnsafeUnpin for BackgroundMode
impl UnwindSafe for BackgroundMode
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().