Skip to main content

Crate eulumdat_bevy

Crate eulumdat_bevy 

Source
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 application
  • viewer - Demo application with pre-built scenes and controls (requires viewer feature)

§Feature Flags

  • photometric - Generic photometric lighting (minimal dependencies)
  • viewer - Full demo application with scenes, camera, controls (implies photometric)
  • wasm-sync - localStorage polling for WASM hot-reload (implies viewer)
  • standalone - Enable standalone binary (implies wasm-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§

EulumdatLight
Type alias for convenience
EulumdatLightBundle
Type alias for convenience