Struct let_engine::objects::Appearance
source · pub struct Appearance { /* private fields */ }
Expand description
Holds everything about the appearance of objects like textures, vetex/index data, color and material.
Implementations§
source§impl Appearance
impl Appearance
sourcepub fn new_instanced(model: Model, material: Option<Material>) -> Self
pub fn new_instanced(model: Model, material: Option<Material>) -> Self
Makes an instanced appearance allowing for better performance using the same appearance instance multiple times.
sourcepub fn auto_scale(&mut self) -> Result<(), TextureError>
pub fn auto_scale(&mut self) -> Result<(), TextureError>
Scales the object appearance according to the texture applied. Works best in Expand camera mode for best quality.
sourcepub fn visible(self, visible: impl Into<bool>) -> Self
pub fn visible(self, visible: impl Into<bool>) -> Self
Sets the visibility of this appearance and returns self.
sourcepub fn set_visible(&mut self, visible: impl Into<bool>)
pub fn set_visible(&mut self, visible: impl Into<bool>)
Sets the visibility of this appearance.
sourcepub fn get_visible(&self) -> &bool
pub fn get_visible(&self) -> &bool
Gets the visibility of this appearance.
sourcepub fn get_visible_mut(&mut self) -> &mut bool
pub fn get_visible_mut(&mut self) -> &mut bool
Gets a mutable reference to the visibility of this appearance.
sourcepub fn transform(self, transform: impl Into<Transform>) -> Self
pub fn transform(self, transform: impl Into<Transform>) -> Self
Sets the transform of this appearance and returns self.
sourcepub fn set_transform(&mut self, transform: impl Into<Transform>)
pub fn set_transform(&mut self, transform: impl Into<Transform>)
Sets the transform of this appearance.
sourcepub fn get_transform(&self) -> &Transform
pub fn get_transform(&self) -> &Transform
Gets the transform of this appearance.
sourcepub fn get_transform_mut(&mut self) -> &mut Transform
pub fn get_transform_mut(&mut self) -> &mut Transform
Gets a mutable reference to the transform of this appearance.
sourcepub fn color(self, color: impl Into<Color>) -> Self
pub fn color(self, color: impl Into<Color>) -> Self
Sets the color of this appearance and returns self.
sourcepub fn get_color_mut(&mut self) -> &mut Color
pub fn get_color_mut(&mut self) -> &mut Color
Gets a mutable reference to the color of this appearance.
sourcepub fn get_model_mut(&mut self) -> Option<&mut Model>
pub fn get_model_mut(&mut self) -> Option<&mut Model>
Returns the mutable instance of a model in case the appearance is not instanced.
sourcepub fn set_model(&mut self, model: Model)
pub fn set_model(&mut self, model: Model)
Only sets the model if this appearance is not instanced.
sourcepub fn model(self, model: Model) -> Self
pub fn model(self, model: Model) -> Self
Only sets the model if this appearance in not instanced.
sourcepub fn get_material(&self) -> Option<&Material>
pub fn get_material(&self) -> Option<&Material>
Returns the material of the appearance.
sourcepub fn get_material_mut(&mut self) -> Option<Option<&mut Material>>
pub fn get_material_mut(&mut self) -> Option<Option<&mut Material>>
Returns the mutable instance of a material in case the appearance is not instanced.
sourcepub fn set_material(&mut self, material: Option<Material>)
pub fn set_material(&mut self, material: Option<Material>)
Only sets the material if this appearance is not instanced.
sourcepub fn material(self, material: Option<Material>) -> Self
pub fn material(self, material: Option<Material>) -> Self
Only sets the material if this appearance in not instanced.
sourcepub fn is_instanced(&self) -> bool
pub fn is_instanced(&self) -> bool
Returns true if this object is instanced.
sourcepub fn set_layer(&mut self, id: u32) -> Result<(), TextureError>
pub fn set_layer(&mut self, id: u32) -> Result<(), TextureError>
Sets the layer of the texture in case it has a textured material with layers.
sourcepub fn layer(&self) -> Option<u32>
pub fn layer(&self) -> Option<u32>
Returns the layer of the texture in case there is a material.
sourcepub fn next_frame(&mut self) -> Result<(), TextureError>
pub fn next_frame(&mut self) -> Result<(), TextureError>
Goes to the next frame of the textured material.
Returns an error if it reached the limit.
sourcepub fn last_frame(&mut self) -> Result<(), TextureError>
pub fn last_frame(&mut self) -> Result<(), TextureError>
Goes back a frame of the textured material.
Returns an error if the layer is already on 0.
Trait Implementations§
source§impl Clone for Appearance
impl Clone for Appearance
source§fn clone(&self) -> Appearance
fn clone(&self) -> Appearance
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Appearance
impl Debug for Appearance
source§impl Default for Appearance
impl Default for Appearance
source§impl PartialEq for Appearance
impl PartialEq for Appearance
source§fn eq(&self, other: &Appearance) -> bool
fn eq(&self, other: &Appearance) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for Appearance
impl StructuralPartialEq for Appearance
Auto Trait Implementations§
impl !RefUnwindSafe for Appearance
impl Send for Appearance
impl Sync for Appearance
impl Unpin for Appearance
impl !UnwindSafe for Appearance
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
§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> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§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>
ReadEndian::read_from_little_endian()
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.