Commit Graph

42 Commits

Author SHA1 Message Date
Jérôme Bousquié 43e8bfb40a Update DRAFT.md 2026-09-16 19:19:56 +02:00
Jérôme Bousquié f10e249898 feat(renderer): active camera wired to frame uniforms (Étape 4.3)
- Camera enrichie: fov/near/far stockés, Default (pos (0,0,3), 45°, near 0.1,
  far 100), with_perspective(), projection_matrix(aspect) depuis les params
  stockés (au lieu de les passer en argument).
- Scene porte une caméra active: set_camera()/camera() (défaut Camera::default).
- Renderer::render_scene(view, scene, aspect) écrit chaque frame view/proj/
  cam_pos réels dans le buffer frame (write_frame_uniforms) avant de dessiner;
  le Renderer garde le handle du frame_buffer. Le chemin bas-niveau render()
  conserve les valeurs par défaut (identité).
- App::render_scene calcule l'aspect depuis window.inner_size() (le Renderer
  reste indépendant de la fenêtre).

Docs synchronisées: DRAFT (4.3 coche), README (statut 3D-infra + quick ref),
PLAN (caméras), ROADMAP (1.1/1.3/1.5/2.3).

Validation: check workspace+examples 0 warning, test (Pod + wgsl) OK, doc 0
warning, fmt propre. Le rendu 3D visible attend Étape 5 (brancher standard).
2026-09-16 17:25:50 +02:00
Jérôme Bousquié c1e07b42b4 feat(renderer): uniform bind groups infrastructure (Étape 3 + 4.1/4.2/4.4)
Étape 3 (infrastructure uniforms) + le câblage minimal d'Étape 4 pour garder
les exemples exécutables (wgpu requiert que tous les bind groups du layout
pipeline soient posés au draw) :

- resources/uniform.rs : types bytemuck Pod FrameUniforms (192 B) et
  ObjectUniform (64 B), alignés 16 octets sans padding; offsets vérifiés par un
  test unitaire contre le contrat du shader. glam feature bytemuck activé.
- pipeline_cache: create_uniform_bind_group_layouts() expose les 2 layouts
  (frame @0 Vertex|Fragment + object @1 Vertex); build_pipeline les attache à
  TOUT pipeline (un seul layout pour tous, décision actée).
- Renderer: alloue le buffer frame partagé + BindGroup(0) (défaut identité,
  mode lit) et un object identité partagé pour le chemin bas-niveau; cache
  RefCell<HashMap<label,(buffer,bindgroup)>> par entité, model réécrit chaque
  frame depuis transform.to_matrix(); draw_entity pose groupes 0+1.

4.3 (caméra active + aspect) non implémenté: simple/manual restent exécutables
car basic ignore ces uniforms. Documentation DRAFT mise à jour.

Validation: check workspace+examples 0 warning, doc 0 warning, test (Pod+wgsl)
OK, fmt propre.
2026-09-16 16:56:05 +02:00
Jérôme Bousquié 26a3cda6f6 feat(shaders): add standard Phong shader with uniform contract (data only)
Étape 2 du plan 3D+Phong : nouveau shader unifié, non encore branché à un
pipeline (Étape 3 : infra uniforms).

- shaders/standard_shader.wgsl : contrat vertex complet (position/normal/uv/color,
  56 octets, corrige la défaut latente du basic) ; 2 bind groups formative frame
  (view/proj/cam_pos/light_dir/light_color/options) + object (model) ; éclairage
  hemisphérique ambient + diffuse directionnel; mode unlit (options.x) pour que la
  2D plate soit un cas partticulier de la 3D.
- utils/conf.rs : constantes STANDARD_SHADER_PATH + STANDARD_SHADER (include_str!).
- tests/wgsl_validate.rs : validation hors-ligne naga (via wgpu::naga, aucune
  nouvelle dépendance) tant que le shader n'est pas compilé par un pipeline.
- shaders/README.md : documente le contrat standard et le statut du basic.
- Erreur WGSL corrigée en validation: cast mat4x4->mat3x3 non supporte, remplacé
  par construction explicite de la sous-matrice 3x3.
- Validation: cargo test (naga OK), check workspace+examples 0 warning, doc OK, fmt OK.
2026-09-16 15:55:26 +02:00
Jérôme Bousquié 252db88980 feat(lib): expose Camera and Entity with Transform (data foundation)
Étape 1 du plan 3D+Phong : fondations de données sans toucher au rendu.

- resources: exporte Camera (fichier auparavant orphelin), migre les fonctions
  glam dépréciées look_at_rh/perspective_rh_gl vers glam::camera::rh::* (induit
  par la compilation de camera.rs, sinon 2 warnings).
- scene: nouveau type Entity { mesh_id, material_id, transform } (scene/entity.rs);
  Scene::entities passe de HashMap<String,(String,String)> à HashMap<String,Entity>.
- API: add_entity conserve sa signature (transform identité par défaut), ajout de
  add_entity_with_transform, entity_transform, set_entity_transform; iter_entities
  rend désormais aussi le &Transform. renderer et examples inchangés a posteriori.
- Validation: cargo check --workspace et examples 0 warning, cargo doc 0 warning, fmt OK.
2026-09-16 15:26:16 +02:00
Jérôme Bousquié 91007853d9 docs: note pour mémoire sur le couplage au runtime async (pollster)
La lib n'a qu'un seul point de couplage au runtime (block_on dans app.rs) ; on ne crée volontairement
pas d'abstraction à ce stade. Consigné dans PLAN.md et ARCHI_APP.md : isoler derrière un module-pivot
unique si la lib acquiert d'autres appels async. Corrige aussi l'item check-list pollster devenu faux
dev-dependencies -> dependencies depuis la migration winit 0.30.
2026-09-16 14:58:51 +02:00
Jérôme Bousquié bb7fab4911 docs(plan): lock uniform scheme (2 bind groups) and uniform types location (resources/uniform.rs) 2026-09-16 13:40:30 +02:00
Jérôme Bousquié 14e18cda06 docs(plan): unify on a single pipeline layout (2D as degenerate 3D) 2026-09-16 12:06:56 +02:00
Jérôme Bousquié f81144918a docs: detailed plan for 3D+Phong step in DRAFT.md 2026-09-16 11:46:33 +02:00
Jérôme Bousquié 9d631b686a docs: clarify PipelineCache item in plan after scene auto-render 2026-09-16 11:18:08 +02:00
Jérôme Bousquié 0a7ebf62ad docs: erase DRAFT scratchpad content for next step 2026-09-16 11:16:48 +02:00
Jérôme Bousquié 0560c1897f docs: record completed scene auto-render step in plan, roadmap, README 2026-09-16 11:16:48 +02:00
Jérôme Bousquié 628c125925 docs: move DRAFT.md into docs/ and confirm step decisions
DRAFT.md now lives in docs/. Confirmed the pending design decisions:
render() auto-renders the scene by default (Option A, alternative B removed),
and simple.rs uses app.renderer.device()/format() via the library API
without importing wgpu.
2026-09-16 10:23:42 +02:00
Jérôme Bousquié e6f190e035 docs: add API documentation guidelines (rustdoc) in docs/DOCUMENTATION.md
Codifies the systematic documentation of public items with the API docs
in mind, based on the incidents from the last session: backticks around
every type (Option<Self>, Arc<Mesh>, [f32; 3]) to avoid unresolved-link
and unclosed-HTML-tag warnings, one doc comment per public item, the
#![warn(missing_docs)] policy, verifying '0 warnings' via cargo doc
before committing, and doc-test conventions (rust vs ignore blocks).

Applies to wsg-lib development from now on.
2026-09-16 09:45:33 +02:00
Jérôme Bousquié a7b50d9a39 docs(roadmap): record frozen FIFO present-mode decision
Note in the ROADMAP decision table that the swapchain stays on
PresentMode::Fifo (double-buffered vsync, latency 2) for now. Mailbox
(triple buffering) remains a future opt-in and Immediate stays reserved
for offscreen; present mode is revisited only when the GPU-driven
pipeline (Phase 3) lands. Not blocking for Phases 1-2.
2026-09-14 16:53:13 +02:00
Jérôme Bousquié b72c4e43ae docs: align tech/ docs with current vs target state
Clarify for each docs/tech document whether it describes the current
(implemented) or target (planned) architecture, and reconcile with the
readme/roadmap source of truth:

- ARCHI_APP, ARCHI_CPU_GPU, ARCHI_RENDU: mark status=target and add a
  banner stating the GPU-driven two-pass pipeline, persistent VRAM buffers
  and scene auto-render are not implemented (they are ROADMAP Phase 3 /
  README roadmap items 1-3). render() still cannot draw the scene.
- ARCHI_ARENES: status=target/deferred. String IDs are the current design;
  slotmap generational handles are the deferred 'typed handles' step and
  the slotmap dependency is currently absent (supersedes the retired dep).
- FRAME_LOOP: stays status=current; correct the described API flow (Frame
  based via get_next_frame/Renderer::present, plus the low-level
  begin_frame/end_frame variant) and move the single-buffer VRAM note to
  target.
- README: label each tech doc as current or target in the Documentation
  section.
2026-09-14 16:11:42 +02:00
Jérôme Bousquié 7cabda710d examples: fix simple.rs to compile as the 15-line declarative model
- Replace the broken App::new() (which does not exist) with AppBuilder.
- Strip it down to the PLAN's ~15-line target: no explicit winit/wgpu,
  AppHandler render() left empty (scene rendering still on the roadmap).
- Verified: builds, opens a black window and runs the update->render->present
  loop until closed.
- Update README/PLAN wording now that the simple example compiles (it still
  does not draw a scene).
2026-09-14 15:42:30 +02:00
Jérôme Bousquié f6c0851d4f docs: reconcile README/ROADMAP/PLAN state and settle slotmap vs String IDs
- README stays the source of truth for current state; drive/item-5 now
  reflects the settled decision: String IDs for the MVP, slotmap deferred.
- ROADMAP gains a 'point de depart' (present-state) block, marks glam done,
  removes the slotmap Phase-1 mandates, and documents the String-ID decision
  plus the deferred 'typed handles' step.
- PLAN corrects stale [X] checkmarks (App render() cannot draw, Scene
  rendering not automated, simple example does not compile) and notes its
  verification checklist against current reality.
- Remove the unused slotmap direct dependency from wsg-lib (package remains
  in Cargo.lock only as a transitive dep of glow).
2026-09-14 15:28:41 +02:00
Jérôme Bousquié cfb4c6f212 suppression contradictions 2026-08-07 21:44:29 +02:00
Jérôme Bousquié e8e9124a9d doc : single buffer 2026-08-03 21:52:36 +02:00
Jérôme Bousquié 895965750f préparation phase 1.1 2026-08-01 21:25:43 +02:00
Jérôme Bousquié 37432536dc refactor spec OKF 2026-08-01 09:34:12 +02:00
Jérôme Bousquié 81b825970a correction contradictions 2026-07-31 20:43:57 +02:00
Jérôme Bousquié 8d61e4231e spec OKF pour doc 2026-07-31 19:10:04 +02:00
Jérôme Bousquié 2cc79be2ec spec OKF pour doc 2026-07-31 19:09:46 +02:00
Jérôme Bousquié c5f8edc4f4 roadmap 2026-07-30 17:54:06 +02:00
Jérôme Bousquié 2887cba121 typo 2026-07-29 21:04:48 +02:00
Jérôme Bousquié b1966cb341 doc arene pour slotmap 2026-07-29 21:00:18 +02:00
Jérôme Bousquié 2710899292 ajout docs ARENE et GPU_CPU 2026-07-28 21:25:14 +02:00
Jérôme Bousquié d782469202 architecture rendu update/render 2026-07-08 16:26:23 +02:00
Jérôme Bousquié 3414d68819 Plan 2026-07-08 15:58:20 +02:00
Jérôme Bousquié 7b25564483 doc 2026-07-08 15:46:50 +02:00
Jérôme Bousquié 82ea16d118 re-org en App 2026-07-07 16:42:37 +02:00
Jérôme Bousquié cfd8b421a2 plan passage à App 2026-07-07 11:57:57 +02:00
Jérôme Bousquié 2731700098 cr 2026-07-06 17:43:43 +02:00
Jérôme Bousquié 8192d4799a schema 2026-07-06 17:40:21 +02:00
Jérôme Bousquié 8e57dc783b refactor renderer responsable + docs + schema 2026-07-06 17:37:13 +02:00
Jérôme Bousquié 6c94fc96d6 ajout material et pipeline_cache 2026-07-06 10:40:00 +02:00
Jérôme Bousquié 22edac6ad5 ajout mesh.rs 2026-07-05 15:51:37 +02:00
Jérôme Bousquié 4b7a1b05e5 begin et end frame dans context 2026-07-04 14:57:29 +02:00
Jérôme Bousquié 4fd39d32c6 configure context 2026-07-03 21:11:43 +02:00
jerome f66519eeab init wgpu + doc + err robustes 2026-07-03 12:33:32 +02:00