-
Notifications
You must be signed in to change notification settings - Fork 63
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
Is there still exist GltfDataReader in the new JglTF version? #26
Comments
During the transition from glTF 1.0 to glTF 2.0, there has been a considerable refactoring. The goal was to be able to support both versions, as far as reasonably possible. Therefore, an abstraction layer has been introduced to better handle the different representations of glTF 1.0 and 2.0 assets. The class that most closely resembles the original So in order to read a glTF file and write it as a GLB file, the following code can be used:
|
Dear @javagl , Here is my convert result. I would be greatly appreciated if you could spend some of your time check the problems for me. Best regards |
Throwing the original glTF it into the glTF-Validator at http://github.khronos.org/glTF-Validator/ reveals many errors, but they seem to fall into two categories:
and
The first one should be covered by KhronosGroup/COLLADA2GLTF#174 The second one might be a bit more tricky. Depending on which version of COLLADA2GLTF you used, we might consider filing another bug report here. -- In any case: I see that, for example, the glTF Viewer can render the original glTF nevertheless. But for the GLB, there seems to be another error, related to the GLB chunks. This is obviously an error in |
I just tried to reproduce the error, but the resulting binary glTF asset seems to be valid. Did you run it through a program like the A quick look at the file contents showed that the JSON part of the binary glTF that you provided still contained the embedded data. Do you perform any additional operations on the |
Did it also not work for you with the code at #26 (comment) ? I tried the approach that you posted (BTW: http://idownvotedbecau.se/imageofcode ), and there indeed is some problem with the chunk size. I'll try to figure out what is wrong there and provide an update ASAP. |
Thanks! |
It's somehow important to know: Did it work when you used the (If it worked, the issue that appeared with the |
Yes, they can convert glTF to glb, but can't display in the glTF Viewer. |
Using the model that you provided, it worked for me in the https://gltf-viewer.donmccurdy.com/ , at least.
In any case, I'll try to investigate this further, and also try to fix the |
The main point here is some sort of ambiguity in what exactly constitutes a "binary", "embedded" or "default" glTF model. The model in question contains images as embedded resources (i.e. using data URIs). When this is written as a binary glTF, then it is not clear how to decide whether these embedded resources should become part of the binary buffer, or whether they should remain embedded in the glTF asset. For now, the functionality of writing different model types is offered via the
the resulting files will be "pure", meaning that they will either use external files for all resources, data URIs for all resources, or a binary blob for all resources. Compared to the Nevertheless, the handling of "mixed type assets" contained some ambiguities that should largely be resolved via 3eff092 I'll close this one, and opened a dedicated issue to track how the manual conversions should be handled at #31 |
Hi,
Is there still exist GltfDataReader in the new JglTF package? @javagl
With the jgltf-model-0.0.0-SNAPSHOT.jar package I can use the code below to get and convert glTF1.0 file to glb.
Recently, I want to use GltfDataReader to get glTF2.0 file and convert it to glb. But in the new new JglTF package, I can't find GltfDataReader, gltfData, GltfDataToBinaryConverter() and BinaryGltfDataWriter.
Sincerely,
Frank-Chan
The text was updated successfully, but these errors were encountered: