docs: Étape 14 (shadows) finale — bilan DRAFT, ROADMAP §4.2, README roadmap

- docs/DRAFT.md: document vidé (bilan Étape 14 archivé dans l'historique git)
- docs/ROADMAP.md §4.2: Shadows marqué [x] (Étape 14, mono-lumière PCF)
- README.md: item 12 de la roadmap (shadow mapping)
- cargo fmt --all sur les sources Étape 14
This commit is contained in:
Jérôme Bousquié
2026-09-19 19:04:12 +02:00
parent 9a51ff7602
commit bfe68f4393
8 changed files with 65 additions and 240 deletions
+11 -14
View File
@@ -27,7 +27,7 @@ use crate::pipeline::{
};
use crate::resources::uniform::{FRAME_UNIFORMS_SIZE, OBJECT_UNIFORM_SIZE, SHADOW_UNIFORM_SIZE};
use crate::resources::{
Camera, FrameUniforms, Lights, Material, Mesh, ObjectUniform, ShadowUniform, MAX_LIGHTS,
Camera, FrameUniforms, Lights, MAX_LIGHTS, Material, Mesh, ObjectUniform, ShadowUniform,
};
use crate::scene::Scene;
use crate::utils::conf::{
@@ -350,11 +350,9 @@ impl Renderer {
-light.position_dir.y,
-light.position_dir.z,
),
crate::resources::LightType::Spot { .. } => Vec3::new(
light.dir_angle.x,
light.dir_angle.y,
light.dir_angle.z,
),
crate::resources::LightType::Spot { .. } => {
Vec3::new(light.dir_angle.x, light.dir_angle.y, light.dir_angle.z)
}
crate::resources::LightType::Point => return None,
};
let r = SHADOW_SCENE_RADIUS;
@@ -371,8 +369,7 @@ impl Renderer {
// scene-radius behind the target, so the box [−r, r] around the target spans a depth range
// of [0, 2r] from the eye: `far = 2·r` covers the whole box (and the shadows cast behind
// it), whereas `far = r` would clip the far half.
let proj =
glam::camera::rh::proj::directx::orthographic(-r, r, -r, r, 0.0, 2.0 * r);
let proj = glam::camera::rh::proj::directx::orthographic(-r, r, -r, r, 0.0, 2.0 * r);
Some((index, proj * view))
}
@@ -525,8 +522,11 @@ impl Renderer {
None => return,
};
let shadow_uniform = ShadowUniform { view_proj: vp };
self.queue
.write_buffer(&self.shadow_uniform_buffer, 0, bytemuck::bytes_of(&shadow_uniform));
self.queue.write_buffer(
&self.shadow_uniform_buffer,
0,
bytemuck::bytes_of(&shadow_uniform),
);
let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("shadow map render pass"),
@@ -654,10 +654,7 @@ fn create_depth_texture(
/// comparison sampler). Allocated once at the default resolution; resizing is deferred (D8).
/// Inputs: device (GPU resource creator), size (shadow map edge length in pixels).
/// Returns the (texture, view) pair; the caller keeps both alive.
fn create_shadow_map(
device: &wgpu::Device,
size: u32,
) -> (wgpu::Texture, wgpu::TextureView) {
fn create_shadow_map(device: &wgpu::Device, size: u32) -> (wgpu::Texture, wgpu::TextureView) {
let shadow_texture = device.create_texture(&wgpu::TextureDescriptor {
label: Some("shadow map"),
size: wgpu::Extent3d {