{"id":16985411,"url":"https://github.com/kooparse/gltf_parser","last_synced_at":"2025-03-22T01:25:42.758Z","repository":{"id":172991161,"uuid":"619245567","full_name":"kooparse/gltf_parser","owner":"kooparse","description":"A glTF parser/loader in Jai.","archived":false,"fork":false,"pushed_at":"2024-08-18T08:51:12.000Z","size":1533,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T00:17:07.688Z","etag":null,"topics":["gltf","graphics","jai","loader","parser"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kooparse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-26T17:31:58.000Z","updated_at":"2025-03-05T13:09:15.000Z","dependencies_parsed_at":"2023-11-13T23:22:58.832Z","dependency_job_id":"6beb838d-f4f5-4e4b-9b63-b42884b0ee15","html_url":"https://github.com/kooparse/gltf_parser","commit_stats":null,"previous_names":["kooparse/gltf_parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kooparse%2Fgltf_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kooparse%2Fgltf_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kooparse%2Fgltf_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kooparse%2Fgltf_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kooparse","download_url":"https://codeload.github.com/kooparse/gltf_parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244891703,"owners_count":20527309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gltf","graphics","jai","loader","parser"],"created_at":"2024-10-14T02:43:24.388Z","updated_at":"2025-03-22T01:25:42.720Z","avatar_url":"https://github.com/kooparse.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# glTF parser for Jai codebase\n\nNote: **Jai beta 0.1.087 is required.**\n\nThis project is a glTF 2.0 parser written in Jai, aiming to replace the use of some C/C++ libraries. All glTF types are fully documented, so it comes nicely with IDE autocompletion, reducing\nback and forth with the [specification](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html).\n\nThis library intends to mimic the glTF file structure in memory. Thereby it's designed around arrays and indexes instead of pointers as you may see in `cgltf` or other libraries. Also, it's the **user's responsibility** to load glTF files and their related binaries in memory; nevertheless, this library also provides a way to load files and buffers into memory.\n\nNote: It's almost as complete as the glTF specification (see features), but because it's straightforward to add new parsed fields, we'll get new stuff incrementally and on-demand.\n\nIf you would like to contribute, don't hesitate! :)\n\n## Examples\n\nYou just need to import `module.jai` in your project, also this library has two dependencies: `jason` and `unicode_utils`; so those two modules needs to be found somewhere.\n\n```jai\n\n#import \"gltf_parser\";\n\nmain :: () {\n  gltf := gltf_parse_file(\"./path-to-gltf-or-glb-file\");\n  defer gltf_free(*gltf);\n\n  gltf_debug_print(gltf);\n\n  gltf_load_buffers(*gltf);\n\n  vertices: [..]float;\n  read_buffer_from_accessor(*data, data.accessors[0], *vertices);\n}\n\n```\n\nAll examples could be found in `example.jai`. Also, if you want to run the tests and examples, run `jai example.jai -import_dir ./modules`.\n\n## General Interfaces\n\n- `gltf_parse_string  :: (buffer: string) -\u003e GLTF_Data`\n- `gltf_parse_file    :: (gltf_filepath: string) -\u003e GLTF_Data`\n- `gltf_free          :: (gltf_data: *GLTF_Data)`\n\n### Helpers\n\nFor ease, I provide a procedure to load buffer in memory. Using it, you'll get\nthe underlying data in **GLTF_Buffer**:\n\n- `gltf_load_buffers  :: (gltf_data: *GLTF_Data)`\n\nIf you want to easily copy the underlying data from an accessor, this procedure\nwill get the job done. You just need to provide an array of your type from which\nthe data will be copied. Also, `gltf_load_buffers` must be call first.\nIf the type of your array doesn't match the type of the accessor's component,\na cast will be made (see `data_read_tests` example):\n\n- `read_buffer_from_accessor :: (gltf: *GLTF_Data, accessor: GLTF_Accessor, list: *[..] $T)`\n\nA tiny utility that gives you the **size, count and stride** of the underlying\naccessor's data:\n\n- `get_component_info :: (gltf_accessor: GLTF_Accessor) -\u003e GLTF_Component_Info`\n\nBeing able to easily print information could save you lot of debug times,\nthis procedure gives you general informations about it (animations names,\nnodes counts, etc...):\n\n- `gltf_debug_print :: (gltf_data: GLTF_Data)`\n\n## Features\n\n- [x] glTF 2.0 json file\n- [x] Scenes\n- [x] Nodes\n- [x] Buffers\n- [x] BufferViews\n- [x] Meshes\n- [x] Textures\n- [x] Images\n- [x] Materials\n- [x] Animations\n- [x] Skins\n- [x] Cameras\n- [x] Parse `glb` files\n- [ ] Morth targets\n- [ ] Extras data\n\nAlso, we supports some glTF extensions:\n\n- [x] khr_lights_punctual\n- [x] khr_materials_emissive_strength\n- [x] khr_materials_ior\n- [x] khr_materials_transmission\n- [x] khr_texture_transform\n\n## Thanks\n\nThis library is using Raphael Luba's `jason` module to parse JSON strings, so thanks to him! :)\n\n## Contributing to the project\n\nDon’t be shy about shooting any questions you may have. If you are a beginner/junior, don’t hesitate, I will always encourage you. It’s a safe place here. Also, I would be very happy to receive any kind of pull requests, you will have (at least) some feedback/guidance rapidly.\n\nBehind screens, there are human beings, living any sort of story. So be always kind and respectful, because we all sheer to learn new things.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkooparse%2Fgltf_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkooparse%2Fgltf_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkooparse%2Fgltf_parser/lists"}