pub struct Texture {
pub asset_id: AssetId,
pub generator: String,
pub source: String,
pub image_index: u32,
pub resolution: u32,
pub max_size: u32,
pub locator: Option<PayloadLocator>,
}Expand description
A 2D texture image.
Use the generator field for built-in patterns or supply a source file path.
Built-in generators:
Choosing a room texture: for neutral indoor spaces prefer plaster (cream-white) or concrete (grey). brick is reddish-orange, only use it when you explicitly want that look. stone (dark grey-blue) suits dungeons or medieval rooms.
Texture {
generator: "brick".into(),
resolution: 512,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
generator: StringProcedural generator name. Empty or omitted means use source instead.
source: StringPath to the source image, relative to the project root.
Used only when generator is empty. A .glb path is allowed, use
image_index to pick which embedded image to use.
image_index: u32When source points to a .glb file, which embedded image to import.
Ignored for regular image files.
resolution: u32Resolution hint for procedural generators (width = height). Defaults to 512. Ignored for file-backed textures.
max_size: u32Optional ceiling on the longest edge of a file-backed image, in pixels.
0 (the default) keeps the source resolution. When set and the source is
larger, the image is box-filtered down so its longest edge is at most this
value. Useful to keep very large source maps (4K+) from bloating the
compiled scene, which stores uncompressed pixels.
locator: Option<PayloadLocator>Injected at load time from the compiled blob payload.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Texture
impl<'de> Deserialize<'de> for Texture
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Texture, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Texture, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl ResourceAsset for Texture
Source§impl Serialize for Texture
impl Serialize for Texture
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,
Auto Trait Implementations§
impl Freeze for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
impl UnwindSafe for Texture
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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().