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.