Commit 4b18208
Fix loading non-TriangleList meshes without normals in gltf loader (bevyengine#4376)
# Objective
Make it so that loading in a mesh without normals that is not a `TriangleList` succeeds.
## Solution
Flat normals can only be calculated on a mesh made of triangles.
Check whether the mesh is a `TriangleList` before trying to compute missing normals.
## Additional changes
The panic condition in `duplicate_vertices` did not make sense to me. I moved it to `compute_flat_normals` where the algorithm would produce incorrect results if the mesh is not a `TriangleList`.
Co-authored-by: devil-ira <justthecooldude@gmail.com>1 parent 930be03 commit 4b18208
2 files changed
+11
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
272 | 274 | | |
273 | 275 | | |
274 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | 255 | | |
259 | 256 | | |
260 | 257 | | |
261 | 258 | | |
262 | 259 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 260 | | |
269 | 261 | | |
270 | 262 | | |
271 | 263 | | |
| 264 | + | |
272 | 265 | | |
273 | 266 | | |
274 | 267 | | |
| |||
307 | 300 | | |
308 | 301 | | |
309 | 302 | | |
310 | | - | |
| 303 | + | |
| 304 | + | |
311 | 305 | | |
312 | 306 | | |
313 | 307 | | |
314 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
| |||
0 commit comments