Debian Codegraph @

third_party/cgltf/test/main.c

raw
1
2
3 #define CGLTF_IMPLEMENTATION
4 #include "../cgltf.h"
5
6 #include <stdio.h>
7
8 int main(int argc, char** argv)
9 {
10 if (argc < 2)
11 {
12 printf("err\n");
13 return -1;
14 }
15
16 cgltf_options options;
17 memset(&options, 0, sizeof(cgltf_options));
18 cgltf_data* data = NULL;
19 cgltf_result result = cgltf_parse_file(&options, argv[1], &data);
20
21 if (result == cgltf_result_success)
22 result = cgltf_load_buffers(&options, data, argv[1]);
23
24 if (result == cgltf_result_success)
25 result = cgltf_validate(data);
26
27 printf("Result: %d\n", result);
28
29 if (result == cgltf_result_success)
30 {
31 printf("Type: %u\n", data->file_type);
32 printf("Meshes: %u\n", (unsigned)data->meshes_count);
33 }
34
35 cgltf_free(data);
36
37 return result;
38 }