pub struct GBufferLayout {
pub color_attachments: Vec<GBufferAttachment>,
pub depth_attachment: GBufferAttachment,
pub max_color_attachments: u32,
pub use_octahedral_normals: bool,
pub thin_gbuffer: bool,
}Expand description
Describes the full set of attachments in a G-Buffer.
The default layout provides:
- Position (RGBA32F) at color attachment 0
- Normal (RG16F, octahedral encoding) at color attachment 1
- Albedo (RGBA8) at color attachment 2
- Emission (RGBA16F) at color attachment 3
- MaterialID (R8) at color attachment 4
- Roughness (R8) at color attachment 5
- Metallic (R8) at color attachment 6
- Depth (D32F) as the depth attachment
Fields§
§color_attachments: Vec<GBufferAttachment>Ordered list of color attachments.
depth_attachment: GBufferAttachmentThe depth (or depth-stencil) attachment.
max_color_attachments: u32Maximum number of simultaneous render targets supported.
use_octahedral_normals: boolWhether to use octahedral normal encoding (saves bandwidth vs RGBA16F).
thin_gbuffer: boolWhether thin G-Buffer packing is enabled (combine roughness+metallic into one RG8).
Implementations§
Source§impl GBufferLayout
impl GBufferLayout
Sourcepub fn default_layout() -> Self
pub fn default_layout() -> Self
Create the default G-Buffer layout used by the deferred pipeline.
Sourcepub fn thin_layout() -> Self
pub fn thin_layout() -> Self
Create a thin/minimal G-Buffer layout that packs more data per attachment. Uses fewer render targets at the cost of some precision.
Sourcepub fn add_color_attachment(&mut self, attachment: GBufferAttachment)
pub fn add_color_attachment(&mut self, attachment: GBufferAttachment)
Add a color attachment to the layout.
Sourcepub fn remove_attachment(&mut self, semantic: GBufferSemantic) -> bool
pub fn remove_attachment(&mut self, semantic: GBufferSemantic) -> bool
Remove a color attachment by semantic.
Sourcepub fn find_attachment(
&self,
semantic: GBufferSemantic,
) -> Option<&GBufferAttachment>
pub fn find_attachment( &self, semantic: GBufferSemantic, ) -> Option<&GBufferAttachment>
Find an attachment by semantic.
Sourcepub fn find_attachment_mut(
&mut self,
semantic: GBufferSemantic,
) -> Option<&mut GBufferAttachment>
pub fn find_attachment_mut( &mut self, semantic: GBufferSemantic, ) -> Option<&mut GBufferAttachment>
Find an attachment by semantic (mutable).
Sourcepub fn color_attachment_count(&self) -> u32
pub fn color_attachment_count(&self) -> u32
Total number of color attachments.
Sourcepub fn total_memory_bytes(&self, width: u32, height: u32) -> u64
pub fn total_memory_bytes(&self, width: u32, height: u32) -> u64
Calculate total memory usage for a given resolution.
Trait Implementations§
Source§impl Clone for GBufferLayout
impl Clone for GBufferLayout
Source§fn clone(&self) -> GBufferLayout
fn clone(&self) -> GBufferLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GBufferLayout
impl Debug for GBufferLayout
Auto Trait Implementations§
impl Freeze for GBufferLayout
impl RefUnwindSafe for GBufferLayout
impl Send for GBufferLayout
impl Sync for GBufferLayout
impl Unpin for GBufferLayout
impl UnsafeUnpin for GBufferLayout
impl UnwindSafe for GBufferLayout
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.