doc
This commit is contained in:
+18
-19
@@ -6,9 +6,9 @@ Contains WGSL shader source files used by the PipelineCache module. These are lo
|
||||
disk when referenced by their registered ID in PipelineCache.register_shader(). If a file is missing,
|
||||
PipelineCache falls back to the embedded STANDARD_SHADER constant defined in utils::conf.
|
||||
|
||||
Depuis l'Étape 5, il n'existe plus qu'**un seul shader** : `standard_shader.wgsl` (Phong). L'ancien
|
||||
`basic_shader.wgsl` a été supprimé comme pipeline séparé — le rendu 2D plat est désormais la **variante
|
||||
unlit** de `standard` (décision actée dans le DRAFT : « 2D ⊂ 3D »).
|
||||
Since Step 5, only **one shader** remains: `standard_shader.wgsl` (Phong). The former
|
||||
`basic_shader.wgsl` was removed as a separate pipeline — flat 2D rendering is now the **unlit
|
||||
variant** of `standard` (decision ratified in the DRAFT: "2D ⊂ 3D").
|
||||
|
||||
## Files
|
||||
|
||||
@@ -18,8 +18,8 @@ unlit** de `standard` (décision actée dans le DRAFT : « 2D ⊂ 3D »).
|
||||
|
||||
## Shader Contract (standard_shader.wgsl)
|
||||
|
||||
`standard_shader.wgsl` est le shader unifié (Phong) de WSG. Il expose les deux bind groups partagés
|
||||
par tout matériau (Étape 3 : un seul layout pour tous).
|
||||
`standard_shader.wgsl` is WSG's unified (Phong) shader. It exposes the two bind groups shared
|
||||
by every material (Step 3: a single layout for all).
|
||||
|
||||
### Vertex Input Layout (56-byte stride — correspond au `resources::Vertex`)
|
||||
|
||||
@@ -32,22 +32,21 @@ par tout matériau (Étape 3 : un seul layout pour tous).
|
||||
|
||||
### Uniforms (bind groups)
|
||||
|
||||
| Group / Binding | Struct | Contenu |
|
||||
| Group / Binding | Struct | Content |
|
||||
|-----------------|--------|---------|
|
||||
| `@group(0) @binding(0)` | `FrameUniforms` (704 B) | `view`, `proj`, `cam_pos`, `ambient`, `lights[8]`, `num_directional`, `num_point`, `num_spot`, `options` (.x = unlit flag) |
|
||||
| `@group(1) @binding(0)` | `ObjectUniform` (64 B) | `model` (matrice modèle de l'entité) |
|
||||
| `@group(1) @binding(0)` | `ObjectUniform` (64 B) | `model` (the entity's model matrix) |
|
||||
|
||||
`FrameUniforms` porte une **liste de lumières globales** (Étapes 12–13, Phase 4.2) : `lights[0..num_directional]`
|
||||
sont des lumières **directionnelles** (`position_dir.xyz` = direction de la surface vers la lumière),
|
||||
`lights[num_directional..num_directional + num_point]` des lumières **ponctuelles**
|
||||
(`position_dir.xyz` = position monde, `radius.x` = rayon d'atténuation linéaire), et
|
||||
`lights[num_directional + num_point..]` des lumières **spot** (`position_dir.xyz` = position monde,
|
||||
`dir_angle.xyz` = axe du cône de la lumière vers la scène, `dir_angle.w` = cos du demi-angle).
|
||||
L'index disambiguise le type — pas de drapeau. `ambient` est la couleur du terme ambiant hémisphérique.
|
||||
`FrameUniforms` carries a **global light list** (Steps 12–13, Phase 4.2): `lights[0..num_directional]`
|
||||
are **directional** lights (`position_dir.xyz` = direction from the surface toward the light),
|
||||
`lights[num_directional..num_directional + num_point]` are **point** lights
|
||||
(`position_dir.xyz` = world position, `radius.x` = linear attenuation radius), and
|
||||
`lights[num_directional + num_point..]` are **spot** lights (`position_dir.xyz` = world position,
|
||||
`dir_angle.xyz` = light cone axis toward the scene, `dir_angle.w` = cos of the half-angle).
|
||||
The index disambiguates the type — no flag. `ambient` is the color of the hemispherical ambient term.
|
||||
|
||||
### Mode unlit
|
||||
### Unlit mode
|
||||
|
||||
Un flag `options.x != 0` neutralise **toutes les lumières** et renvoie la couleur du vertex telle quelle
|
||||
(couleur plate). Côté API, `Renderer::set_unlit(true)` (ou `app.renderer_mut().set_unlit(true)`)
|
||||
positionne ce flag dans les frame uniforms. Ainsi le rendu 2D plat est un **cas particulier** de la 3D
|
||||
éclairée.
|
||||
The `options.x != 0` flag disables **all lights** and returns the vertex color as-is
|
||||
(flat color). On the API side, `Renderer::set_unlit(true)` (or `app.renderer_mut().set_unlit(true)`)
|
||||
sets this flag in the frame uniforms. Flat 2D rendering is thus a **special case** of lit 3D.
|
||||
|
||||
Reference in New Issue
Block a user