feat(core): Étape 11 — resize (surface + depth, Phase 4.4)

This commit is contained in:
Jérôme Bousquié
2026-09-18 17:29:45 +02:00
parent f4df63a136
commit b0aafefed9
4 changed files with 73 additions and 6 deletions
+17
View File
@@ -167,6 +167,23 @@ impl Renderer {
self.write_default_frame_uniforms();
}
/// Recreates the depth texture at a new size, used on window resize (ROADMAP Phase 4.4).
/// The previous depth texture is dropped when its field is replaced — no leak, no double
/// allocation. The helper `create_depth_texture` (Étape 9, D3) is reused so the recreate stays
/// trivial. Inputs: width/height — the new surface dimensions in pixels.
pub fn resize_depth(&mut self, width: u32, height: u32) {
let (depth_texture, depth_view) = create_depth_texture(&self.device, width, height);
self._depth_texture = depth_texture;
self.depth_view = depth_view;
}
/// Updates the stored surface texture format after a surface reconfigure (ROADMAP Phase 4.4).
/// Used when `Context::configure` returns a different format so the Renderer stays in sync
/// with the surface. Inputs: format — the new surface texture format.
pub fn set_format(&mut self, format: wgpu::TextureFormat) {
self.format = format;
}
/// Rewrites the shared per-frame uniform buffer from the scene's active camera and the current
/// viewport aspect, then returns the frame bind group wired to that buffer. Called at the start of
/// every `render_scene` so the GPU sees the latest camera matrices and camera position (Étape 4.3).