Files
wsg/lib/src/scene/README.md
T
Jérôme Bousquié 3414d68819 Plan
2026-07-08 15:58:20 +02:00

1.4 KiB

Scene Module — Resource Depot and Entity Graph

Overview

The scene module defines Scene, the declarative layer of the WSG architecture. Users register resources (Meshes, Materials) by identifier before the render loop starts, then associate entities via labels. At runtime, Scene provides immutable access to these resources without exposing raw wgpu handles.

Files

File Responsibility
scene Scene struct — resource depot storing Meshes and Materials keyed by string identifiers, plus entity graph mapping labels to (mesh_id, material_id) pairs for rendering iteration.

Interaction with Other Modules

  • core::renderer: Renderer queries Scene for Material/Mesh pairs during frame rendering; Context does not interact directly.
  • pipeline: PipelineCache creates Materials keyed by shader_id; Scene stores references to those Materials.
  • resources: Scene owns Arc and Arc instances; Vertex is only used at Mesh creation time.
  • utils: Scene uses WsgError if resource registration fails.

Architecture Note

Per ARCHI_APP, Scene is one half of the "App" facade pattern. It enables a declarative workflow where all resources are declared before the render loop begins, while keeping the freedom to build the engine "brick by brick" through direct Context/PipelineCache/Renderer manipulation.