Struct re_renderer::renderer::ColormappedTexture
source · pub struct ColormappedTexture {
pub texture: GpuTexture2D,
pub range: [f32; 2],
pub decode_srgb: bool,
pub multiply_rgb_with_alpha: bool,
pub gamma: f32,
pub color_mapper: ColorMapper,
pub shader_decoding: Option<ShaderDecoding>,
}
Expand description
Describes a texture and how to map it to a color.
Fields§
§texture: GpuTexture2D
§range: [f32; 2]
Min/max range of the values in the texture.
Used to normalize the input values (squash them to the 0-1 range). The normalization is applied before sRGB gamma decoding and alpha pre-multiplication (this transformation is also applied to alpha!).
decode_srgb: bool
Decode 0-1 sRGB gamma values to linear space before filtering?
Only applies to [wgpu::TextureFormat::Rgba8Unorm
] and float textures.
multiply_rgb_with_alpha: bool
Multiply color channels with the alpha channel before filtering?
Set this to false for textures that don’t have an alpha channel or are already pre-multiplied. Applied after range normalization and srgb decoding, before filtering.
gamma: f32
Raise the normalized values to this power (before any color mapping). Acts like an inverse brightness.
Default: 1.0
color_mapper: ColorMapper
For any one-component texture, you need to supply a color mapper,
which maps the normalized .r
component to a color.
Setting a color mapper for a four-component texture is an error. Failure to set a color mapper for a one-component texture is an error.
shader_decoding: Option<ShaderDecoding>
For textures that need decoding in the shader, for example NV12 encoded images.
Implementations§
source§impl ColormappedTexture
impl ColormappedTexture
sourcepub fn from_unorm_rgba(texture: GpuTexture2D) -> Self
pub fn from_unorm_rgba(texture: GpuTexture2D) -> Self
Assumes a separate/unmultiplied alpha.
pub fn width_height(&self) -> [u32; 2]
Trait Implementations§
source§impl Clone for ColormappedTexture
impl Clone for ColormappedTexture
source§fn clone(&self) -> ColormappedTexture
fn clone(&self) -> ColormappedTexture
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ColormappedTexture
impl !RefUnwindSafe for ColormappedTexture
impl Send for ColormappedTexture
impl Sync for ColormappedTexture
impl Unpin for ColormappedTexture
impl !UnwindSafe for ColormappedTexture
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more