Skip to main content

Module batch

Module batch 

Source
Expand description

Batch rendering API for multiple viewpoints and objects.

Today this module is a queue-oriented wrapper around sequential render_to_buffer() calls. It does not yet keep a persistent Bevy app alive across renders; that follow-up remains tracked work. The API is still useful for consumers that want ordered request management and structured batch outputs without promising reuse semantics that do not exist yet.

§Example

use bevy_sensor::{
    create_batch_renderer, queue_render_request, render_next_in_batch,
    batch::BatchRenderRequest, BatchRenderConfig, RenderConfig, ObjectRotation,
};
use std::path::PathBuf;

// Create a batch helper
let config = BatchRenderConfig::default();
let mut renderer = create_batch_renderer(&config)?;

// Queue multiple renders
for rotation in rotations {
    for viewpoint in viewpoints {
        queue_render_request(&mut renderer, BatchRenderRequest {
            object_dir: "/tmp/ycb/003_cracker_box".into(),
            viewpoint,
            object_rotation: rotation.clone(),
            render_config: RenderConfig::tbp_default(),
        })?;
    }
}

// Execute and collect results
let mut results = Vec::new();
loop {
    match render_next_in_batch(&mut renderer, 500)? {
        Some(output) => results.push(output),
        None => break,
    }
}

Structs§

BatchRenderConfig
Configuration for batch rendering.
BatchRenderOutput
Output from a single render in a batch.
BatchRenderRequest
A single render request in a batch.
BatchRenderer
Manages queued render requests and completed outputs for batch-style workflows.

Enums§

BatchRenderError
Error types for batch rendering.
BatchState
State machine for batch rendering lifecycle.
RenderStatus
Status of a single render in a batch.