pub struct MaterialProperties {
pub properties: HashMap<String, Value>,
}
Expand description
Stores toml information about a material, made for brushes.
§Examples
use bevy_trenchbroom::prelude::*;
// You should load MaterialProperties via your app's asset server, this is just for demonstration purposes.
let mat_properties = MaterialPropertiesLoader.load_sync(&std::fs::read_to_string("assets/textures/test.toml").unwrap()).unwrap();
assert_eq!(mat_properties.get(MaterialProperties::RENDER), true);
assert_eq!(mat_properties.get(MaterialProperties::COLLIDE), false);
assert_eq!(mat_properties.get(MaterialProperties::ROUGHNESS), 0.25);
Fields§
§properties: HashMap<String, Value>
Implementations§
source§impl MaterialProperties
impl MaterialProperties
sourcepub const RENDER: MaterialProperty<bool> = _
pub const RENDER: MaterialProperty<bool> = _
Whether the surface should render in the world.
sourcepub const COLLIDE: MaterialProperty<bool> = _
pub const COLLIDE: MaterialProperty<bool> = _
Whether the surface should have general collision.
sourcepub const ROUGHNESS: MaterialProperty<f32> = _
pub const ROUGHNESS: MaterialProperty<f32> = _
How rough the surface should be. Used for StandardMaterial::perceptual_roughness. The only difference being the default of this is 1.0
.
sourcepub const METALLIC: MaterialProperty<f32> = _
pub const METALLIC: MaterialProperty<f32> = _
How metallic the surface should be. Used for StandardMaterial::metallic.
sourcepub const ALPHA_MODE: MaterialProperty<MaterialPropertiesAlphaMode> = _
pub const ALPHA_MODE: MaterialProperty<MaterialPropertiesAlphaMode> = _
How a material’s base color alpha channel is used for transparency. See MaterialPropertiesAlphaMode docs.
sourcepub const EMISSIVE: MaterialProperty<Color> = _
pub const EMISSIVE: MaterialProperty<Color> = _
The amount of emissive light given off from the surface. Used for StandardMaterial::emissive.
sourcepub const DOUBLE_SIDED: MaterialProperty<bool> = _
pub const DOUBLE_SIDED: MaterialProperty<bool> = _
Whether to cull back faces.
sourcepub fn get<T: Deserialize<'static>>(&self, property: MaterialProperty<T>) -> T
pub fn get<T: Deserialize<'static>>(&self, property: MaterialProperty<T>) -> T
Gets a property from these properties, if it isn’t defined, uses the supplied MaterialProperty’s default.
Trait Implementations§
source§impl Clone for MaterialProperties
impl Clone for MaterialProperties
source§fn clone(&self) -> MaterialProperties
fn clone(&self) -> MaterialProperties
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MaterialProperties
impl Debug for MaterialProperties
source§impl Default for MaterialProperties
impl Default for MaterialProperties
source§fn default() -> MaterialProperties
fn default() -> MaterialProperties
Returns the “default value” for a type. Read more
source§impl TypePath for MaterialProperties
impl TypePath for MaterialProperties
source§fn type_path() -> &'static str
fn type_path() -> &'static str
Returns the fully qualified path of the underlying type. Read more
source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Returns a short, pretty-print enabled path to the type. Read more
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 MaterialProperties
impl VisitAssetDependencies for MaterialProperties
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Asset for MaterialProperties
Auto Trait Implementations§
impl Freeze for MaterialProperties
impl RefUnwindSafe for MaterialProperties
impl Send for MaterialProperties
impl Sync for MaterialProperties
impl Unpin for MaterialProperties
impl UnwindSafe for MaterialProperties
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<A> AssetContainer for Awhere
A: Asset,
impl<A> AssetContainer for Awhere
A: Asset,
fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)
fn asset_type_name(&self) -> &'static str
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.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
See
TypePath::type_path
.source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
See
TypePath::type_ident
.source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
See
TypePath::crate_name
.source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given World
.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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 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>
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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
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()
.