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

Function ortho_rh

tools/imposter-baker/src/render.rs:466–477  ·  view source on GitHub ↗
(l: f32, r: f32, b: f32, t: f32, n: f32, f: f32)

Source from the content-addressed store, hash-verified

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].
468 let rcp_w = 1.0 / (r - l);
469 let rcp_h = 1.0 / (t - b);
470 let rcp_d = 1.0 / (f - n);
471 [
472 [2.0 * rcp_w, 0.0, 0.0, 0.0],
473 [0.0, 2.0 * rcp_h, 0.0, 0.0],
474 [0.0, 0.0, -rcp_d, 0.0],
475 [-(r + l) * rcp_w, -(t + b) * rcp_h, -n * rcp_d, 1.0],
476 ]
477}
478
479fn mat_mul(a: [[f32; 4]; 4], b: [[f32; 4]; 4]) -> [[f32; 4]; 4] {
480 // Column-major: result[col][row] = sum_k a[k][row] * b[col][k]

Callers 1

bake_asyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected