A simple (and incomplete) IQM importer written in Zig
NOTE: As the title says, this is INCOMPLETE and thus not really useful for anything but basic IQM file loading
- Download the
iqm.zig
file and@import()
it up in your project! It has no other dependency than the Zig Standard Library itself.
const iqm = @import("iqm.zig");
var modelA_raw = @embedFile("assets/modelA.iqm");
var modelA = try iqm.fromBuffer(model_raw, false, allocator_of_choice);
var modelB = try iqm.fromFile("assets/modelB.iqm", null, allocator_of_choice);
var meshA = modelA.meshes[0];
var meshB = modelB.meshes[0];
try renderer.renderMesh(modelA, meshA);
try renderer.renderMesh(modelB, meshB);
-
fromBuffer(data: []const u8, isEXM: bool, alloc: std.mem.Allocator) !Model
:
Creates aModel
struct out ofdata
which could return an error at handling memory, reading the header or finding invalid data. -
fromFile(name: []const u8, isEXM: ?bool, alloc: std.mem.Allocator) !Model
:
Creates aModel
struct out of the file specified byname
(relative toCWD
) which could return an error at handling memory, reading the header or finding invalid data.isEXM
will be true ifnull
andname
ends with.exm
- Vertex arrays
- Vertex indices/triangles
- Texts
- Materials
- Poses/Animations
- Meshes
- EXM data
- Basic OpenGL renderer example
- Exporting.
This project is covered under the ZLIB License and the license is bundled with the library, check out iqm.zig
.