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

Function extract_frustum_planes

native/shared/src/scene.rs:1016–1030  ·  view source on GitHub ↗
(vp: &[[f32; 4]; 4])

Source from the content-addressed store, hash-verified

1014// — we only care about the sign.
1015
1016pub(crate) fn extract_frustum_planes(vp: &[[f32; 4]; 4]) -> [[f32; 4]; 6] {
1017 // Row vectors of the column-major matrix: row_i[col] = vp[col][i].
1018 let row = |i: usize| [vp[0][i], vp[1][i], vp[2][i], vp[3][i]];
1019 let r0 = row(0); let r1 = row(1); let r2 = row(2); let r3 = row(3);
1020 let add = |a: [f32;4], b: [f32;4]| [a[0]+b[0], a[1]+b[1], a[2]+b[2], a[3]+b[3]];
1021 let sub = |a: [f32;4], b: [f32;4]| [a[0]-b[0], a[1]-b[1], a[2]-b[2], a[3]-b[3]];
1022 [
1023 add(r3, r0), // left
1024 sub(r3, r0), // right
1025 add(r3, r1), // bottom
1026 sub(r3, r1), // top
1027 r2, // near (wgpu uses 0..1 depth → near = row_2)
1028 sub(r3, r2), // far
1029 ]
1030}
1031
1032pub(crate) fn aabb_outside_frustum(planes: &[[f32; 4]; 6], bmin: [f32; 3], bmax: [f32; 3]) -> bool {
1033 for p in planes.iter() {

Callers 2

prepareMethod · 0.85
end_frame_with_sceneMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected