pub struct GlslMaterialBlock;Expand description
Generates GLSL source code for a uniform block that matches the layout of
a PbrMaterial. Use this to keep CPU-side structs and shaders in sync.
Implementations§
Source§impl GlslMaterialBlock
impl GlslMaterialBlock
Sourcepub fn uniform_block(binding: u32) -> String
pub fn uniform_block(binding: u32) -> String
Returns a GLSL uniform block declaration string that mirrors
PbrMaterial. The binding parameter sets the UBO binding point.
Sourcepub fn sampler_uniforms(base_binding: u32) -> String
pub fn sampler_uniforms(base_binding: u32) -> String
Returns GLSL sampler uniform declarations for all optional PBR textures.
Sourcepub fn read_material_fn() -> &'static str
pub fn read_material_fn() -> &'static str
Returns a GLSL function that reads all PBR inputs from the uniforms and textures above, and returns them in local variables with the given name prefix.
Sourcepub fn fragment_shader_source(ubo_binding: u32, tex_base: u32) -> String
pub fn fragment_shader_source(ubo_binding: u32, tex_base: u32) -> String
Generate a complete minimal PBR fragment shader source that uses all of the blocks defined above.
Auto Trait Implementations§
impl Freeze for GlslMaterialBlock
impl RefUnwindSafe for GlslMaterialBlock
impl Send for GlslMaterialBlock
impl Sync for GlslMaterialBlock
impl Unpin for GlslMaterialBlock
impl UnsafeUnpin for GlslMaterialBlock
impl UnwindSafe for GlslMaterialBlock
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.