bevy/crates/bevy_render/src/mesh
Lynn 2857eb6b9d
Fix normals during mesh scaling (#13380)
# Objective

- Fixes scaling normals and tangents of meshes

## Solution

- When scaling a mesh by `Vec3::new(1., 1., -1.)`, the normals should be
flipped along the Z-axis. For example a normal of `Vec3::new(0., 0.,
1.)` should become `Vec3::new(0., 0., -1.)` after scaling. This is
achieved by multiplying the normal by the reciprocal of the scale,
cheking for infinity and normalizing. Before, the normal was multiplied
by a covector of the scale, which is incorrect for normals.
- Tangents need to be multiplied by the `scale`, not its reciprocal as
before

---------

Co-authored-by: vero <11307157+atlv24@users.noreply.github.com>
2024-05-21 18:28:03 +00:00
..
mesh Fix normals during mesh scaling (#13380) 2024-05-21 18:28:03 +00:00
primitives Common MeshBuilder trait (#13411) 2024-05-18 11:58:11 +00:00
mod.rs Enable clippy::ref_as_ptr (#12918) 2024-04-10 20:16:48 +00:00
morph.rs Reflect default in some types on bevy_render (#12580) 2024-03-19 22:50:17 +00:00