You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When exporting an asset as GLB, the first buffer is correctly flagged as embedded and no .bin is created, but the content of said buffer is never actually written to the GLB file.
This is caused by missing const qualifiers in the parameter of the visitor handlers:
for (std::size_t i = 0; i < buffer.byteLength % 4; ++i) {
staticconstexpr std::uint8_t zero = 0x0U;
write(&zero, sizeof zero);
}
std::visit(visitor {
[](auto arg) {},
[&](sources::Array& vector) {
write(vector.bytes.data(), buffer.byteLength);
},
[&](sources::Vector& vector) {
write(vector.bytes.data(), buffer.byteLength);
},
[&](sources::ByteView& byteView) {
write(byteView.bytes.data(), buffer.byteLength);
},
}, buffer.data);
}
Since buffer is const, buffer.data is also const, but none of the visitor handlers take a const value as parameter so they never get called.
All cases are currently routed to the default handler [](auto arg) {}.
The text was updated successfully, but these errors were encountered:
Cyphall
changed the title
Content of embedded buffer is not written to the GLB file when exporting
Content of the embedded buffer is not written to the GLB file when exporting
Mar 7, 2024
I didn't have any time yesterday to tend to your issues, but I quickly tried and tested this.
Since buffer is const, buffer.data is also const, but none of the visitor handlers take a const value as parameter so they never get called.
If I remember correctly specifying them as const didn't fix the issue. Or did that work locally for you? Also, I'll have to figure out some tests that verify that the buffer was correctly written, as that isn't covered right now.
When exporting an asset as GLB, the first buffer is correctly flagged as embedded and no .bin is created, but the content of said buffer is never actually written to the GLB file.
This is caused by missing
const
qualifiers in the parameter of the visitor handlers:fastgltf/src/fastgltf.cpp
Lines 5515 to 5539 in 753b161
Since
buffer
isconst
,buffer.data
is alsoconst
, but none of the visitor handlers take aconst
value as parameter so they never get called.All cases are currently routed to the default handler
[](auto arg) {}
.The text was updated successfully, but these errors were encountered: