Files
wsg/lib/examples
Jérôme Bousquié eeb471f37c feat(camera): orbital CameraController + final demo example
Add resources::CameraController (Etapes 15.C): spherical yaw/pitch/distance/
target with orbit() (mouse drag), zoom() (wheel, clamped), reset(), and
apply_to(&mut Camera). Add Scene::camera_mut() for in-place per-frame edits.

New lib/examples/demo.rs: all six primitives on a textured ground, standard
Phong material, shadow-casting directional + point + spot lights, and a live
orbital view driven by the unified input (drag=orbit, wheel=zoom, R=reset,
1/2/3=front/side/top presets) plus slow primitive rotation.

6 unit tests for CameraController.
2026-09-20 08:10:03 +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
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 (Étape 14): 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.