pub fn initialize()Expand description
Initialize bevy-sensor rendering backend configuration.
IMPORTANT: Call this function ONCE at the start of your application, before any rendering operations, especially when using bevy-sensor as a library.
This ensures proper backend selection (WebGPU for WSL2, Vulkan for Linux, etc.) and is critical for GPU rendering on WSL2 environments.
§Why This Matters
The WGPU rendering backend caches its backend selection early during initialization. When bevy-sensor is used as a library, environment variables must be set BEFORE any GPU rendering code runs. This function does that automatically.
§Example
ⓘ
use bevy_sensor;
fn main() {
// Initialize FIRST, before any rendering
bevy_sensor::initialize();
// Now use the rendering API
let output = bevy_sensor::render_to_buffer(
object_dir, &viewpoint, &rotation, &config
)?;
}§Calling Multiple Times
Safe to call multiple times - subsequent calls are no-ops after the first call.