Module batch

Module batch 

Source
Expand description

Batch rendering API for multiple viewpoints and objects.

This module provides efficient batch rendering that eliminates subprocess spawning and Bevy app initialization overhead. A single Bevy app instance is kept alive and reused to render multiple viewpoints, achieving 10-100x speedup for typical batches.

§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 persistent renderer (initializes once)
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 a persistent Bevy app for batch rendering.

Enums§

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