Function ssbh_data::mesh_data::transform_vectors [−][src]
pub fn transform_vectors(
data: &VectorData,
transform: &[[f32; 4]; 4]
) -> VectorData
Expand description
Transform the elements in data
with transform
.
Transform is assumed to be in row-major order.
The elements are treated as vectors in homogeneous coordinates by temporarily setting the 4th component to 0.0f32
.
The returned result has the same component count as data
.
For VectorData::Vector4, the 4th component is preserved for the returned result.
// A scaling matrix for x, y, and z. let transform = [ [1f32, 0f32, 0f32, 0f32], [0f32, 2f32, 0f32, 0f32], [0f32, 0f32, 3f32, 0f32], [0f32, 0f32, 0f32, 1f32], ]; let transformed_normals = transform_vectors(&mesh_object_data.normals[0].data, &transform);