mirror of
https://github.com/appgurueu/modlib.git
synced 2024-08-20 05:14:10 +02: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
|
if has_normals then
|
||||||
attributes.NORMAL = add_accessor("VEC3", "float", false, function(write_byte)
|
attributes.NORMAL = add_accessor("VEC3", "float", false, function(write_byte)
|
||||||
for _, vertex in ipairs(mesh.vertices) do
|
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
|
end
|
||||||
return #mesh.vertices
|
return #mesh.vertices
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user