:heavy_check_mark: - fully implemented :heavy_plus_sign: - partially implemented :x: - not implemented
import "gltf2"
main :: proc() {
// This procedure sets file format from file extension [gltf/glb]
data, error := gltf2.load_from_file("file_name.[gltf/glb]")
switch err in error {
case gltf2.JSON_Error: // handle json parsing errors
case gltf2.GLTF_Error: // handle gltf2 parsing errors
}
// if there are no errors we want to free memory when we are done with processing gltf/glb file.
defer gltf2.unload(data)
// do stuff with 'data'
// ...
// Iterate over buffer elements using accessor:
buf := gltf2.buffer_slice(data, 0).([][3]f32)
for val, i in buf {
fmt.printf("Index: %v = %v\n", i, val)
}
}
import "gltf2"
main :: proc () {
// Set options for gltf2 parser.
// is_glb must be set to true if file is in binary format. Most likely it will have "*.glb" suffix. By default it's gltf or JSON file format.
// delete_content set to true will delete bytes provided in procedure call. This is what 'load_from_file' does.
options := gltf2.Options{ is_glb = [true/false(default)], delete_content = [true/false(default)] }
// Load some part of file that is valid JSON object
data, error := gltf2.parse(bytes, options)
switch err in error {
case gltf2.JSON_Error: // Handle JSON parsing errors
case gltf2.GLTF_Error: // Handle GLTF2 parsing errors
}
// If there are no errors we want to free memory when we are done with processing gltf/glb file.
defer gltf2.unload(data)
}