1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <stdio.h>
#include <kalmia.h>
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;
}
|