Expand description
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 applicationviewer- 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());Re-exports§
pub use photometric::PhotometricData;pub use photometric::PhotometricLight;pub use photometric::PhotometricLightBundle;pub use photometric::PhotometricPlugin;pub use viewer::EulumdatViewerPlugin;pub use viewer::SceneType;pub use viewer::ViewerSettings;pub use viewer::ViewerSettings as SceneSettings;
Modules§
- photometric
- Photometric lighting module for Bevy.
- viewer
- Viewer module - demo application with scenes, camera, and controls.
Functions§
- run_
native - Run the 3D viewer as a native window (desktop).
Type Aliases§
- Eulumdat
Light - Type alias for convenience
- Eulumdat
Light Bundle - Type alias for convenience