Eulumdat 3D Scene Viewer Library
This crate provides Bevy-based photometric lighting visualization.
Architecture
The crate is organized into two main modules:
- [
photometric] - Generic photometric lighting for any Bevy application viewer- Demo application with pre-built scenes and controls (requiresviewerfeature)
Feature Flags
photometric- Generic photometric lighting (minimal dependencies)viewer- Full demo application with scenes, camera, controls (impliesphotometric)wasm-sync- localStorage polling for WASM hot-reload (impliesviewer)standalone- Enable standalone binary (implieswasm-sync)
Usage as a Generic Photometric Plugin
For embedding photometric lights in your own Bevy application:
use bevy::prelude::*;
use eulumdat_bevy::photometric::*;
use eulumdat_bevy::{EulumdatLight, EulumdatLightBundle};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(PhotometricPlugin::<eulumdat::Eulumdat>::default())
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
// Your own camera
commands.spawn(Camera3dBundle { ... });
// Your own scene geometry
commands.spawn(PbrBundle { ... });
// Spawn a photometric light
let ldt = eulumdat::Eulumdat::from_file("light.ldt").unwrap();
commands.spawn(EulumdatLightBundle::new(ldt)
.with_transform(Transform::from_xyz(0.0, 3.0, 0.0)));
}
Usage as a Demo Viewer
For the full demo experience with pre-built scenes:
use bevy::prelude::*;
use eulumdat_bevy::viewer::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(EulumdatViewerPlugin::default())
.run();
}
Implementing PhotometricData for Custom Types
To use photometric lighting with your own data format:
use eulumdat_bevy::photometric::PhotometricData;
impl PhotometricData for MyLightData {
fn sample(&self, c_angle: f64, g_angle: f64) -> f64 { ... }
fn max_intensity(&self) -> f64 { ... }
// ... implement other required methods
}
// Then use PhotometricPlugin with your type:
app.add_plugins(PhotometricPlugin::<MyLightData>::default());