pub struct Wgpu3DRenderer { /* private fields */ }Expand description
Hardware-accelerated wgpu 3D renderer capable of rendering directly into any TextureView
(swapchain surface) or offscreen RGBA target.
Implementations§
Source§impl Wgpu3DRenderer
impl Wgpu3DRenderer
Sourcepub fn new_headless(color_format: TextureFormat) -> Result<Self, String>
pub fn new_headless(color_format: TextureFormat) -> Result<Self, String>
Creates a headless Wgpu3DRenderer using any available hardware or software Vulkan/GL adapter.
Sourcepub fn from_device(
device: Arc<Device>,
queue: Arc<Queue>,
color_format: TextureFormat,
) -> Self
pub fn from_device( device: Arc<Device>, queue: Arc<Queue>, color_format: TextureFormat, ) -> Self
Creates a Wgpu3DRenderer bound to an existing wgpu::Device & wgpu::Queue (e.g., from a window surface).
pub fn device(&self) -> &Arc<Device> ⓘ
pub fn queue(&self) -> &Arc<Queue> ⓘ
pub fn color_format(&self) -> TextureFormat
Sourcepub fn cached_geo_mesh_count(&self) -> usize
pub fn cached_geo_mesh_count(&self) -> usize
Number of currently cached GPU geodetic object mesh buffers.
Sourcepub fn cached_geo_texture_count(&self) -> usize
pub fn cached_geo_texture_count(&self) -> usize
Number of currently cached GPU geodetic object albedo textures.
Sourcepub fn create_overlay_bind_group(&self, overlay_view: &TextureView) -> BindGroup
pub fn create_overlay_bind_group(&self, overlay_view: &TextureView) -> BindGroup
Creates an RGBA wgpu::BindGroup for compositing a 2D UI HUD texture over a 3D frame.
Sourcepub fn render_scene_to_view(
&mut self,
scene: &Scene3D,
target_view: &TextureView,
target_width: u32,
target_height: u32,
viewport: Option<[f32; 4]>,
unlimited_upload_budget: bool,
)
pub fn render_scene_to_view( &mut self, scene: &Scene3D, target_view: &TextureView, target_width: u32, target_height: u32, viewport: Option<[f32; 4]>, unlimited_upload_budget: bool, )
Draws scene (or its [RetainedScene3D] / RetainedTerrainFrame) directly into target_view.
When viewport is Some([x, y, w, h]), restricts rendering to that sub-rectangle of the
render target and uses w/h as the projection aspect ratio.
Sourcepub fn render_scene_and_overlay_to_view(
&mut self,
scene: &Scene3D,
target_view: &TextureView,
target_width: u32,
target_height: u32,
viewport: Option<[f32; 4]>,
unlimited_upload_budget: bool,
overlay_bind_group: Option<&BindGroup>,
)
pub fn render_scene_and_overlay_to_view( &mut self, scene: &Scene3D, target_view: &TextureView, target_width: u32, target_height: u32, viewport: Option<[f32; 4]>, unlimited_upload_budget: bool, overlay_bind_group: Option<&BindGroup>, )
Draws scene and optionally composites the cached 2D HUD overlay_bind_group into
target_view using a single CommandEncoder and a single queue.submit.
Sourcepub fn render_viewports_and_overlay_to_view(
&mut self,
viewports: &[([f32; 4], &Scene3D)],
target_view: &TextureView,
target_width: u32,
target_height: u32,
unlimited_upload_budget: bool,
overlay_bind_group: Option<&BindGroup>,
)
pub fn render_viewports_and_overlay_to_view( &mut self, viewports: &[([f32; 4], &Scene3D)], target_view: &TextureView, target_width: u32, target_height: u32, unlimited_upload_budget: bool, overlay_bind_group: Option<&BindGroup>, )
Renders multiple 3D viewports ((viewport_rect, scene)) sequentially into target_view
without clearing prior viewports, and composites overlay_bind_group once on the final pass.
Sourcepub fn composite_overlay_to_view(
&self,
target_view: &TextureView,
overlay_bind_group: &BindGroup,
)
pub fn composite_overlay_to_view( &self, target_view: &TextureView, overlay_bind_group: &BindGroup, )
Composites a GPU 2D UI HUD overlay bind group on top of target_view (preserving alpha).
Sourcepub fn render_offscreen(
&mut self,
scene: &Scene3D,
width: u32,
height: u32,
readback: bool,
unlimited_upload_budget: bool,
) -> Result<Vec<u8>, String>
pub fn render_offscreen( &mut self, scene: &Scene3D, width: u32, height: u32, readback: bool, unlimited_upload_budget: bool, ) -> Result<Vec<u8>, String>
Renders scene into a persistent offscreen texture and performs GPU->CPU readback only
when readback is true (pure GPU timing benchmarks pass readback = false).