Skip to content

Commit

Permalink
gltf fix buffer views padding for strides
Browse files Browse the repository at this point in the history
  • Loading branch information
PredatorCZ committed Jan 13, 2024
1 parent dfdf4ea commit 337dae1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gltf/gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void GLTF::FinishAndSave(BinWritterRef wr, const std::string & docPath)

for (auto & a : streams)
{
a.byteLength = a.wr.Tell();
a.wr.ApplyPadding();
retval += a.wr.Tell();
}
Expand All @@ -39,7 +40,6 @@ void GLTF::FinishAndSave(BinWritterRef wr, const std::string & docPath)
for (auto & a : streams)
{
a.buffer = 0;
a.byteLength = a.wr.Tell();
a.byteOffset = curOffset;
curOffset += a.byteLength;
bufferViews.at(a.index) = std::move(a);
Expand All @@ -55,8 +55,8 @@ void GLTF::FinishAndSave(BinWritterRef wr, const std::string & docPath)
for (auto & a : streams)
{
char buffer[0x80000];
const size_t numChunks = a.byteLength / sizeof(buffer);
const size_t restBytes = a.byteLength % sizeof(buffer);
const size_t numChunks = a.wr.Tell() / sizeof(buffer);
const size_t restBytes = a.wr.Tell() % sizeof(buffer);

for (size_t i = 0; i < numChunks; i++)
{
Expand Down

0 comments on commit 337dae1

Please sign in to comment.