Trait luminance::backend::color_slot::ColorSlot [−][src]
pub trait ColorSlot<B, D> where
B: ?Sized + Framebuffer<D>,
D: Dimensionable,
D::Size: Copy, {
type ColorTextures;
fn color_formats() -> Vec<PixelFormat>;
fn reify_color_textures<C>(
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: &Sampler,
framebuffer: &mut B::FramebufferRepr,
attachment_index: usize
) -> Result<Self::ColorTextures, FramebufferError>
where
C: GraphicsContext<Backend = B>;
}
Expand description
A color slot.
A color slot represents the associated color data within a Framebuffer
. This type is entirely constructed at
compile-time to ensure type safety. Even though this trait lives on the backend side of luminance, no backend is
supposed to implement it, but instead use it.
Three types of color slots exist:
- None, represented by the
()
implementor. - A single color
Texture
. This type of color slot is often suitable for renderable framebuffer. - A tuple of different color
Texture
. This situation is mostly used for multi render target, allowing to render (via a fragment shader) into different part of the color slot.
For color slots that have color textures, the pixel type must be a RenderablePixel
as well as a ColorPixel
.
Feel free to have a look at the list of implementors of this trait to know which types you can use as color slots.
Associated Types
type ColorTextures
type ColorTextures
The associated data.
This type represents the available, constructed object that will be usable outside of the Framebuffer
. There
is no trait to implement on this type but you mostly want to map a single Texture
or a tuple of texture by
using this as a type family for your implementor type.
Required methods
fn color_formats() -> Vec<PixelFormat>
fn color_formats() -> Vec<PixelFormat>
Pixel format representing the color slot.
Those PixelFormat
represent the format of each part of the color slot.
fn reify_color_textures<C>(
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: &Sampler,
framebuffer: &mut B::FramebufferRepr,
attachment_index: usize
) -> Result<Self::ColorTextures, FramebufferError> where
C: GraphicsContext<Backend = B>,
fn reify_color_textures<C>(
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: &Sampler,
framebuffer: &mut B::FramebufferRepr,
attachment_index: usize
) -> Result<Self::ColorTextures, FramebufferError> where
C: GraphicsContext<Backend = B>,
Reify the color slots into 0, 1 or several textures.
This function must construct and initialize all the required textures.