Struct nannou_wgpu::TextureBuilder[][src]

pub struct TextureBuilder { /* fields omitted */ }
Expand description

A type aimed at simplifying the construction of a Texture.

The builder assumes a set of defaults describing a 128x128, non-multisampled, single-layer, non-linear sRGBA-8 texture. A suite of builder methods may be used to specify the exact properties desired.

Implementations

The minimum required texture usage when loading from an image.

Produce a texture descriptor from an image.

Specifically, this supports any image type implementing image::GenericImageView whose Pixel type implements Pixel.

By default, the produced builder will have the wgpu::TextureUsages returned by wgpu::TextureBuilder::default_image_texture_usage(). This is a general-purpose usage that should allow for copying to and from the texture, sampling the texture and rendering to the texture. Specifying only the texture usage required may result in better performance. It may be necessary to manually specify the the usage if STORAGE is required.

The default texture usage for the case where a user has loaded a texture from an image.

Creates a new Default builder

Specify the width and height of the texture.

Note: On calls to size, depth and extent the Builder will attempt to infer the wgpu::TextureDimension of its inner wgpu::TextureDescriptor by examining its size field. Use TextureBuilder::dimension() to override this behavior.

Specify the depth of the texture.

Note: On calls to size, depth and extent the Builder will attempt to infer the wgpu::TextureDimension of its inner wgpu::TextureDescriptor by examining its size field. Use TextureBuilder::dimension() to override this behavior.

Specify the width, height and depth of the texture.

Note: On calls to size, depth and extent the Builder will attempt to infer the wgpu::TextureDimension of its inner wgpu::TextureDescriptor by examining its size field. Use TextureBuilder::dimension() to override this behavior.

Specify the dimension of the texture, overriding inferred dimension.

Mainly useful for creating 2d texture arrays – override dimension with wgpu::TextureDimension::D2 on a texture with extent.depth > 1 in order to create a texture array (/ cubemap / cubemap array) instead of a 3d texture.

Specify the number of mip levels of the texture.

Specify the number of samples per pixel in the case that the texture is multisampled.

Specify the texture format.

Describes to the implementation how the texture is to be used.

It is important that the set of usage bits reflects the

Build the texture resulting from the specified parameters with the given device.

Consumes the builder and returns the resulting wgpu::TextureDescriptor.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.