Skip to main content

Texture2D3D

Struct Texture2D3D 

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

Mipmapped 3D texture asset decoded from embedded or external Blender/glTF images.

Implementations§

Source§

impl Texture2D3D

Construction, mipmap generation, and filtered sampling for Texture2D3D.

Source

pub fn from_rgba8( name: &str, width: u32, height: u32, pixels: Vec<u8>, color_space: TextureColorSpace, generate_mips: bool, ) -> Result<Self, String>

Builds a Texture2D3D from raw RGBA8 pixels and optionally generates a full mipmap chain.

§Arguments
  • &str - Texture name.
  • u32 - Base image width in pixels.
  • u32 - Base image height in pixels.
  • Vec<u8> - Packed RGBA8 base-level pixels.
  • TextureColorSpace - Color-space filtering and decode mode.
  • bool - Whether to generate mip levels down to 1x1.
§Returns
  • Result<Self, String> - Ready mipmapped texture or size error.
Source

pub fn from_encoded_bytes( name: &str, bytes: &[u8], color_space: TextureColorSpace, generate_mips: bool, ) -> Result<Self, String>

Decodes encoded PNG, JPEG, BMP, HDR, or EXR bytes into a mipmapped Texture2D3D.

§Arguments
  • &str - Texture name.
  • &[u8] - Raw encoded image bytes.
  • TextureColorSpace - Color-space interpretation.
  • bool - Whether to build the full mipmap chain.
§Returns
  • Result<Self, String> - Decoded texture or codec error.
Source

pub fn generate_mipmaps(&mut self)

Rebuilds the mipmap chain from mips[0] down to 1x1.

§Arguments
  • &Self - Mutable texture asset.
Source

pub fn sample_mip( &self, mip_index: usize, u_coord: f32, v_coord: f32, ) -> [f32; 4]

Samples a single mip level bilinearly or nearest-neighbor in linear color space.

§Arguments
  • &Self - Texture reference.
  • usize - Clamped mip level index.
  • f32 - Normalized U coordinate.
  • f32 - Normalized V coordinate.
§Returns
  • [f32; 4] - Linear RGBA sample in [0.0, 1.0].
Source

pub fn sample_trilinear(&self, u_coord: f32, v_coord: f32, lod: f32) -> [f32; 4]

Performs trilinear-filtered linear-space texture sampling at (u, v, lod).

§Arguments
  • &Self - Texture reference.
  • f32 - Normalized U coordinate.
  • f32 - Normalized V coordinate.
  • f32 - Continuous mip level-of-detail (0.0 = full resolution).
§Returns
  • [f32; 4] - Trilinearly filtered linear RGBA sample.
Source§

impl Texture2D3D

Source

pub fn get_name(&self) -> &String

Source

pub fn get_mut_name(&mut self) -> &mut String

Source

pub fn set_name(&mut self, val: String) -> &mut Self

Source

pub fn get_width(&self) -> u32

Source

pub fn get_mut_width(&mut self) -> &mut u32

Source

pub fn set_width(&mut self, val: u32) -> &mut Self

Source

pub fn get_height(&self) -> u32

Source

pub fn get_mut_height(&mut self) -> &mut u32

Source

pub fn set_height(&mut self, val: u32) -> &mut Self

Source

pub fn get_color_space(&self) -> TextureColorSpace

Source

pub fn get_mut_color_space(&mut self) -> &mut TextureColorSpace

Source

pub fn set_color_space(&mut self, val: TextureColorSpace) -> &mut Self

Source

pub fn get_sampler(&self) -> TextureSampler3D

Source

pub fn get_mut_sampler(&mut self) -> &mut TextureSampler3D

Source

pub fn set_sampler(&mut self, val: TextureSampler3D) -> &mut Self

Source

pub fn get_mips(&self) -> &Vec<TextureMipLevel3D>

Source

pub fn get_mut_mips(&mut self) -> &mut Vec<TextureMipLevel3D>

Source

pub fn set_mips(&mut self, val: Vec<TextureMipLevel3D>) -> &mut Self

Trait Implementations§

Source§

impl Clone for Texture2D3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Texture2D3D

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Texture2D3D

Source§

fn default() -> Self

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

impl Eq for Texture2D3D

Source§

impl PartialEq for Texture2D3D

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Texture2D3D

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.