Struct gltf::texture::TextureTransform

source ·
pub struct TextureTransform<'a> { /* private fields */ }
Expand description

Many techniques can be used to optimize resource usage for a 3d scene. Chief among them is the ability to minimize the number of textures the GPU must load. To achieve this, many engines encourage packing many objects’ low-resolution textures into a single large texture atlas. The region of the resulting atlas that corresponds with each object is then defined by vertical and horizontal offsets, and the width and height of the region.

To support this use case, this extension adds offset, rotation, and scale properties to textureInfo structures. These properties would typically be implemented as an affine transform on the UV coordinates.

Implementations§

source§

impl<'a> TextureTransform<'a>

source

pub fn offset(&self) -> [f32; 2]

The offset of the UV coordinate origin as a factor of the texture dimensions.

source

pub fn rotation(&self) -> f32

Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise.

source

pub fn scale(&self) -> [f32; 2]

The scale factor applied to the components of the UV coordinates.

source

pub fn tex_coord(&self) -> Option<u32>

Overrides the textureInfo texCoord value if supplied, and if this extension is supported.

source

pub fn extras(&self) -> &Extras

Optional application specific data.

Auto Trait Implementations§

§

impl<'a> Freeze for TextureTransform<'a>

§

impl<'a> RefUnwindSafe for TextureTransform<'a>

§

impl<'a> Send for TextureTransform<'a>

§

impl<'a> Sync for TextureTransform<'a>

§

impl<'a> Unpin for TextureTransform<'a>

§

impl<'a> UnwindSafe for TextureTransform<'a>

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<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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.