(eye: [f32; 3], target: [f32; 3], up: [f32; 3])
| 452 | fn dot3(a: [f32; 3], b: [f32; 3]) -> f32 { a[0]*b[0] + a[1]*b[1] + a[2]*b[2] } |
| 453 | |
| 454 | fn look_at_rh(eye: [f32; 3], target: [f32; 3], up: [f32; 3]) -> [[f32; 4]; 4] { |
| 455 | let f = normalize3([target[0] - eye[0], target[1] - eye[1], target[2] - eye[2]]); |
| 456 | let s = normalize3(cross(f, up)); |
| 457 | let u = cross(s, f); |
| 458 | [ |
| 459 | [ s[0], u[0], -f[0], 0.0], |
| 460 | [ s[1], u[1], -f[1], 0.0], |
| 461 | [ s[2], u[2], -f[2], 0.0], |
| 462 | [-dot3(s, eye), -dot3(u, eye), dot3(f, eye), 1.0], |
| 463 | ] |
| 464 | } |
| 465 | |
| 466 | fn ortho_rh(l: f32, r: f32, b: f32, t: f32, n: f32, f: f32) -> [[f32; 4]; 4] { |
| 467 | // wgpu clip-space Z = [0, 1]. |
no test coverage detected