pub struct Renderer<'engine> { /* private fields */ }Expand description
Engine-borrowing headless render-to-texture session.
Admits multiple frame sources through the same slot-ring lifecycle.
submit_frame returns a RenderFrame carrying the color Texture and
exact producer Event.
Implementations§
Source§impl<'engine> Renderer<'engine>
impl<'engine> Renderer<'engine>
Sourcepub fn new(engine: &'engine Engine, config: RendererConfig) -> Result<Self>
pub fn new(engine: &'engine Engine, config: RendererConfig) -> Result<Self>
Create a bounded headless target ring borrowing engine.
When max_vertex_count / max_index_count are non-zero and the Engine
has a graphics queue, all graphics pipelines are created and per-slot
render targets and mesh buffers are allocated.
§Errors
Returns an error for zero extent, zero or >4 target slots, invalid light/color config, a missing graphics queue when mesh capacity is requested, or device allocation failure.
Sourcepub fn config(&self) -> &RendererConfig
pub fn config(&self) -> &RendererConfig
Return this session’s fixed configuration.
Sourcepub fn has_mesh_path(&self) -> bool
pub fn has_mesh_path(&self) -> bool
Return whether the graphics draw paths are available.
Sourcepub fn register_texture(
&self,
handle: TextureHandle,
texture: &Texture,
) -> Result<()>
pub fn register_texture( &self, handle: TextureHandle, texture: &Texture, ) -> Result<()>
Associate a semantic material texture handle with one native Texture.
Replacing an existing handle affects future frames only. Submitted frames retain the exact native image they referenced until their producer event completes.
Sourcepub fn begin_frame(&self, source: &Texture) -> Result<()>
pub fn begin_frame(&self, source: &Texture) -> Result<()>
Begin one frame from a completed packed source Texture (blit path).
Sourcepub fn begin_frame_mesh(&self, mesh: &MeshData, camera: &Camera) -> Result<()>
pub fn begin_frame_mesh(&self, mesh: &MeshData, camera: &Camera) -> Result<()>
Begin one frame using the vertex-color-lit pipeline.
Requires has_mesh_path().
Sourcepub fn begin_frame_flat_color(
&self,
mesh: &MeshData,
camera: &Camera,
material: &FlatColorMaterial,
) -> Result<()>
pub fn begin_frame_flat_color( &self, mesh: &MeshData, camera: &Camera, material: &FlatColorMaterial, ) -> Result<()>
Begin one frame using the flat-color material pipeline.
Requires has_mesh_path(). material parameters are baked into the
push constant block at record time — no GPU buffer is retained.
Sourcepub fn begin_frame_canvas_grid(&self, frame: &CanvasGridFrame) -> Result<()>
pub fn begin_frame_canvas_grid(&self, frame: &CanvasGridFrame) -> Result<()>
Begin one frame drawing the procedural canvas grid.
Requires has_mesh_path(). The draw is a vertexless fullscreen
triangle; frame is baked into the 100-byte fragment push block and
the scissor limits coverage to frame’s destination rect.
Sourcepub fn begin_frame_unlit(
&self,
mesh: &MeshData,
camera: &Camera,
material: &UnlitMaterial,
) -> Result<()>
pub fn begin_frame_unlit( &self, mesh: &MeshData, camera: &Camera, material: &UnlitMaterial, ) -> Result<()>
Begin one frame using the unlit textured material pipeline.
Requires has_mesh_path(). Material tint and UV transform are baked
into the push block. base_color_texture resolves through
Renderer::register_texture; None uses the renderer’s retained white
texture so tint-only unlit materials remain a valid draw path.
Sourcepub fn begin_frame_scene(&self, scene: &Scene, camera: &Camera) -> Result<()>
pub fn begin_frame_scene(&self, scene: &Scene, camera: &Camera) -> Result<()>
Begin one frame by compiling and drawing a semantic Scene.
Requires has_mesh_path(). The scene is validated and compiled into a
merged world-space mesh. Each visible mesh node with geometry produces
one draw call; nodes with different materials bind different material
UBOs and descriptor sets within the same render pass.
Material dispatch:
Material::Surface→ Surface PBR pipeline.None(no assignment) →SurfaceMaterial::default().- Non-Surface materials and scenes exceeding
max_materials_per_sceneare rejected.
§Errors
Returns an error when the graphics path is unavailable, the scene fails
validation or produces an empty mesh, the compiled vertex/index count
exceeds configured capacity, more than max_materials_per_scene
distinct materials are referenced, any assigned material is not
Material::Surface, or buffer write fails.
Sourcepub fn submit_frame(&self) -> Result<RenderFrame>
pub fn submit_frame(&self) -> Result<RenderFrame>
Submit the in-progress frame and return its target lease and producer.
Sourcepub fn cancel_frame(&self) -> Result<()>
pub fn cancel_frame(&self) -> Result<()>
Cancel the in-progress frame without submitting or waiting.