pub struct PlotRenderer {
pub wgpu_renderer: WgpuRenderer,
pub scene: Scene,
pub camera: Camera,
pub theme: PlotThemeConfig,
/* private fields */
}Expand description
Unified plot renderer that handles both interactive and static rendering
Fields§
§wgpu_renderer: WgpuRendererWGPU renderer for GPU-accelerated rendering
scene: SceneCurrent scene being rendered
camera: CameraCamera for view transformations
theme: PlotThemeConfigCurrent theme configuration
Implementations§
Source§impl PlotRenderer
impl PlotRenderer
Sourcepub async fn new(
device: Arc<Device>,
queue: Arc<Queue>,
surface_config: SurfaceConfiguration,
) -> Result<Self, Box<dyn Error>>
pub async fn new( device: Arc<Device>, queue: Arc<Queue>, surface_config: SurfaceConfiguration, ) -> Result<Self, Box<dyn Error>>
Create a new plot renderer
Sourcepub fn set_figure(&mut self, figure: Figure)
pub fn set_figure(&mut self, figure: Figure)
Set the figure to render
Sourcepub fn calculate_data_bounds(&mut self) -> Option<(f64, f64, f64, f64)>
pub fn calculate_data_bounds(&mut self) -> Option<(f64, f64, f64, f64)>
Calculate data bounds from scene
Sourcepub fn fit_camera_to_data(&mut self)
pub fn fit_camera_to_data(&mut self)
Fit camera to show all data
Sourcepub fn render_to_viewport(
&mut self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
_viewport: (f32, f32, f32, f32),
clear_background: bool,
background_color: Option<Vec4>,
) -> Result<RenderResult, Box<dyn Error>>
pub fn render_to_viewport( &mut self, encoder: &mut CommandEncoder, target_view: &TextureView, _viewport: (f32, f32, f32, f32), clear_background: bool, background_color: Option<Vec4>, ) -> Result<RenderResult, Box<dyn Error>>
Render the current scene to a specific viewport within a texture/surface
Sourcepub fn render_direct_to_viewport(
&mut self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
viewport: (f32, f32, f32, f32),
data_bounds: (f64, f64, f64, f64),
clear_background: bool,
background_color: Option<Vec4>,
) -> Result<RenderResult, Box<dyn Error>>
pub fn render_direct_to_viewport( &mut self, encoder: &mut CommandEncoder, target_view: &TextureView, viewport: (f32, f32, f32, f32), data_bounds: (f64, f64, f64, f64), clear_background: bool, background_color: Option<Vec4>, ) -> Result<RenderResult, Box<dyn Error>>
High-performance direct viewport rendering with optimized coordinate transformation Provides precise data-to-screen mapping for interactive plot windows
Sourcepub fn render(
&mut self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
config: &PlotRenderConfig,
) -> Result<RenderResult, Box<dyn Error>>
pub fn render( &mut self, encoder: &mut CommandEncoder, target_view: &TextureView, config: &PlotRenderConfig, ) -> Result<RenderResult, Box<dyn Error>>
Render the current scene to a texture/surface
Sourcepub fn camera_mut(&mut self) -> &mut Camera
pub fn camera_mut(&mut self) -> &mut Camera
Get mutable camera reference
Sourcepub fn scene_statistics(&self) -> SceneStatistics
pub fn scene_statistics(&self) -> SceneStatistics
Get scene statistics
Auto Trait Implementations§
impl !Freeze for PlotRenderer
impl !RefUnwindSafe for PlotRenderer
impl Send for PlotRenderer
impl Sync for PlotRenderer
impl Unpin for PlotRenderer
impl !UnwindSafe for PlotRenderer
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