pub struct Tile {
pub id: Uuid,
pub role: TileRole,
pub textures: Vec<Texture>,
pub module: Option<Module>,
pub blocking: bool,
pub scale: f32,
pub tags: String,
pub particle_emitter: Option<ParticleEmitter>,
pub light_emitter: Option<TileLightEmitter>,
}Fields§
§id: Uuid§role: TileRole§textures: Vec<Texture>The textures of the tiles. Primary source.
module: Option<Module>The module if the textures are shader generated
blocking: boolFor top down 2D scenarios
scale: f32The scale of the tile (mostly used for billboard rendering)
Tags
particle_emitter: Option<ParticleEmitter>Optional particle emitter definition derived from a tilegraph output.
light_emitter: Option<TileLightEmitter>Optional point light definition derived from a tilegraph output.
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn from_texture(texture: Texture) -> Tile
pub fn from_texture(texture: Texture) -> Tile
Create a tile from a single texture.
Sourcepub fn from_textures(textures: Vec<Texture>) -> Tile
pub fn from_textures(textures: Vec<Texture>) -> Tile
Create a tile from a vector of textures.
Sourcepub fn to_buffer_array(&self) -> Vec<Vec<u8>>
pub fn to_buffer_array(&self) -> Vec<Vec<u8>>
Converts the frames to an array of buffers
Sourcepub fn to_material_array(&self) -> Vec<Vec<u8>>
pub fn to_material_array(&self) -> Vec<Vec<u8>>
Converts the frames to an array of material buffers
Sourcepub fn resized(&self, new_width: usize, new_height: usize) -> Tile
pub fn resized(&self, new_width: usize, new_height: usize) -> Tile
Returns a new Tile with all textures resized to the specified dimensions
Sourcepub fn set_frames(&mut self, frames: usize)
pub fn set_frames(&mut self, frames: usize)
Sets the number of frames in the textures array. If frames > current count: duplicates the last texture to fill. If frames < current count: truncates the array. Also handles material_map and normal_map within each texture.
Sourcepub fn set_default_materials(&mut self)
pub fn set_default_materials(&mut self)
Initialize all textures with default materials and compute normals Sets roughness=0.5, metallic=0.0, opacity=1.0, emissive=0.0 for all pixels Then generates normals from the color data for each texture
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tile
impl<'de> Deserialize<'de> for Tile
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Tile
impl Serialize for Tile
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnsafeUnpin for Tile
impl UnwindSafe for Tile
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,
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>
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>
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)
&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)
&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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 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>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.