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

Function mirrored_view

native/shared/src/renderer/planar_reflection.rs:158–161  ·  view source on GitHub ↗

Compose a mirrored view matrix from the camera's current view matrix and the reflection plane. In Bloom's column-major / post-mul convention, `view` transforms world points into camera space (`p_cam = view * p_world`). To render the mirror image we want `p_cam = view * R * p_world` — reflect first, then apply the existing view. The returned matrix is `view * R`. Caller MUST flip front-face cull

(view: [[f32; 4]; 4], plane_y: f32, normal: [f32; 3])

Source from the content-addressed store, hash-verified

156/// by binding pipelines compiled with `cull_mode = None` for the
157/// mirrored pass; we accept the small fragment-shader cost for V1.
158pub fn mirrored_view(view: [[f32; 4]; 4], plane_y: f32, normal: [f32; 3]) -> [[f32; 4]; 4] {
159 let r = reflection_matrix(plane_y, normal);
160 mat4_multiply(view, r)
161}
162
163/// Reflect the camera's world position across the plane. Used for
164/// `PerView.camera_pos` in the mirrored UBO so view-dependent shading

Callers 1

Calls 2

reflection_matrixFunction · 0.85
mat4_multiplyFunction · 0.85

Tested by

no test coverage detected