[−][src]Struct ktx::Ktx
KTX texture storage format data.
See the specification.
Fields
gl_type: u32
For compressed textures, glType must equal 0. For uncompressed textures, glType specifies the type parameter passed to glTex{,Sub}Image*D, usually one of the values from table 8.2 of the OpenGL 4.4 specification OPENGL44 (UNSIGNED_BYTE, UNSIGNED_SHORT_5_6_5, etc.)
gl_type_size: u32
glTypeSize specifies the data type size that should be used when endianness conversion is required for the texture data stored in the file. If glType is not 0, this should be the size in bytes corresponding to glType. For texture data which does not depend on platform endianness, including compressed texture data, glTypeSize must equal 1.
gl_format: u32
For compressed textures, glFormat must equal 0. For uncompressed textures, glFormat specifies the format parameter passed to glTex{,Sub}Image*D, usually one of the values from table 8.3 of the OpenGL 4.4 specification OPENGL44 (RGB, RGBA, BGRA, etc.)
gl_internal_format: u32
For compressed textures, glInternalFormat must equal the compressed internal format, usually one of the values from table 8.14 of the OpenGL 4.4 specification [OPENGL44]. For uncompressed textures, glInternalFormat specifies the internalformat parameter passed to glTexStorageD or glTexImageD, usually one of the sized internal formats from tables 8.12 & 8.13 of the OpenGL 4.4 specification [OPENGL44]. The sized format should be chosen to match the bit depth of the data provided. glInternalFormat is used when loading both compressed and uncompressed textures, except when loading into a context that does not support sized formats, such as an unextended OpenGL ES 2.0 context where the internalformat parameter is required to have the same value as the format parameter.
gl_base_internal_format: u32
For both compressed and uncompressed textures, glBaseInternalFormat specifies the base internal format of the texture, usually one of the values from table 8.11 of the OpenGL 4.4 specification [OPENGL44] (RGB, RGBA, ALPHA, etc.). For uncompressed textures, this value will be the same as glFormat and is used as the internalformat parameter when loading into a context that does not support sized formats, such as an unextended OpenGL ES 2.0 context.
pixel_width: u32
The width of the texture image for level 0, in pixels. No rounding to block sizes should be applied for block compressed textures.
pixel_height: u32
The height of the texture image for level 0, in pixels. No rounding to block sizes should be applied for block compressed textures.
For 1D textures this must be 0.
pixel_depth: u32
The depth of the texture image for level 0, in pixels. No rounding to block sizes should be applied for block compressed textures.
For 1D textures this must be 0. For 2D and cube textures this must be 0.
array_elements: u32
numberOfArrayElements specifies the number of array elements. If the texture is not an array texture, numberOfArrayElements must equal 0.
faces: u32
numberOfFaces specifies the number of cubemap faces. For cubemaps and cubemap arrays this should be 6. For non cubemaps this should be 1. Cube map faces are stored in the order: +X, -X, +Y, -Y, +Z, -Z.
Due to GL_OES_compressed_paletted_texture [OESCPT] not defining the interaction between cubemaps and its GL_PALETTE* formats, if glInternalFormat
is one of its GL_PALETTE* format, numberOfFaces must be 1
mipmap_levels: u32
numberOfMipmapLevels must equal 1 for non-mipmapped textures. For mipmapped textures, it equals the number of mipmaps. Mipmaps are stored in order from largest size to smallest size. The first mipmap level is always level 0. A KTX file does not need to contain a complete mipmap pyramid. If numberOfMipmapLevels equals 0, it indicates that a full mipmap pyramid should be generated from level 0 at load time (this is usually not allowed for compressed formats).
Methods
impl<'data> Ktx<'data>
[src]
pub fn new(data: &'data [u8]) -> Self
[src]
Parses KTX header data and returns a Ktx
instance.
pub fn texture_level(&self, level: u32) -> &'data [u8]
[src]
Returns texture data at the input level, starting at 0
.
Panics
Input level is >= the mipmap_levels
value.
ⓘImportant traits for Textures<'data, '_>pub fn textures(&self) -> Textures<'data, '_>
[src]
Returns an iterator over the texture levels starting at level 0.
Trait Implementations
impl<'a> Copy for Ktx<'a>
[src]
impl<'a> Clone for Ktx<'a>
[src]
fn clone(&self) -> Ktx<'a>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'_> Debug for Ktx<'_>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,