Skip to content

holg/gldf-rs

Repository files navigation

Rust PyPI crates.io

gldf-rs

A cross-platform GLDF (General Lighting Data Format) processing library and suite of applications.

gldf-rs logo

Overview

gldf-rs provides comprehensive tools for working with GLDF files - the modern container format for luminaire and sensor data. GLDF files are ZIP containers containing product.xml definitions along with associated binaries like images, Eulumdat/IES photometry files, and L3D 3D models.

Learn more at: https://gldf.io

Project Structure

gldf-rs/
├── crates/
│   ├── gldf-rs-lib/           # Core Rust library
│   ├── gldf-rs-wasm/          # WebAssembly viewer (Yew + Bevy 3D)
│   ├── gldf-rs-egui/          # Desktop GUI (egui)
│   ├── gldf-rs-python/        # Python bindings (PyO3)
│   ├── gldf-rs-ffi/           # FFI bindings (Swift/Kotlin)
│   ├── gldf-bevy/             # Bevy 3D scene renderer
│   ├── gldf-stadium-plugin/   # Stadium lighting plugin
│   ├── gldf-starsky-wasm/     # Star sky WASM plugin
│   └── gldf-ifc-viewer-wasm/  # IFC viewer WASM module
├── bindings/
│   └── csharp/                # C# / .NET bindings (uniffi-bindgen-cs)
├── GldfApp/                   # Native iOS/macOS/Android apps
├── tests/                     # Shared test data
└── scripts/                   # Build & utility scripts

Packages

Package Description Published
gldf-rs Core Rust library for GLDF parsing, IFC integration, plugin system crates.io
gldf-rs-wasm WebAssembly app with GLDF editor, 3D viewer, photometry diagrams gldf.icu
gldf-bevy Bevy-based 3D scene renderer with L3D models and lighting -
gldf-rs-egui Desktop GUI application with 3D L3D viewer -
gldf-rs-python Python bindings via PyO3 PyPI
gldf-rs-ffi FFI bindings for Swift/Kotlin (iOS, macOS, Android) -
bindings/csharp C# / .NET bindings via uniffi-bindgen-cs -
gldf-stadium-plugin Stadium lighting plugin (example plugin architecture) -
GldfApp Native applications for iOS, macOS, and Android -

Features

  • Parse GLDF containers and product.xml definitions
  • Convert between XML and JSON representations
  • Extract and process embedded files (images, photometry, 3D models)
  • Convert LDT/IES photometry files to GLDF (Rust, Python, WASM)
  • IFC integration: Import/export IFC (Industry Foundation Classes) files with STEP parser
  • Plugin system: Extensible architecture for custom luminaire scenes (stadium, star sky)
  • Support for meta-information.xml and multi-variant GLDF files
  • Bevy 3D scene renderer: Room, road, parking, and outdoor scenes with realistic lighting
  • LDT/IES photometry diagram rendering (Polar, Cartesian, Heatmap, 3D Butterfly, BUG, LCS, Cone, Isocandela, Isolux, Floodlight V-H)
  • JSON/XML export with browser download
  • Multi-language bindings: Python (PyO3), Swift/Kotlin (UniFFI), C# (.NET)
  • Native apps with Swift Package Manager support

Live Demo

Try the WASM-based GLDF viewer at: https://gldf.icu

Quick Start

Rust Library

use gldf_rs::GldfProduct;

let loaded = GldfProduct::load_gldf("./tests/data/test.gldf").unwrap();

// Display pretty printed XML
let x_serialized = loaded.to_xml().unwrap();
println!("{}", x_serialized);

// Convert to JSON
let json_str = loaded.to_json().unwrap();
println!("{}", json_str);

// Round-trip: JSON back to XML
let j_loaded = GldfProduct::from_json(&json_str).unwrap();
let x_reserialized = j_loaded.to_xml().unwrap();
assert_eq!(x_serialized, x_reserialized);

WASM Web Viewer

cd crates/gldf-rs-wasm
# Full build with Bevy 3D loader:
./scripts/build-wasm-split.sh
# Serve locally:
python3 -m http.server 8052 --directory dist
# Open http://127.0.0.1:8052

Desktop GUI (egui)

cargo run -p gldf-rs-egui --release

Native Apps

# macOS
cd GldfApp
./scripts/build_macos.sh

# iOS/macOS via Swift Package Manager
./scripts/build_spm_package.sh

Working with Photometry Files

let phot_files = loaded.get_phot_files().unwrap();
for f in phot_files.iter() {
    let file_id = f.id.to_string();
    let ldc_content = loaded.get_ldc_by_id(file_id).unwrap();
    println!("{}: {} bytes", f.file_name, ldc_content.len());
}

Release Notes

0.3.4 (upcoming)

  • IFC integration: Import/export IFC files with STEP parser and GLDF generator
  • Plugin system: Extensible architecture with stadium and star sky example plugins
  • Bevy 3D scene renderer:
    • Room, road, parking, and outdoor scenes with scene switching (keys 1-4)
    • Correct emitter positioning (mm→m conversion for L3D light emitting objects)
    • Scene-aware mounting: outdoor pole height vs room ceiling clamp
    • Dynamic light range/intensity scaling based on mounting height
  • New photometry diagrams: Cone, Isocandela, Isolux, Floodlight Cartesian (V-H)
  • Combined multi-variant GLDF support: Load and inspect multi-variant files with correct file matching
  • C# / .NET bindings via uniffi-bindgen-cs
  • JSON/XML export: Browser download for exported files
  • Local CI script: scripts/test-ci-locally.sh for pre-push validation

0.3.3

  • LDT/IES to GLDF conversion: New Python bindings for converting photometry files
    • ldt_to_gldf_json(), ldt_to_gldf_bytes(), gldf_from_bytes(), gldf_json_to_bytes()
  • WASM Viewer improvements:
    • Clear and Help buttons in toolbar
    • Context-sensitive help overlay
    • Photometry editor with dual-value display (GLDF vs calculated from LDT/IES)
    • LDT diagram tabs (Polar, Cartesian, Heatmap, 3D Butterfly, BUG, LCS)
    • Click-to-zoom for diagram inspection
  • CI improvements: Updated deny.toml, fixed clippy warnings

0.3.1

  • Workspace reorganization: All crates moved to crates/ directory
  • New desktop GUI: gldf-rs-egui - cross-platform desktop viewer using egui
    • Interactive 3D L3D model viewer (spawns subprocess for macOS compatibility)
    • Automatic URL asset downloading
    • PDF viewing via system viewer
    • Dark mode support
  • Improved CI/CD: Strict clippy and rustdoc checks
  • Code quality: Fixed all clippy warnings across workspace

0.3.0

  • Major refactor: Restructured as monorepo with separate packages
  • WASM Web App: Full-featured GLDF viewer with Yew framework
  • L3D 3D Viewer: WebGL-based rendering using three-d
    • Fixed: L3D files with missing MTL materials now render correctly
    • Auto-generates stub materials for OBJ files referencing missing MTL files
  • LDT Diagram Viewer: Interactive photometry visualization
  • Native Apps: iOS, macOS, and Android applications
  • FFI Bindings: Swift and Kotlin bindings via UniFFI
  • Python Bindings: PyO3-based Python package
  • Swift Package Manager: XCFramework distribution for Apple platforms

0.2.2

  • Added support for meta-information.xml

0.2.1

  • Added better documentation for the main page
  • Refactored for WASM support using reqwest::blocking

0.2.0

  • Refactored gldf.rs into submodules
  • Added support for BOM encoded UTF8 product.xml
  • Added support for URL file_types
  • Added better documentation

License

AGPL-3.0-or-later

About

Process GLDF

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors