Skip to main content

TextureInner

Struct TextureInner 

Source
pub struct TextureInner {
Show 23 fields pub width: u32, pub height: u32, pub data: Option<Vec<u8>>, pub color_space: ColorSpace, pub flip_y: bool, pub generate_mipmaps: bool, pub mipmaps: Vec<Image>, pub wrap_s: Wrapping, pub wrap_t: Wrapping, pub mag_filter: TextureFilter, pub min_filter: MinFilter, pub anisotropy: u16, pub offset: Vector2, pub repeat: Vector2, pub center: Vector2, pub rotation: f64, pub matrix: Matrix3, pub channel: usize, pub format: TextureFormat, pub version: u32, pub depth: u32, pub premultiply_alpha: bool, pub is_storage: bool, /* private fields */
}
Expand description

The state behind a Texture handle.

Fields§

§width: u32

texture.image.width.

§height: u32

texture.image.height.

§data: Option<Vec<u8>>

RGBA8 rows, top-down as decoded. None for a render-target texture.

§color_space: ColorSpace

texture.colorSpace.

§flip_y: bool

texture.flipY.

§generate_mipmaps: bool

texture.generateMipmaps.

§mipmaps: Vec<Image>

Texture.mipmaps — levels supplied by the page or the file, level 0 first. When there are any they are the whole mip chain: Textures.getMipLevels() takes its count from them and nothing is generated on top (webgpu_materials_texture_manualmipmap paints each level a different colour; a CompressedTexture or a KTX2 DataTexture brings its own, and a block-compressed format could not be rendered into anyway). Each level is in the texture’s format, top row first.

§wrap_s: Wrapping

texture.wrapS.

§wrap_t: Wrapping

texture.wrapT.

§mag_filter: TextureFilter

texture.magFilter.

§min_filter: MinFilter

texture.minFilter.

§anisotropy: u16

texture.anisotropy.

§offset: Vector2

Texture.offset / .repeat / .center / .rotation — updateMatrix()’s inputs.

§repeat: Vector2

texture.repeat.

§center: Vector2

texture.center.

§rotation: f64

texture.rotation.

§matrix: Matrix3

Texture.matrix, kept in step with the four above — unless Texture::set_matrix has overridden it.

§channel: usize

Texture.channel — which uv attribute TextureNode.getDefaultUV() samples along: 0 is uv, 1 is uv1. GLTFLoader sets it from a texture reference’s texCoord.

§format: TextureFormat

The format to use if the renderer has to create it (render targets).

§version: u32

Texture.version — “starts at 0 and counts how many times needsUpdate is set to true”. Part of the renderer’s texture cache key, exactly as Material.version is part of the program cache key.

§depth: u32

image.depth of a CompressedArrayTexture — the layer count. Zero for every 2-D texture, which is what marks this one as an array: it is bound as texture_2d_array<f32> and sampled with a layer index.

§premultiply_alpha: bool

Texture.premultiplyAlpha. Only KTX2Loader sets it, from the DFD’s KHR_DF_FLAG_ALPHA_PREMULTIPLIED; it is recorded, not acted on — three’s WebGPU backend ignores it for compressed uploads as well.

§is_storage: bool

texture.isStorageTexture — a Texture::storage: created with STORAGE_BINDING, never uploaded to, written by a compute kernel’s textureStore().

Trait Implementations§

Source§

impl Debug for TextureInner

The derived Debug printed every byte of data — megabytes for an SDF atlas, and the program cache key used to be a format!( "{:?}" ) of a binding description that reaches here. The length stands in for the pixels.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,