Expand description
wgpu renderers for cadkit_scene.
PlanRendererdraws the chunks of acadkit_scene::PlanFrame: analytic lines and arcs with mitred polyline corners and one-pixel antialiasing, blended premultiplied. Chunk buffers are uploaded once per content generation; moving the camera only rewrites 32 bytes per chunk.MeshRendererdraws acadkit_scene::MeshScenewith anOrbitCamera, depth testing and flat lighting, with incremental mesh and camera updates.render_texture,render_offscreenandRenderTargetCacherender meshes into textures or read them back as RGBA.
The renderers take a wgpu::Device, wgpu::Queue, a target format and a
wgpu::RenderPass; they do not open windows or depend on a UI toolkit. The wgpu
version is part of this crate’s API and is re-exported as wgpu.
GPU validation and out-of-memory errors are captured with error scopes and returned as
GpuErrors.
Re-exports§
pub use wgpu;
Structs§
- Adapter
Summary - Description of the adapter an offscreen image came from.
- Mesh
Renderer - Pipeline for
MeshScenes:Depth32Floatdepth, single-sampled, opaque. - Offscreen
Image - RGBA pixels read back from the GPU.
- Orbit
Camera - A perspective camera orbiting
target, with +Z up. - Plan
Renderer - Draws
ChunkDraws; see the crate documentation. - Plan
Target - Where a frame is drawn, in physical pixels of the render target.
- Prepared
Meshes - GPU buffers of a prepared scene.
- Render
Target Cache - Keeps the depth texture until the size changes and reuses recycled color textures.
- Render
Target Stats - Allocation counters of a
RenderTargetCache. - Render
Texture Recycler - Returns displayed textures to a
RenderTargetCacheonce the UI no longer shows them. - Rendered
Texture - A rendered
Rgba8UnormSrgbtexture and anRgba8Unormview of it for UI toolkits that sample without conversion.
Enums§
- GpuError
- Why a GPU operation failed.
Functions§
- block_
on - Runs
futureto completion on the current thread by polling it in a yielding loop. - mesh_
budget - Scene budget derived from the device: one vertex and one index buffer must fit
max_buffer_size, capped at 8M vertices and 16M triangles and never belowMeshBudget::default. - render_
offscreen - Opens the default high-performance adapter, renders
sceneinto a 1..=4096 pixel image and reads it back. For export and device checks; interactive views keep textures on the GPU withrender_texture_cached. - render_
offscreen_ with - Renders
sceneon an existing device and reads back RGBA; opens no adapter. The size is limited by the device’s texture limit. - render_
texture - Renders
preparedinto a newwidthxheighttexture and waits for the GPU. - render_
texture_ cached - Like
render_texture, reusing the depth texture and recycled color textures oftargets. The renderer must targetRgba8UnormSrgb.