flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
9.29k stars 914 forks source link

feat: Add normals to surfaces when not specified #3257

Closed luanpotter closed 3 months ago

luanpotter commented 3 months ago

Description

Add normals to surfaces when not specified.

Not all meshes come with normals. For example, the provided SphereMesh has no normals. Similarly, some GLTF files come without normals. Note that this still allows the user to specify their own normals. For example, the CuboidMesh uses face normals by default. However, if the user sets useFaceNormals to false, the vertex normals are computed instead.

All objects need normals for lighting purposes. The choice of using face or vertex normal is up to the user, as that will have different consequences.

Checklist

Breaking Change?