Files
wsg/lib/examples
Jérôme Bousquié 805babe53d HDR
2026-09-24 11:21:35 +02:00
..
2026-09-21 12:01:28 +02:00
HDR
2026-09-24 11:21:35 +02:00
HDR
2026-09-24 11:21:35 +02:00
2026-09-21 12:01:28 +02:00
2026-09-21 12:01:28 +02:00
2026-09-21 12:01:28 +02:00
2026-09-21 12:01:28 +02:00

Examples

Each .rs file in this directory is a standalone example auto-discovered by Cargo (cargo build -p wsg-lib --examples). To run an example:

cargo run -p wsg-lib --example <name>
Example Command Description
demo cargo run -p wsg-lib --example demo Showcase: one of each primitive, procedural textures, directional + point + spot lights, a shadow-casting light, and a live orbital camera (drag / wheel zoom / R reset / 1-3 presets).
simple cargo run -p wsg-lib --example simple Flat unlit quad (minimal declarative workflow, AppBuilder + auto scene).
cube cargo run -p wsg-lib --example cube Textured cube (procedural checker) lit by a directional + point + spot light.
manual cargo run -p wsg-lib --example manual Low-level workflow: Context, Renderer, PipelineCache, Mesh used directly (no App facade).
spot_test cargo run -p wsg-lib --example spot_test Spot-light isolation: only one spot is on (near-zero ambient), cube rotates on two axes so the oriented beam is clearly visible.
shadow_test cargo run -p wsg-lib --example shadow_test Shadow mapping: one directional light is the shadow caster (set_shadow_caster(Some(0))); a cube casts a PCF-softened shadow onto a thin ground slab.

Conventions

  • Examples are self-contained: no assets loaded from disk (procedural textures, hardcoded geometry).
  • They use the declarative workflow (AppBuilder + Scene) except manual, which bypasses the App facade.
  • When adding a new example: create a .rs file in this directory, document it here, and reference it in the root README if appropriate.