Struct Texture2D

Source
pub struct Texture2D { /* private fields */ }
Expand description

2d texture

Implementations§

Source§

impl Texture2D

Source

pub fn new_empty() -> Texture2D

Create an empty texture 2D.

Source

pub fn new(format: Format, extent: Extent2d, levels: usize) -> Texture2D

Create a texture2d and allocate a new storage_linear.

Source

pub fn new_with_mipmap_chain(format: Format, extent: Extent2d) -> Texture2D

Create a texture2d and allocate a new storage_linear with a complete mipmap chain.

Source

pub fn share_from(texture: &impl GliTexture) -> Texture2D

Create a texture2d view with an existing storage_linear.

Source

pub fn share_from_detail( texture: &impl GliTexture, format: Format, base_layer: usize, max_layer: usize, base_face: usize, max_face: usize, base_level: usize, max_level: usize, ) -> Texture2D

Create a texture2d view with an existing storage_linear.

Source

pub fn share_from_subset( texture: &Texture2D, base_level: usize, max_level: usize, ) -> Texture2D

Create a texture2d view, reference a subset of an existing texture2d instance.

Source

pub fn get_level(&self, level: usize) -> GliImage

Create a view of the image identified by Level in the mipmap chain of the texture.

This method is equivalent to [] operator in C++ version.

Trait Implementations§

Source§

impl GliTexture for Texture2D

Source§

const TARGET_TYPE: Target = Target::TARGET_2D

Source§

type ExtentType = Extent2d

Source§

fn extent(&self, level: usize) -> Self::ExtentType

Return the corresponding extent type of the texture instance, which represents the size of a specific mip-level of this texture(width, height and depth).
Source§

fn set_swizzles(&mut self, swizzles: Swizzles)

Source§

fn base_face(&self) -> usize

Return the base face of the texture instance, effectively a memory offset in the actual texture storage_type to identify where to start reading the faces.
Source§

fn base_layer(&self) -> usize

Return the base layer of the texture instance, effectively a memory offset in the actual texture storage_type to identify where to start reading the layers.
Source§

fn base_level(&self) -> usize

Return the base level of the texture instance, effectively a memory offset in the actual texture storage_type to identify where to start reading the levels.
Source§

fn clear(&mut self)

Clear the entire texture storage_linear with zeros.
Source§

fn copy( &mut self, src_texture: &Self, src_layer: usize, src_face: usize, src_level: usize, dst_layer: usize, dst_face: usize, dst_level: usize, )

Copy a specific image of a texture.
Source§

fn copy_subset( &mut self, src_texture: &Self, src_layer: usize, src_face: usize, src_level: usize, src_offset: Extent3d, dst_layer: usize, dst_face: usize, dst_level: usize, dst_offset: Extent3d, extent: Extent3d, )

Copy a subset of a specific image of a texture.
Source§

fn data(&self) -> *const c_void

Return a pointer to the beginning of the texture instance data.
Source§

unsafe fn data_mut(&mut self) -> *mut c_void

Source§

fn empty(&self) -> bool

Return whether the texture instance is empty, no storage_type or description have been assigned to the instance.
Source§

fn faces(&self) -> usize

Return max_face() - base_face() + 1.
Source§

fn format(&self) -> Format

Return the texture instance format.
Source§

fn layers(&self) -> usize

Return max_layer() - base_layer() + 1.
Source§

fn levels(&self) -> usize

Return max_level() - base_level() + 1.
Source§

fn max_face(&self) -> usize

Return the max face of the texture instance, effectively a memory offset to the beginning of the last face in the actual texture storage_type that the texture instance can access.
Source§

fn max_layer(&self) -> usize

Return the max layer of the texture instance, effectively a memory offset to the beginning of the last layer in the actual texture storage_type that the texture instance can access.
Source§

fn max_level(&self) -> usize

Return the max level of the texture instance, effectively a memory offset to the beginning of the last level in the actual texture storage_type that the texture instance can access.
Source§

fn size(&self) -> usize

Return the memory size of a texture instance storage_type in bytes.
Source§

fn size_at_level(&self, level: usize) -> usize

Return the memory size of a specific level identified by Level.
Source§

fn target(&self) -> Target

Return the target of a texture instance.
Source§

impl PartialEq for Texture2D

Source§

fn eq(&self, other: &Texture2D) -> bool

Compare two textures. Two textures are the same when the data, the format and the targets are the same.

Source§

fn ne(&self, other: &Texture2D) -> bool

Compare two textures. Two textures are the same when the data, the format and the targets are the same.

Source§

impl Eq for Texture2D

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<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>,

Source§

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>,

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.