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

Function mat3_transform_vec

native/shared/src/models.rs:574–580  ·  view source on GitHub ↗

Transform a direction vector by a 3x3 matrix (extracted from a 4x4 column-major stored as the top-left 3x3). Used for normals under the inverse-transpose matrix.

(m: &[[f32; 3]; 3], v: &[f32; 3])

Source from the content-addressed store, hash-verified

572/// column-major stored as the top-left 3x3). Used for normals under
573/// the inverse-transpose matrix.
574fn mat3_transform_vec(m: &[[f32; 3]; 3], v: &[f32; 3]) -> [f32; 3] {
575 [
576 m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2],
577 m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2],
578 m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2],
579 ]
580}
581
582/// Inverse-transpose of the 3x3 rotation+scale part of a 4x4 matrix.
583/// Correct way to transform normals when the matrix has non-uniform

Callers 1

load_gltf_with_texturesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected