Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gnimuc/gltf.jl
glTF loader and writer for Julia
https://github.com/gnimuc/gltf.jl
gltf gltf-loader gltf2 julia
Last synced: 11 days ago
JSON representation
glTF loader and writer for Julia
- Host: GitHub
- URL: https://github.com/gnimuc/gltf.jl
- Owner: Gnimuc
- License: mit
- Created: 2015-10-26T14:00:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-17T06:39:03.000Z (8 months ago)
- Last Synced: 2024-10-23T06:02:09.011Z (16 days ago)
- Topics: gltf, gltf-loader, gltf2, julia
- Language: Julia
- Homepage:
- Size: 121 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GLTF
[![CI](https://github.com/Gnimuc/GLTF.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/Gnimuc/GLTF.jl/actions/workflows/ci.yml)
[![TagBot](https://github.com/Gnimuc/GLTF.jl/actions/workflows/TagBot.yml/badge.svg)](https://github.com/Gnimuc/GLTF.jl/actions/workflows/TagBot.yml)
[![Codecov](https://codecov.io/gh/Gnimuc/GLTF.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Gnimuc/GLTF.jl)[glTF](https://github.com/KhronosGroup/glTF) 2.0 loader and writer based on [JSON3](https://github.com/quinnj/JSON3.jl). This package only handles .gltf and not .glb.
## Installation
```julia
pkg> add GLTF
```## Usage
glTF file format is just a JSON file + raw binaries. This package defines Julia types that map to the corresponding glTF objects.```julia
julia> using JSON3, GLTFjulia> accessor_str = """{
"bufferView": 0,
"componentType": 5126,
"count": 24,
"type": "VEC3",
"max": [
0.3,
0.3,
0.3
],
"min": [
-0.3,
-0.3,
-0.3
],
"name": "Positions Accessor"
}"""
"{\n \"bufferView\": 0,\n \"componentType\": 5126,\n \"count\": 24,\n \"type\": \"VEC3\",\n \"max\": [\n 0.3,\n 0.3,\n 0.3\n ],\n \"min\": [\n -0.3,\n -0.3,\n -0.3\n ],\n \"name\": \"Positions Accessor\"\n}"julia> accessor = JSON3.read(accessor_str, GLTF.Accessor)
GLTF.Accessor:
bufferView: 0
componentType: 5126
count: 24
type: VEC3
max: Any[0.3, 0.3, 0.3]
min: Any[-0.3, -0.3, -0.3]
name: Positions Accessor
```load/save file from/to disk:
```
load("path/to/xxx.gltf") # -> GLTF.Object
save("path/to/xxx.gltf", x) # where x is of type GLTF.Object
```