pub struct PbrMaterial {
pub label: String,
pub albedo: (f32, f32, f32, f32),
pub albedo_t: Option<Handle<Texture>>,
pub metallic: f32,
pub roughness: f32,
pub metallic_roughness_t: Option<Handle<Texture>>,
pub normal_t: Option<Handle<Texture>>,
pub occlusion_t: Option<Handle<Texture>>,
pub uniform_buffer: Option<Handle<Buffer>>,
}Expand description
Describes a physically based rendering material. It contains the material properties such as albedo color, metallic and roughness intensity, as well as the textures for these properties. It also contains a uniform buffer that is automatically created and updated with the material data, which can be used in the shader to access the material properties. The PbrMaterial3d component is a wrapper around a handle to a PbrMaterial asset, which also adds the [PbrSsboTransformMarker] to the entity, indicating that its transform should be included in the PbrSsboTransform updates.
Fields§
§label: String§albedo: (f32, f32, f32, f32)The albedo color of the material instance (r, g, b). The alpha channel is unused.
albedo_t: Option<Handle<Texture>>The albedo texture of the material instance. If None, the material will use the albedo color.
metallic: f32The metallic intensity of the material instance.
roughness: f32The roughness intensity of the material instance.
metallic_roughness_t: Option<Handle<Texture>>The metallic-roughness texture of the material instance. If None, the material will use the metallic and roughness scalar intensity.
The metallic value is stored in the blue channel, and the roughness value is stored in the green channel.
normal_t: Option<Handle<Texture>>The normal texture of the material instance. The normal map is expected to be in tangent space. The alpha channel is unused.
occlusion_t: Option<Handle<Texture>>The occlusion texture of the material instance. The occlusion value is stored in the red channel.
uniform_buffer: Option<Handle<Buffer>>The buffer containing the material data. It is automatically created and updated if not set.
Trait Implementations§
Source§impl Clone for PbrMaterial
impl Clone for PbrMaterial
Source§fn clone(&self) -> PbrMaterial
fn clone(&self) -> PbrMaterial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for PbrMaterial
impl Default for PbrMaterial
Source§impl RenderBinding for PbrMaterial
impl RenderBinding for PbrMaterial
type Params = (Res<'static, AssetServer>, Res<'static, PlaceholderTexture>)
Source§fn describe(
&mut self,
(asset_server, placeholder_tex): &SystemParamItem<'_, '_, Self::Params>,
builder: &mut RenderBindingBuilder,
)
fn describe( &mut self, (asset_server, placeholder_tex): &SystemParamItem<'_, '_, Self::Params>, builder: &mut RenderBindingBuilder, )
RenderData that should be used to create the bind group layout and bind group entries, and to specify the binding index for each buffer and texture.Source§impl TypePath for PbrMaterial
impl TypePath for PbrMaterial
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl VisitAssetDependencies for PbrMaterial
impl VisitAssetDependencies for PbrMaterial
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Asset for PbrMaterial
Auto Trait Implementations§
impl Freeze for PbrMaterial
impl !RefUnwindSafe for PbrMaterial
impl Send for PbrMaterial
impl Sync for PbrMaterial
impl Unpin for PbrMaterial
impl !UnwindSafe for PbrMaterial
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path].§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
TypePath::short_type_path].§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident].§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name].§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
TypePath::module_path].§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more