pub struct ParallaxMaterialUniform {
pub base_color: Vec4,
pub emissive: Vec4,
pub roughness: f32,
pub metallic: f32,
pub reflectance: f32,
pub flags: u32,
pub alpha_cutoff: f32,
pub height_depth: f32,
pub max_height_layers: f32,
}
Expand description
The GPU representation of the uniform data of a ParallaxMaterial
.
Fields
base_color: Vec4
Doubles as diffuse albedo for non-metallic, specular for metallic and a mix for everything in between.
emissive: Vec4
Use a color for user friendliness even though we technically don’t use the alpha channel Might be used in the future for exposure correction in HDR
roughness: f32
Linear perceptual roughness, clamped to [0.089, 1.0] in the shader Defaults to minimum of 0.089
metallic: f32
From [0.0, 1.0], dielectric to pure metallic
reflectance: f32
Specular intensity for non-metals on a linear scale of [0.0, 1.0] defaults to 0.5 which is mapped to 4% reflectance in the shader
flags: u32
The shader flags.
alpha_cutoff: f32
When the alpha mode mask flag is set, any base color alpha above this cutoff means fully opaque, and any below means fully transparent.
height_depth: f32
The depth of the height map.
max_height_layers: f32
In how many layers to split the height maps for Steep parallax mapping.
If your height_depth
is >0.1 and you are seeing jaggy edges,
increase this value. However, this incures a performance cost.
Trait Implementations
sourceimpl AsBindGroupShaderType<ParallaxMaterialUniform> for ParallaxMaterial
impl AsBindGroupShaderType<ParallaxMaterialUniform> for ParallaxMaterial
sourcefn as_bind_group_shader_type(
&self,
images: &RenderAssets<Image>
) -> ParallaxMaterialUniform
fn as_bind_group_shader_type(
&self,
images: &RenderAssets<Image>
) -> ParallaxMaterialUniform
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl Clone for ParallaxMaterialUniform
impl Clone for ParallaxMaterialUniform
sourcefn clone(&self) -> ParallaxMaterialUniform
fn clone(&self) -> ParallaxMaterialUniform
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl CreateFrom for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: CreateFrom,
Vec4: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
u32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
impl CreateFrom for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: CreateFrom,
Vec4: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
u32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
f32: CreateFrom,
fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self
sourceimpl Default for ParallaxMaterialUniform
impl Default for ParallaxMaterialUniform
sourcefn default() -> ParallaxMaterialUniform
fn default() -> ParallaxMaterialUniform
sourceimpl ReadFrom for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: ReadFrom,
Vec4: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
u32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
impl ReadFrom for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: ReadFrom,
Vec4: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
u32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
f32: ReadFrom,
sourceimpl ShaderSize for ParallaxMaterialUniformwhere
Vec4: ShaderSize,
Vec4: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
u32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
impl ShaderSize for ParallaxMaterialUniformwhere
Vec4: ShaderSize,
Vec4: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
u32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
f32: ShaderSize,
const SHADER_SIZE: NonZeroU64 = Self::METADATA.min_size().0
const SHADER_SIZE: NonZeroU64 = Self::METADATA.min_size().0
ShaderType::min_size
])sourceimpl ShaderType for ParallaxMaterialUniformwhere
Vec4: ShaderType + ShaderSize,
Vec4: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
u32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType,
impl ShaderType for ParallaxMaterialUniformwhere
Vec4: ShaderType + ShaderSize,
Vec4: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
u32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
f32: ShaderType,
sourcefn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Self
at runtime Read morefn min_size() -> NonZeroU64
fn min_size() -> NonZeroU64
fn assert_uniform_compat()
fn assert_uniform_compat()
Self
meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read moresourceimpl WriteInto for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: WriteInto,
Vec4: WriteInto,
f32: WriteInto,
f32: WriteInto,
f32: WriteInto,
u32: WriteInto,
f32: WriteInto,
f32: WriteInto,
f32: WriteInto,
impl WriteInto for ParallaxMaterialUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<{ _ }>>,
Vec4: WriteInto,
Vec4: WriteInto,
f32: WriteInto,
f32: WriteInto,
f32: WriteInto,
u32: WriteInto,
f32: WriteInto,
f32: WriteInto,
f32: WriteInto,
fn write_into<B: BufferMut>(&self, writer: &mut Writer<B>)
Auto Trait Implementations
impl RefUnwindSafe for ParallaxMaterialUniform
impl Send for ParallaxMaterialUniform
impl Sync for ParallaxMaterialUniform
impl Unpin for ParallaxMaterialUniform
impl UnwindSafe for ParallaxMaterialUniform
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn 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. Read morefn 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. Read moreimpl<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
Self
using data from the given [World]