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

Are there any examples? #108

Open
ghost opened this issue Feb 26, 2020 · 4 comments
Open

Are there any examples? #108

ghost opened this issue Feb 26, 2020 · 4 comments
Assignees

Comments

@ghost
Copy link

ghost commented Feb 26, 2020

Are there any examples for using cgltf? Sadly I couldn't find any in the repo, and the structs alone aren't very useful as documentation for anyone who hasn't deeply studied the gltf specs. (which is what I was hoping to avoid in the first place by using a library)

The following use cases would be interesting to see as examples:

  • load up a model and push all triangles and their vertices positions of the default pose/ignoring animation as a listing to stdout/a terminal

  • load up a model and enumerate all animation names, material names, and texture names and print that out on the terminal

  • load up a model with animation data and everything, but all from memory (all files are provided as buffer pointer + buffer length size_t) instead of from disk

  • print out the skeleton rig of a model listing all bones and what vertices they influence with what weight

  • load up a specific animation frame and calculate all bone positions (if cgltf can do that mathematical part, can it?) and print out the transform matrix for each bone on the terminal

None of these tasks seem obvious to me right now. I see lots of buffers and accessors and what not, but how do they go together? I can't easily tell, an in-depth example would really be eye opening.

@ghost
Copy link
Author

ghost commented Feb 26, 2020

Oh right, I forgot gltf can store scenes. I suggest all the examples should just do this with the first model found in the scene. Should be enough to illustrate how it works, hopefully

@romainguy
Copy link
Contributor

Even with this library I highly recommend you read the specs in their entirety. There are a lot of finer points in how to properly handle glTF files that cannot be addressed by cgltf. Examples would be valuable though :)

@ghost
Copy link
Author

ghost commented Feb 26, 2020

@romainguy making that call would be a lot easier with examples. right now the library feels like it is written for people who studied the glTF specs for days or weeks, already started implementing it, and then stopped short of completion out of laziness. I think with a bit of documentation it could also be useful to people who just want to load up a model and add more details at some later time, right now that seems kind of impossible with how glTF specs reliant it is. so that is why I am suggesting all these examples

@jkuhlmann jkuhlmann self-assigned this Feb 27, 2020
@stefanasandei
Copy link

Hello, I'm trying to use this library for my project but I can't find any sample. How can I learn to use cgltf?

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