Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to save Meshoptimizer compressed models as uncompressed glb models #785

Open
xinghaoyujianni opened this issue Jan 4, 2024 · 2 comments

Comments

@xinghaoyujianni
Copy link

I have the following code and the saved decompress.glb is not getting loaded!

GltfReader reader;
GltfReaderResult result = reader.readGltf(readFile("C:\Users\EXT_meshopt_compression.glb"));
Model& model = result.model.value();

CesiumGltfWriter::GltfWriter writer;
CesiumGltfWriter::GltfWriterOptions options;
options.binaryChunkByteAlignment = 4;

const std::vectorstd::byte readModelBuffer = model.buffers[0].cesium.data;
CesiumGltfWriter::GltfWriterResult writeResult =
writer.writeGlb(model, gsl::span(readModelBuffer), options);
const std::vectorstd::byte& glbBytesDefaultPadding = writeResult.gltfBytes;

std::ofstream ofs("C:\Users\decompress.glb", std::ios::binary | std::ios::trunc | std::ios::out);
ofs.write(
(const char*)glbBytesDefaultPadding.data(),
glbBytesDefaultPadding.size());
ofs.flush();
ofs.close();

@csciguy8
Copy link
Contributor

csciguy8 commented Jan 4, 2024

Can you do a little debugging on your end here? It's not clear the failures you are seeing or what line is failing?

It's ok if you discover a bug in the cesium-native code, and want to share an example problem that reproduces it.

But in this case, it's not clear whether the problem is in cesium-native, or your test setup.

@csciguy8 csciguy8 closed this as completed Jan 4, 2024
@csciguy8 csciguy8 reopened this Jan 4, 2024
@j9liu
Copy link
Contributor

j9liu commented Feb 21, 2024

Hey @xinghaoyujianni,

Are you still experiencing this issue? If so, can you provide more details? In particular, it's not clear what you mean by the "glb is not getting loaded".

Otherwise, if this is no longer relevant, or if we don't receive a response, I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants