pub struct WgpuRenderer {
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub surface_config: SurfaceConfiguration,
pub direct_line_pipeline: Option<RenderPipeline>,
pub direct_uniform_bind_group: BindGroup,
/* private fields */
}Expand description
High-performance WGPU renderer for interactive plotting
Fields§
§device: Arc<Device>§queue: Arc<Queue>§surface_config: SurfaceConfiguration§direct_line_pipeline: Option<RenderPipeline>§direct_uniform_bind_group: BindGroupImplementations§
Source§impl WgpuRenderer
impl WgpuRenderer
Sourcepub async fn new(
device: Arc<Device>,
queue: Arc<Queue>,
surface_config: SurfaceConfiguration,
) -> Self
pub async fn new( device: Arc<Device>, queue: Arc<Queue>, surface_config: SurfaceConfiguration, ) -> Self
Create a new WGPU renderer
Sourcepub fn create_vertex_buffer(&self, vertices: &[Vertex]) -> Buffer
pub fn create_vertex_buffer(&self, vertices: &[Vertex]) -> Buffer
Create a vertex buffer from vertex data
Sourcepub fn create_index_buffer(&self, indices: &[u32]) -> Buffer
pub fn create_index_buffer(&self, indices: &[u32]) -> Buffer
Create an index buffer from index data
Sourcepub fn update_uniforms(&mut self, view_proj: Mat4, model: Mat4)
pub fn update_uniforms(&mut self, view_proj: Mat4, model: Mat4)
Update uniform buffer with new matrices
Sourcepub fn get_uniform_bind_group(&self) -> &BindGroup
pub fn get_uniform_bind_group(&self) -> &BindGroup
Get the uniform bind group for rendering
Sourcepub fn ensure_pipeline(&mut self, pipeline_type: PipelineType)
pub fn ensure_pipeline(&mut self, pipeline_type: PipelineType)
Ensure pipeline exists for the specified type
Sourcepub fn get_pipeline(&self, pipeline_type: PipelineType) -> &RenderPipeline
pub fn get_pipeline(&self, pipeline_type: PipelineType) -> &RenderPipeline
Get a pipeline reference (pipeline must already exist)
Sourcepub fn begin_render_pass<'a>(
&'a self,
encoder: &'a mut CommandEncoder,
view: &'a TextureView,
_depth_view: &'a TextureView,
) -> RenderPass<'a>
pub fn begin_render_pass<'a>( &'a self, encoder: &'a mut CommandEncoder, view: &'a TextureView, _depth_view: &'a TextureView, ) -> RenderPass<'a>
Begin a render pass
Sourcepub fn render_vertices<'a>(
&'a mut self,
render_pass: &mut RenderPass<'a>,
pipeline_type: PipelineType,
vertex_buffer: &'a Buffer,
vertex_count: u32,
index_buffer: Option<(&'a Buffer, u32)>,
)
pub fn render_vertices<'a>( &'a mut self, render_pass: &mut RenderPass<'a>, pipeline_type: PipelineType, vertex_buffer: &'a Buffer, vertex_count: u32, index_buffer: Option<(&'a Buffer, u32)>, )
Render vertices with the specified pipeline
Sourcepub fn ensure_direct_line_pipeline(&mut self)
pub fn ensure_direct_line_pipeline(&mut self)
Ensure direct line pipeline exists
Auto Trait Implementations§
impl !Freeze for WgpuRenderer
impl !RefUnwindSafe for WgpuRenderer
impl Send for WgpuRenderer
impl Sync for WgpuRenderer
impl Unpin for WgpuRenderer
impl !UnwindSafe for WgpuRenderer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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