diff options
author | sanine <sanine.not@pm.me> | 2023-02-07 17:52:17 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-07 17:52:17 -0600 |
commit | 79f4b0d33cbb490f957d081bd7c8bc97bd4c689c (patch) | |
tree | be04a0dd98ca341a46bd65cf400a20e1c66f3563 /example/example.c | |
parent | f547164540f4ac7f8436fef8e981b1fef503f08c (diff) |
fix parser using REJECT so that example works
Diffstat (limited to 'example/example.c')
-rw-r--r-- | example/example.c | 30 |
1 files changed, 30 insertions, 0 deletions
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; i<k->library_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; j<g->mesh.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; j<g->mesh.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; } |