mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 00:33:44 +01:00
b3d -> glTF: Gracefully normalize normals
This commit is contained in:
parent
c48e4bf340
commit
88fec749f5
4
b3d.lua
4
b3d.lua
@ -725,7 +725,9 @@ do
|
||||
if has_normals then
|
||||
attributes.NORMAL = add_accessor("VEC3", "float", false, function(write_byte)
|
||||
for _, vertex in ipairs(mesh.vertices) do
|
||||
write_translation(write_byte, vertex.normal)
|
||||
-- Some B3D models don't seem to have their normals normalized.
|
||||
-- TODO (?) raise a warning when handling this gracefully
|
||||
write_translation(write_byte, modlib.vector.normalize(vertex.normal))
|
||||
end
|
||||
return #mesh.vertices
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user