Struct bevy::pbr::StandardMaterial

pub struct StandardMaterial {
Show 34 fields pub base_color: Color, pub base_color_texture: Option<Handle<Image>>, pub emissive: Color, pub emissive_texture: Option<Handle<Image>>, pub perceptual_roughness: f32, pub metallic: f32, pub metallic_roughness_texture: Option<Handle<Image>>, pub reflectance: f32, pub diffuse_transmission: f32, pub diffuse_transmission_texture: Option<Handle<Image>>, pub specular_transmission: f32, pub specular_transmission_texture: Option<Handle<Image>>, pub thickness: f32, pub thickness_texture: Option<Handle<Image>>, pub ior: f32, pub attenuation_distance: f32, pub attenuation_color: Color, pub normal_map_texture: Option<Handle<Image>>, pub flip_normal_map_y: bool, pub occlusion_texture: Option<Handle<Image>>, pub double_sided: bool, pub cull_mode: Option<Face>, pub unlit: bool, pub fog_enabled: bool, pub alpha_mode: AlphaMode, pub depth_bias: f32, pub depth_map: Option<Handle<Image>>, pub parallax_depth_scale: f32, pub parallax_mapping_method: ParallaxMappingMethod, pub max_parallax_layer_count: f32, pub lightmap_exposure: f32, pub opaque_render_method: OpaqueRendererMethod, pub deferred_lighting_pass_id: u8, pub uv_transform: Affine2,
}
Expand description

A material with “standard” properties used in PBR lighting Standard property values with pictures here https://google.github.io/filament/Material%20Properties.pdf.

May be created directly from a Color or an Image.

Fields§

§base_color: Color

The color of the surface of the material before lighting.

Doubles as diffuse albedo for non-metallic, specular for metallic and a mix for everything in between. If used together with a base_color_texture, this is factored into the final base color as base_color * base_color_texture_value

Defaults to Color::WHITE.

§base_color_texture: Option<Handle<Image>>

The texture component of the material’s color before lighting. The actual pre-lighting color is base_color * this_texture.

See base_color for details.

You should set base_color to Color::WHITE (the default) if you want the texture to show as-is.

Setting base_color to something else than white will tint the texture. For example, setting base_color to pure red will tint the texture red.

§emissive: Color

Color the material “emits” to the camera.

This is typically used for monitor screens or LED lights. Anything that can be visible even in darkness.

The emissive color is added to what would otherwise be the material’s visible color. This means that for a light emissive value, in darkness, you will mostly see the emissive component.

The default emissive color is Color::BLACK, which doesn’t add anything to the material color.

To increase emissive strength, channel values for emissive colors can exceed 1.0. For instance, a base_color of Color::linear_rgb(1.0, 0.0, 0.0) represents the brightest red for objects that reflect light, but an emissive color like Color::linear_rgb(1000.0, 0.0, 0.0) can be used to create intensely bright red emissive effects.

Increasing the emissive strength of the color will impact visual effects like bloom, but it’s important to note that an emissive material won’t light up surrounding areas like a light source, it just adds a value to the color seen on screen.

§emissive_texture: Option<Handle<Image>>

The emissive map, multiplies pixels with emissive to get the final “emitting” color of a surface.

This color is multiplied by emissive to get the final emitted color. Meaning that you should set emissive to Color::WHITE if you want to use the full range of color of the emissive texture.

§perceptual_roughness: f32

Linear perceptual roughness, clamped to [0.089, 1.0] in the shader.

Defaults to 0.5.

Low values result in a “glossy” material with specular highlights, while values close to 1 result in rough materials.

If used together with a roughness/metallic texture, this is factored into the final base color as roughness * roughness_texture_value.

0.089 is the minimum floating point value that won’t be rounded down to 0 in the calculations used.

§metallic: f32

How “metallic” the material appears, within [0.0, 1.0].

This should be set to 0.0 for dielectric materials or 1.0 for metallic materials. For a hybrid surface such as corroded metal, you may need to use in-between values.

Defaults to 0.00, for dielectric.

If used together with a roughness/metallic texture, this is factored into the final base color as metallic * metallic_texture_value.

§metallic_roughness_texture: Option<Handle<Image>>

Metallic and roughness maps, stored as a single texture.

The blue channel contains metallic values, and the green channel contains the roughness values. Other channels are unused.

Those values are multiplied by the scalar ones of the material, see metallic and perceptual_roughness for details.

Note that with the default values of metallic and perceptual_roughness, setting this texture has no effect. If you want to exclusively use the metallic_roughness_texture values for your material, make sure to set metallic and perceptual_roughness to 1.0.

§reflectance: f32

Specular intensity for non-metals on a linear scale of [0.0, 1.0].

Use the value as a way to control the intensity of the specular highlight of the material, i.e. how reflective is the material, rather than the physical property “reflectance.”

Set to 0.0, no specular highlight is visible, the highlight is strongest when reflectance is set to 1.0.

Defaults to 0.5 which is mapped to 4% reflectance in the shader.

§diffuse_transmission: f32

The amount of light transmitted diffusely through the material (i.e. “translucency”)

Implemented as a second, flipped Lambertian diffuse lobe, which provides an inexpensive but plausible approximation of translucency for thin dieletric objects (e.g. paper, leaves, some fabrics) or thicker volumetric materials with short scattering distances (e.g. porcelain, wax).

For specular transmission usecases with refraction (e.g. glass) use the StandardMaterial::specular_transmission and StandardMaterial::ior properties instead.

  • When set to 0.0 (the default) no diffuse light is transmitted;
  • When set to 1.0 all diffuse light is transmitted through the material;
  • Values higher than 0.5 will cause more diffuse light to be transmitted than reflected, resulting in a “darker” appearance on the side facing the light than the opposite side. (e.g. plant leaves)

§Notes

§diffuse_transmission_texture: Option<Handle<Image>>
Available on crate feature pbr_transmission_textures only.

A map that modulates diffuse transmission via its alpha channel. Multiplied by StandardMaterial::diffuse_transmission to obtain the final result.

Important: The StandardMaterial::diffuse_transmission property must be set to a value higher than 0.0, or this texture won’t have any effect.

§specular_transmission: f32

The amount of light transmitted specularly through the material (i.e. via refraction)

  • When set to 0.0 (the default) no light is transmitted.
  • When set to 1.0 all light is transmitted through the material.

The material’s StandardMaterial::base_color also modulates the transmitted light.

Note: Typically used in conjunction with StandardMaterial::thickness, StandardMaterial::ior and StandardMaterial::perceptual_roughness.

§Performance

Specular transmission is implemented as a relatively expensive screen-space effect that allows ocluded objects to be seen through the material, with distortion and blur effects.

§specular_transmission_texture: Option<Handle<Image>>
Available on crate feature pbr_transmission_textures only.

A map that modulates specular transmission via its red channel. Multiplied by StandardMaterial::specular_transmission to obtain the final result.

Important: The StandardMaterial::specular_transmission property must be set to a value higher than 0.0, or this texture won’t have any effect.

§thickness: f32

Thickness of the volume beneath the material surface.

When set to 0.0 (the default) the material appears as an infinitely-thin film, transmitting light without distorting it.

When set to any other value, the material distorts light like a thick lens.

Note: Typically used in conjunction with StandardMaterial::specular_transmission and StandardMaterial::ior, or with StandardMaterial::diffuse_transmission.

§thickness_texture: Option<Handle<Image>>
Available on crate feature pbr_transmission_textures only.

A map that modulates thickness via its green channel. Multiplied by StandardMaterial::thickness to obtain the final result.

Important: The StandardMaterial::thickness property must be set to a value higher than 0.0, or this texture won’t have any effect.

§ior: f32

The index of refraction of the material.

Defaults to 1.5.

MaterialIndex of Refraction
Vacuum1
Air1.00
Ice1.31
Water1.33
Eyes1.38
Quartz1.46
Olive Oil1.47
Honey1.49
Acrylic1.49
Window Glass1.52
Polycarbonate1.58
Flint Glass1.69
Ruby1.71
Glycerine1.74
Sapphire1.77
Cubic Zirconia2.15
Diamond2.42
Moissanite2.65

Note: Typically used in conjunction with StandardMaterial::specular_transmission and StandardMaterial::thickness.

§attenuation_distance: f32

How far, on average, light travels through the volume beneath the material’s surface before being absorbed.

Defaults to f32::INFINITY, i.e. light is never absorbed.

Note: To have any effect, must be used in conjunction with:

§attenuation_color: Color

The resulting (non-absorbed) color after white light travels through the attenuation distance.

Defaults to Color::WHITE, i.e. no change.

Note: To have any effect, must be used in conjunction with:

§normal_map_texture: Option<Handle<Image>>

Used to fake the lighting of bumps and dents on a material.

A typical usage would be faking cobblestones on a flat plane mesh in 3D.

§Notes

Normal mapping with StandardMaterial and the core bevy PBR shaders requires:

  • A normal map texture
  • Vertex UVs
  • Vertex tangents
  • Vertex normals

Tangents do not have to be stored in your model, they can be generated using the Mesh::generate_tangents or Mesh::with_generated_tangents methods. If your material has a normal map, but still renders as a flat surface, make sure your meshes have their tangents set.

§flip_normal_map_y: bool

Normal map textures authored for DirectX have their y-component flipped. Set this to flip it to right-handed conventions.

§occlusion_texture: Option<Handle<Image>>

Specifies the level of exposure to ambient light.

This is usually generated and stored automatically (“baked”) by 3D-modelling software.

Typically, steep concave parts of a model (such as the armpit of a shirt) are darker, because they have little exposure to light. An occlusion map specifies those parts of the model that light doesn’t reach well.

The material will be less lit in places where this texture is dark. This is similar to ambient occlusion, but built into the model.

§double_sided: bool

Support two-sided lighting by automatically flipping the normals for “back” faces within the PBR lighting shader.

Defaults to false. This does not automatically configure backface culling, which can be done via cull_mode.

§cull_mode: Option<Face>

Whether to cull the “front”, “back” or neither side of a mesh. If set to None, the two sides of the mesh are visible.

Defaults to Some(Face::Back). In bevy, the order of declaration of a triangle’s vertices in Mesh defines the triangle’s front face.

When a triangle is in a viewport, if its vertices appear counter-clockwise from the viewport’s perspective, then the viewport is seeing the triangle’s front face. Conversely, if the vertices appear clockwise, you are seeing the back face.

In short, in bevy, front faces winds counter-clockwise.

Your 3D editing software should manage all of that.

§unlit: bool

Whether to apply only the base color to this material.

Normals, occlusion textures, roughness, metallic, reflectance, emissive, shadows, alpha mode and ambient light are ignored if this is set to true.

§fog_enabled: bool

Whether to enable fog for this material.

§alpha_mode: AlphaMode

How to apply the alpha channel of the base_color_texture.

See AlphaMode for details. Defaults to AlphaMode::Opaque.

§depth_bias: f32

Adjust rendered depth.

A material with a positive depth bias will render closer to the camera while negative values cause the material to render behind other objects. This is independent of the viewport.

depth_bias affects render ordering and depth write operations using the wgpu::DepthBiasState::Constant field.

§depth_map: Option<Handle<Image>>

The depth map used for parallax mapping.

It is a greyscale image where white represents bottom and black the top. If this field is set, bevy will apply parallax mapping. Parallax mapping, unlike simple normal maps, will move the texture coordinate according to the current perspective, giving actual depth to the texture.

The visual result is similar to a displacement map, but does not require additional geometry.

Use the parallax_depth_scale field to control the depth of the parallax.

§Limitations

  • It will look weird on bent/non-planar surfaces.
  • The depth of the pixel does not reflect its visual position, resulting in artifacts for depth-dependent features such as fog or SSAO.
  • For the same reason, the geometry silhouette will always be the one of the actual geometry, not the parallaxed version, resulting in awkward looks on intersecting parallaxed surfaces.

§Performance

Parallax mapping requires multiple texture lookups, proportional to max_parallax_layer_count, which might be costly.

Use the parallax_mapping_method and max_parallax_layer_count fields to tweak the shader, trading graphical quality for performance.

To improve performance, set your depth_map’s Image::sampler filter mode to FilterMode::Nearest, as this paper indicates, it improves performance a bit.

To reduce artifacts, avoid steep changes in depth, blurring the depth map helps with this.

Larger depth maps haves a disproportionate performance impact.

§parallax_depth_scale: f32

How deep the offset introduced by the depth map should be.

Default is 0.1, anything over that value may look distorted. Lower values lessen the effect.

The depth is relative to texture size. This means that if your texture occupies a surface of 1 world unit, and parallax_depth_scale is 0.1, then the in-world depth will be of 0.1 world units. If the texture stretches for 10 world units, then the final depth will be of 1 world unit.

§parallax_mapping_method: ParallaxMappingMethod

Which parallax mapping method to use.

We recommend that all objects use the same ParallaxMappingMethod, to avoid duplicating and running two shaders.

§max_parallax_layer_count: f32

In how many layers to split the depth maps for parallax mapping.

If you are seeing jaggy edges, increase this value. However, this incurs a performance cost.

Dependent on the situation, switching to ParallaxMappingMethod::Relief and keeping this value low might have better performance than increasing the layer count while using ParallaxMappingMethod::Occlusion.

Default is 16.0.

§lightmap_exposure: f32

The exposure (brightness) level of the lightmap, if present.

§opaque_render_method: OpaqueRendererMethod

Render method used for opaque materials. (Where alpha_mode is AlphaMode::Opaque or AlphaMode::Mask)

§deferred_lighting_pass_id: u8

Used for selecting the deferred lighting pass for deferred materials. Default is DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID for default PBR deferred lighting pass. Ignored in the case of forward materials.

§uv_transform: Affine2

The transform applied to the UVs corresponding to ATTRIBUTE_UV_0 on the mesh before sampling. Default is identity.

Implementations§

§

impl StandardMaterial

pub const FLIP_HORIZONTAL: Affine2 = _

Horizontal flipping transform

Multiplying this with another Affine2 returns transformation with horizontally flipped texture coords

pub const FLIP_VERTICAL: Affine2 = _

Vertical flipping transform

Multiplying this with another Affine2 returns transformation with vertically flipped texture coords

pub const FLIP_X: Affine3 = _

Flipping X 3D transform

Multiplying this with another Affine3 returns transformation with flipped X coords

pub const FLIP_Y: Affine3 = _

Flipping Y 3D transform

Multiplying this with another Affine3 returns transformation with flipped Y coords

pub const FLIP_Z: Affine3 = _

Flipping Z 3D transform

Multiplying this with another Affine3 returns transformation with flipped Z coords

pub fn flip(&mut self, horizontal: bool, vertical: bool)

Flip the texture coordinates of the material.

pub fn flipped(self, horizontal: bool, vertical: bool) -> StandardMaterial

Consumes the material and returns a material with flipped texture coordinates

Trait Implementations§

§

impl AsBindGroup for StandardMaterial

§

type Data = StandardMaterialKey

Data that will be stored alongside the “prepared” bind group.
§

fn label() -> Option<&'static str>

label
§

fn unprepared_bind_group( &self, layout: &BindGroupLayout, render_device: &RenderDevice, images: &RenderAssets<GpuImage>, fallback_image: &FallbackImage ) -> Result<UnpreparedBindGroup<<StandardMaterial as AsBindGroup>::Data>, AsBindGroupError>

Returns a vec of (binding index, OwnedBindingResource). In cases where OwnedBindingResource is not available (as for bindless texture arrays currently), an implementor may define as_bind_group directly. This may prevent certain features from working correctly.
§

fn bind_group_layout_entries( render_device: &RenderDevice ) -> Vec<BindGroupLayoutEntry>

Returns a vec of bind group layout entries
§

fn as_bind_group( &self, layout: &BindGroupLayout, render_device: &RenderDevice, images: &RenderAssets<GpuImage>, fallback_image: &FallbackImage ) -> Result<PreparedBindGroup<Self::Data>, AsBindGroupError>

Creates a bind group for self matching the layout defined in AsBindGroup::bind_group_layout.
§

fn bind_group_layout(render_device: &RenderDevice) -> BindGroupLayout
where Self: Sized,

Creates the bind group layout matching all bind groups returned by AsBindGroup::as_bind_group
§

impl AsBindGroupShaderType<StandardMaterialUniform> for StandardMaterial

§

fn as_bind_group_shader_type( &self, images: &RenderAssets<GpuImage> ) -> StandardMaterialUniform

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
§

impl Clone for StandardMaterial

§

fn clone(&self) -> StandardMaterial

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for StandardMaterial

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for StandardMaterial

§

fn default() -> StandardMaterial

Returns the “default value” for a type. Read more
§

impl From<&StandardMaterial> for StandardMaterialKey

§

fn from(material: &StandardMaterial) -> StandardMaterialKey

Converts to this type from the input type.
§

impl From<Color> for StandardMaterial

§

fn from(color: Color) -> StandardMaterial

Converts to this type from the input type.
§

impl From<Handle<Image>> for StandardMaterial

§

fn from(texture: Handle<Image>) -> StandardMaterial

Converts to this type from the input type.
§

impl FromReflect for StandardMaterial
where StandardMaterial: Any + Send + Sync, Color: FromReflect + TypePath + RegisterForReflection, Option<Handle<Image>>: FromReflect + TypePath + RegisterForReflection, f32: FromReflect + TypePath + RegisterForReflection, bool: FromReflect + TypePath + RegisterForReflection, AlphaMode: FromReflect + TypePath + RegisterForReflection, ParallaxMappingMethod: FromReflect + TypePath + RegisterForReflection, OpaqueRendererMethod: FromReflect + TypePath + RegisterForReflection, u8: FromReflect + TypePath + RegisterForReflection, Affine2: FromReflect + TypePath + RegisterForReflection,

§

fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<StandardMaterial>

Constructs a concrete instance of Self from a reflected value.
§

fn take_from_reflect( reflect: Box<dyn Reflect> ) -> Result<Self, Box<dyn Reflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
§

impl GetTypeRegistration for StandardMaterial
where StandardMaterial: Any + Send + Sync, Color: FromReflect + TypePath + RegisterForReflection, Option<Handle<Image>>: FromReflect + TypePath + RegisterForReflection, f32: FromReflect + TypePath + RegisterForReflection, bool: FromReflect + TypePath + RegisterForReflection, AlphaMode: FromReflect + TypePath + RegisterForReflection, ParallaxMappingMethod: FromReflect + TypePath + RegisterForReflection, OpaqueRendererMethod: FromReflect + TypePath + RegisterForReflection, u8: FromReflect + TypePath + RegisterForReflection, Affine2: FromReflect + TypePath + RegisterForReflection,

§

fn get_type_registration() -> TypeRegistration

Returns the default TypeRegistration for this type.
§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
§

impl Material for StandardMaterial

§

fn fragment_shader() -> ShaderRef

Returns this material’s fragment shader. If ShaderRef::Default is returned, the default mesh fragment shader will be used.
§

fn alpha_mode(&self) -> AlphaMode

Returns this material’s AlphaMode. Defaults to AlphaMode::Opaque.
§

fn opaque_render_method(&self) -> OpaqueRendererMethod

Returns if this material should be rendered by the deferred or forward renderer. for AlphaMode::Opaque or AlphaMode::Mask materials. If OpaqueRendererMethod::Auto, it will default to what is selected in the DefaultOpaqueRendererMethod resource.
§

fn depth_bias(&self) -> f32

Add a bias to the view depth of the mesh which can be used to force a specific render order. for meshes with similar depth, to avoid z-fighting. The bias is in depth-texture units so large values may be needed to overcome small depth differences.
§

fn reads_view_transmission_texture(&self) -> bool

Returns whether the material would like to read from ViewTransmissionTexture. Read more
§

fn prepass_fragment_shader() -> ShaderRef

Returns this material’s prepass fragment shader. If ShaderRef::Default is returned, the default prepass fragment shader will be used. Read more
§

fn deferred_fragment_shader() -> ShaderRef

Returns this material’s deferred fragment shader. If ShaderRef::Default is returned, the default deferred fragment shader will be used.
§

fn meshlet_mesh_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.
Returns this material’s crate::meshlet::MeshletMesh fragment shader. If ShaderRef::Default is returned, the default meshlet mesh fragment shader will be used. Read more
§

fn meshlet_mesh_prepass_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.
Returns this material’s crate::meshlet::MeshletMesh prepass fragment shader. If ShaderRef::Default is returned, the default meshlet mesh prepass fragment shader will be used. Read more
§

fn meshlet_mesh_deferred_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.
Returns this material’s crate::meshlet::MeshletMesh deferred fragment shader. If ShaderRef::Default is returned, the default meshlet mesh deferred fragment shader will be used. Read more
§

fn specialize( _pipeline: &MaterialPipeline<StandardMaterial>, descriptor: &mut RenderPipelineDescriptor, _layout: &MeshVertexBufferLayoutRef, key: MaterialPipelineKey<StandardMaterial> ) -> Result<(), SpecializedMeshPipelineError>

Customizes the default RenderPipelineDescriptor for a specific entity using the entity’s MaterialPipelineKey and MeshVertexBufferLayoutRef as input.
§

fn vertex_shader() -> ShaderRef

Returns this material’s vertex shader. If ShaderRef::Default is returned, the default mesh vertex shader will be used.
§

fn prepass_vertex_shader() -> ShaderRef

Returns this material’s prepass vertex shader. If ShaderRef::Default is returned, the default prepass vertex shader will be used. Read more
§

fn deferred_vertex_shader() -> ShaderRef

Returns this material’s deferred vertex shader. If ShaderRef::Default is returned, the default deferred vertex shader will be used.
§

impl Reflect for StandardMaterial
where StandardMaterial: Any + Send + Sync, Color: FromReflect + TypePath + RegisterForReflection, Option<Handle<Image>>: FromReflect + TypePath + RegisterForReflection, f32: FromReflect + TypePath + RegisterForReflection, bool: FromReflect + TypePath + RegisterForReflection, AlphaMode: FromReflect + TypePath + RegisterForReflection, ParallaxMappingMethod: FromReflect + TypePath + RegisterForReflection, OpaqueRendererMethod: FromReflect + TypePath + RegisterForReflection, u8: FromReflect + TypePath + RegisterForReflection, Affine2: FromReflect + TypePath + RegisterForReflection,

§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the TypeInfo of the type represented by this value. Read more
§

fn into_any(self: Box<StandardMaterial>) -> Box<dyn Any>

Returns the value as a Box<dyn Any>.
§

fn as_any(&self) -> &(dyn Any + 'static)

Returns the value as a &dyn Any.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Returns the value as a &mut dyn Any.
§

fn into_reflect(self: Box<StandardMaterial>) -> Box<dyn Reflect>

Casts this type to a boxed reflected value.
§

fn as_reflect(&self) -> &(dyn Reflect + 'static)

Casts this type to a reflected value.
§

fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)

Casts this type to a mutable reflected value.
§

fn clone_value(&self) -> Box<dyn Reflect>

Clones the value as a Reflect trait object. Read more
§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
§

fn apply(&mut self, value: &(dyn Reflect + 'static))

Applies a reflected value to this value. Read more
§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
§

fn reflect_owned(self: Box<StandardMaterial>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
§

fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>

Returns a “partial equality” comparison result. Read more
§

fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Debug formatter for the value. Read more
§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
§

fn serializable(&self) -> Option<Serializable<'_>>

Returns a serializable version of the value. Read more
§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
§

impl Struct for StandardMaterial
where StandardMaterial: Any + Send + Sync, Color: FromReflect + TypePath + RegisterForReflection, Option<Handle<Image>>: FromReflect + TypePath + RegisterForReflection, f32: FromReflect + TypePath + RegisterForReflection, bool: FromReflect + TypePath + RegisterForReflection, AlphaMode: FromReflect + TypePath + RegisterForReflection, ParallaxMappingMethod: FromReflect + TypePath + RegisterForReflection, OpaqueRendererMethod: FromReflect + TypePath + RegisterForReflection, u8: FromReflect + TypePath + RegisterForReflection, Affine2: FromReflect + TypePath + RegisterForReflection,

§

fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>

Returns a reference to the value of the field named name as a &dyn Reflect.
§

fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>

Returns a mutable reference to the value of the field named name as a &mut dyn Reflect.
§

fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>

Returns a reference to the value of the field with index index as a &dyn Reflect.
§

fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>

Returns a mutable reference to the value of the field with index index as a &mut dyn Reflect.
§

fn name_at(&self, index: usize) -> Option<&str>

Returns the name of the field with index index.
§

fn field_len(&self) -> usize

Returns the number of fields in the struct.
§

fn iter_fields(&self) -> FieldIter<'_>

Returns an iterator over the values of the reflectable fields for this struct.
§

fn clone_dynamic(&self) -> DynamicStruct

Clones the struct into a DynamicStruct.
§

impl TypePath for StandardMaterial

§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
§

impl Typed for StandardMaterial
where StandardMaterial: Any + Send + Sync, Color: FromReflect + TypePath + RegisterForReflection, Option<Handle<Image>>: FromReflect + TypePath + RegisterForReflection, f32: FromReflect + TypePath + RegisterForReflection, bool: FromReflect + TypePath + RegisterForReflection, AlphaMode: FromReflect + TypePath + RegisterForReflection, ParallaxMappingMethod: FromReflect + TypePath + RegisterForReflection, OpaqueRendererMethod: FromReflect + TypePath + RegisterForReflection, u8: FromReflect + TypePath + RegisterForReflection, Affine2: FromReflect + TypePath + RegisterForReflection,

§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
§

impl VisitAssetDependencies for StandardMaterial

§

fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))

§

impl Asset for StandardMaterial

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
§

impl<A> AssetContainer for A
where A: Asset,

§

fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)

§

fn asset_type_name(&self) -> &'static str

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DynamicTypePath for T
where T: TypePath,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> FromWorld for T
where T: Default,

§

fn from_world(_world: &mut World) -> T

Creates Self using data from the given World.
§

impl<S> GetField for S
where S: Struct,

§

fn get_field<T>(&self, name: &str) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field named name, downcast to T.
§

fn get_field_mut<T>(&mut self, name: &str) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field named name, downcast to T.
§

impl<T> GetPath for T
where T: Reflect + ?Sized,

§

fn reflect_path<'p>( &self, path: impl ReflectPath<'p> ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
§

fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p> ) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
§

fn path<'p, T>( &self, path: impl ReflectPath<'p> ) -> Result<&T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
§

fn path_mut<'p, T>( &mut self, path: impl ReflectPath<'p> ) -> Result<&mut T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData>

§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> Settings for T
where T: 'static + Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,