MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / look_at_rh

Function look_at_rh

tools/imposter-baker/src/render.rs:454–464  ·  view source on GitHub ↗
(eye: [f32; 3], target: [f32; 3], up: [f32; 3])

Source from the content-addressed store, hash-verified

452fn dot3(a: [f32; 3], b: [f32; 3]) -> f32 { a[0]*b[0] + a[1]*b[1] + a[2]*b[2] }
453
454fn 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
466fn ortho_rh(l: f32, r: f32, b: f32, t: f32, n: f32, f: f32) -> [[f32; 4]; 4] {
467 // wgpu clip-space Z = [0, 1].

Callers 1

bake_asyncFunction · 0.85

Calls 3

normalize3Function · 0.70
crossFunction · 0.70
dot3Function · 0.70

Tested by

no test coverage detected