diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gltf_bindings.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/gltf_bindings.zig b/tools/gltf_bindings.zig new file mode 100644 index 0000000..59695d8 --- /dev/null +++ b/tools/gltf_bindings.zig @@ -0,0 +1,14 @@ +//! Host build tool: input glTF/GLB -> output Zig source, before app compilation. +const std = @import("std"); +const gltf = @import("gltf"); + +pub fn main(init: std.process.Init) !void { + var args = init.minimal.args.iterate(); + _ = args.skip(); + const input = args.next() orelse return error.ExpectedGltfPath; + const output = args.next() orelse return error.ExpectedZigPath; + const a = init.arena.allocator(); + const bytes = try std.Io.Dir.cwd().readFileAlloc(init.io, input, a, .limited(64 << 20)); + const source = try gltf.generate(a, bytes, input); + try std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = output, .data = source }); +} |
