pub struct Renderer { /* private fields */ }
Expand description
A helper type aimed at simplifying the rendering of nannou primitives via wgpu.
Implementations§
source§impl Renderer
impl Renderer
sourcepub const DEFAULT_DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float
pub const DEFAULT_DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float
The default depth format
sourcepub const DEFAULT_GLYPH_CACHE_SIZE: [u32; 2] = _
pub const DEFAULT_GLYPH_CACHE_SIZE: [u32; 2] = _
The default size for the inner glyph cache.
sourcepub const DEFAULT_GLYPH_CACHE_SCALE_TOLERANCE: f32 = 0.100000001f32
pub const DEFAULT_GLYPH_CACHE_SCALE_TOLERANCE: f32 = 0.100000001f32
The default scale tolerance for the glyph cache.
sourcepub const DEFAULT_GLYPH_CACHE_POSITION_TOLERANCE: f32 = 0.100000001f32
pub const DEFAULT_GLYPH_CACHE_POSITION_TOLERANCE: f32 = 0.100000001f32
The default position tolerance for the glyph cache.
sourcepub const GLYPH_CACHE_TEXTURE_FORMAT: TextureFormat = wgpu::TextureFormat::R8Unorm
pub const GLYPH_CACHE_TEXTURE_FORMAT: TextureFormat = wgpu::TextureFormat::R8Unorm
The texture format of the inner glyph cache.
sourcepub const INDEX_FORMAT: IndexFormat = wgpu::IndexFormat::Uint32
pub const INDEX_FORMAT: IndexFormat = wgpu::IndexFormat::Uint32
The index format used to index into vertices.
sourcepub fn new(
device: &Device,
output_attachment_size: [u32; 2],
output_scale_factor: f32,
sample_count: u32,
output_color_format: TextureFormat,
depth_format: TextureFormat,
glyph_cache_size: [u32; 2],
glyph_cache_scale_tolerance: f32,
glyph_cache_position_tolerance: f32
) -> Self
pub fn new( device: &Device, output_attachment_size: [u32; 2], output_scale_factor: f32, sample_count: u32, output_color_format: TextureFormat, depth_format: TextureFormat, glyph_cache_size: [u32; 2], glyph_cache_scale_tolerance: f32, glyph_cache_position_tolerance: f32 ) -> Self
Create a new Renderer, ready to target an output attachment with the given size, sample count and color format.
See the RendererBuilder type for a simplified approach to building a renderer that will fall back to a set of reasonable defaults.
The depth_format
will be used to construct a depth texture for depth testing.
The glyph_cache_size
will be used to create a texture on which glyphs will be stored for
efficient look-up.
sourcepub fn fill(
&mut self,
device: &Device,
draw: &Draw,
scale_factor: f32,
output_attachment_size: [u32; 2]
)
pub fn fill( &mut self, device: &Device, draw: &Draw, scale_factor: f32, output_attachment_size: [u32; 2] )
Generate a list of RenderCommand
s from the given Draw instance and prepare any
necessary vertex data.
Note that the given Draw instance will be drained of its commands.
sourcepub fn encode_render_pass(
&mut self,
device: &Device,
encoder: &mut CommandEncoder,
draw: &Draw,
scale_factor: f32,
output_attachment_size: [u32; 2],
output_attachment: &TextureView,
resolve_target: Option<&TextureView>
)
pub fn encode_render_pass( &mut self, device: &Device, encoder: &mut CommandEncoder, draw: &Draw, scale_factor: f32, output_attachment_size: [u32; 2], output_attachment: &TextureView, resolve_target: Option<&TextureView> )
Encode a render pass with the given Drawing to the given output_attachment
.
If the Drawing has been scaled for handling DPI, specify the necessary scale_factor
for scaling back to the output_attachment_size
(physical dimensions).
If the output_attachment
is multisampled and should be resolved to another texture,
include the resolve_target
.
sourcepub fn render_to_texture(
&mut self,
device: &Device,
encoder: &mut CommandEncoder,
draw: &Draw,
texture: &Texture
)
pub fn render_to_texture( &mut self, device: &Device, encoder: &mut CommandEncoder, draw: &Draw, texture: &Texture )
Encode the necessary commands to render the contents of the given Drawing to the given Texture.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl !UnwindSafe for Renderer
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more