pub fn render_to_buffer(
object_dir: &Path,
camera_transform: &Transform,
object_rotation: &ObjectRotation,
config: &RenderConfig,
) -> Result<RenderOutput, RenderError>Expand description
Render a YCB object to an in-memory buffer.
This is the primary API for headless rendering. It spawns a minimal Bevy app, renders a single frame, extracts the RGBA and depth data, and shuts down.
§Arguments
object_dir- Path to YCB object directory (e.g., “/tmp/ycb/003_cracker_box”)camera_transform- Camera position and orientation (usegenerate_viewpoints)object_rotation- Rotation to apply to the objectconfig- Render configuration (resolution, depth range, etc.)
§Example
ⓘ
use bevy_sensor::{render_to_buffer, RenderConfig, ViewpointConfig, ObjectRotation};
use std::path::Path;
let viewpoints = bevy_sensor::generate_viewpoints(&ViewpointConfig::default());
let output = render_to_buffer(
Path::new("/tmp/ycb/003_cracker_box"),
&viewpoints[0],
&ObjectRotation::identity(),
&RenderConfig::tbp_default(),
)?;