b3d -> glTF: Fix buffer padding

This commit is contained in:
Lars Mueller 2023-02-28 00:22:45 +01:00
parent e91a406742
commit c8738450c7

@ -617,6 +617,10 @@ do
func -- `function(write_byte) ... return count, min, max end` to be called to write to the buffer view; func -- `function(write_byte) ... return count, min, max end` to be called to write to the buffer view;
-- the count of elements written must be returned; min and max may be returned -- the count of elements written must be returned; min and max may be returned
) )
-- Always add padding to obtain a multiple of 4
-- TODO (?) don't add padding if it isn't required
table.insert(buffer_rope, ("\0"):rep(offset % 4))
offset = math.ceil(offset / 4) * 4
local bytes_written = 0 local bytes_written = 0
local count, min, max = func(function(byte) local count, min, max = func(function(byte)
table.insert(buffer_rope, string_char(byte)) table.insert(buffer_rope, string_char(byte))