https://github.com/kevinw/odin-cgltf
bindings for the cgltf library
https://github.com/kevinw/odin-cgltf
Last synced: about 1 month ago
JSON representation
bindings for the cgltf library
- Host: GitHub
- URL: https://github.com/kevinw/odin-cgltf
- Owner: kevinw
- Created: 2019-11-07T15:10:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-07T15:18:45.000Z (over 5 years ago)
- Last Synced: 2025-02-16T08:44:05.056Z (3 months ago)
- Language: C
- Size: 131 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# odin-cgltf
[Odin](https://odin-lang.org/) bindings for the [cgltf](https://github.com/jkuhlmann/cgltf) model loading/writing library.
## Usage
```odin
import "core:fmt"
import "core:mem"main :: proc() {
options := cgltf.Options{};
gltf:^cgltf.Data;path_root := "./";
result := cgltf.parse_file(&options, "model.gltf", &gltf);
if result != .SUCCESS {
fmt.eprintln("error parsing gltf");
return;
}defer cgltf.free(gltf);
// load all buffers
buffers := mem.slice_ptr(gltf.buffers, gltf.buffers_count);
for _, i in buffers {
gltf_buf := &buffers[i];
full_uri := fmt.tprintf("%s%s", path_root, gltf_buf.uri);
ok, bytes := os.read_entire_file(full_uri);// init buffer in your graphics api
}// ...
}```