From 79f4b0d33cbb490f957d081bd7c8bc97bd4c689c Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 7 Feb 2023 17:52:17 -0600 Subject: fix parser using REJECT so that example works --- example/example.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'example/example.c') diff --git a/example/example.c b/example/example.c index 050afa3..bf315f0 100644 --- a/example/example.c +++ b/example/example.c @@ -3,5 +3,35 @@ int main() { + struct kalmia_t *k = kalmia_parse_file("suzanne.dae"); + if (k == NULL) { + fprintf(stderr, "Failed to read file!\n"); + return 1; + } + + printf( + "library_geometries[id=%s, name=%s]\n", + k->library_geometries->id, + k->library_geometries->name + ); + + int i; + for (i=0; ilibrary_geometries->geometry_count; i++) { + struct ka_geometry_t *g = k->library_geometries->geometry + i; + printf(" geometry[id=%s, name=%s]\n", g->id, g->name); + printf(" mesh\n"); + + int j; + for (j=0; jmesh.source_count; j++) { + struct ka_source_t s = g->mesh.source[j]; + printf(" source[id=%s, name=%s]\n", s.id, s.name); + } + for (j=0; jmesh.triangles_count; j++) { + struct ka_triangles_t t = g->mesh.triangles[j]; + printf(" triangles[name=%s, count=%d, material=%s]\n", t.name, t.count, t.material); + } + } + + kalmia_destroy(k); return 0; } -- cgit v1.2.1