Skip to main content

TextureMaterial3d

Struct TextureMaterial3d 

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

Cheap immutable unlit material sharing one texture and filter state.

Sampled straight-linear RGBA multiplies vertex color, this tint and the object’s surface tint. Surface style selects alpha coverage, depth-write behavior and projected sidedness. No lighting is implied.

Implementations§

Source§

impl TextureMaterial3d

Source

pub fn new( texture: &Texture3d, sampling: ImageSampling, tint: Color, ) -> Result<Self, Texture3dError>

Creates a legacy opaque material; tint must be normalized with alpha one, and every source texel must have alpha 255, even for alpha-capable textures.

Source

pub fn with_alpha( texture: &Texture3d, sampling: ImageSampling, tint: Color, ) -> Result<Self, Texture3dError>

Creates a material preserving normalized straight-linear tint and texture alpha. Coverage/depth behavior is chosen by each object’s surface style.

Source

pub fn with_uv_transform(self, transform: TextureUvTransform3d) -> Self

Applies validated continuous UV scale then offset, before hardware addressing.

Source

pub fn with_address_mode(self, mode: TextureAddressMode3d) -> Self

Selects addressing of the whole texture; Repeat requires an isolated image for tile safety.

Source

pub fn with_texture(&self, texture: &Texture3d) -> Result<Self, Texture3dError>

Rebinds a new texture snapshot while preserving tint, filtering, UV and alpha policy. Legacy opaque materials reject a new snapshot containing nonopaque texels.

Source

pub const fn uv_transform(&self) -> TextureUvTransform3d

Returns continuous pre-addressing coordinate transformation.

Source

pub const fn address_mode(&self) -> TextureAddressMode3d

Returns complete-image clamp/repeat addressing.

Source

pub const fn texture(&self) -> &Texture3d

Returns the shared immutable texture handle.

Source

pub const fn sampling(&self) -> ImageSampling

Returns nearest or linear filtering. Generated chains use nearest-mip or trilinear sampling respectively, with derivative-selected LOD. Alpha-aware mip generation does not make straight-RGBA bilinear filtering fringe-free.

Source

pub const fn tint(&self) -> Color

Returns the normalized multiplicative straight-linear RGBA tint.

Trait Implementations§

Source§

impl Clone for TextureMaterial3d

Source§

fn clone(&self) -> TextureMaterial3d

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,