Ticket 013 V2 — orthographic projection for the 6 signed axes. `face_axis` encoding: 0 → +X, 1 → -X, 2 → +Y, 3 → -Y, 4 → +Z, 5 → -Z. For each face we pick the two orthogonal AABB axes and map them to clip-space [-1, +1]. The ±pair for each axis differ only in the sign of the "u" clip axis so that when the HW shader picks axis N at hit and projects the hit into card UV, the UV lines up with the mes
(face_axis: u32, bmin: [f32; 3], bmax: [f32; 3])
| 370 | /// axis N at hit and projects the hit into card UV, the UV lines up |
| 371 | /// with the mesh geometry as seen FROM that face. |
| 372 | fn build_card_ortho_v2(face_axis: u32, bmin: [f32; 3], bmax: [f32; 3]) -> [[f32; 4]; 4] { |
| 373 | let wx = (bmax[0] - bmin[0]).max(1e-4); |
| 374 | let wy = (bmax[1] - bmin[1]).max(1e-4); |
| 375 | let wz = (bmax[2] - bmin[2]).max(1e-4); |
| 376 | let cx = bmin[0] + bmax[0]; |
| 377 | let cy = bmin[1] + bmax[1]; |
| 378 | let cz = bmin[2] + bmax[2]; |
| 379 | match face_axis { |
| 380 | // +X → project onto YZ; clip.x = y, clip.y = z. |
| 381 | 0 => [ |
| 382 | [0.0, 0.0, 0.0, 0.0], |
| 383 | [2.0/wy, 0.0, 0.0, 0.0], |
| 384 | [0.0, 2.0/wz, 0.0, 0.0], |
| 385 | [-cy/wy, -cz/wz, 0.0, 1.0], |
| 386 | ], |
| 387 | // -X → flip u so the -X view is the mirror of +X. clip.x = -y, clip.y = z. |
| 388 | 1 => [ |
| 389 | [0.0, 0.0, 0.0, 0.0], |
| 390 | [-2.0/wy, 0.0, 0.0, 0.0], |
| 391 | [0.0, 2.0/wz, 0.0, 0.0], |
| 392 | [cy/wy, -cz/wz, 0.0, 1.0], |
| 393 | ], |
| 394 | // +Y → project onto XZ; clip.x = x, clip.y = z. |
| 395 | 2 => [ |
| 396 | [2.0/wx, 0.0, 0.0, 0.0], |
| 397 | [0.0, 0.0, 0.0, 0.0], |
| 398 | [0.0, 2.0/wz, 0.0, 0.0], |
| 399 | [-cx/wx, -cz/wz, 0.0, 1.0], |
| 400 | ], |
| 401 | // -Y → flip u; clip.x = -x, clip.y = z. |
| 402 | 3 => [ |
| 403 | [-2.0/wx, 0.0, 0.0, 0.0], |
| 404 | [0.0, 0.0, 0.0, 0.0], |
| 405 | [0.0, 2.0/wz, 0.0, 0.0], |
| 406 | [cx/wx, -cz/wz, 0.0, 1.0], |
| 407 | ], |
| 408 | // +Z → project onto XY; clip.x = x, clip.y = y. |
| 409 | 4 => [ |
| 410 | [2.0/wx, 0.0, 0.0, 0.0], |
| 411 | [0.0, 2.0/wy, 0.0, 0.0], |
| 412 | [0.0, 0.0, 0.0, 0.0], |
| 413 | [-cx/wx, -cy/wy, 0.0, 1.0], |
| 414 | ], |
| 415 | // -Z → flip u; clip.x = -x, clip.y = y. |
| 416 | _ => [ |
| 417 | [-2.0/wx, 0.0, 0.0, 0.0], |
| 418 | [0.0, 2.0/wy, 0.0, 0.0], |
| 419 | [0.0, 0.0, 0.0, 0.0], |
| 420 | [cx/wx, -cy/wy, 0.0, 1.0], |
| 421 | ], |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | /// Ticket 014 — per-mesh SDF bake uniform. |
| 426 | #[repr(C)] |
no outgoing calls
no test coverage detected