| 422 | }; |
| 423 | |
| 424 | struct callback_t { |
| 425 | // W is optional and set to 1 if there is no `w` item in `v` line |
| 426 | void (*vertex_cb)(void *user_data, real_t x, real_t y, real_t z, real_t w); |
| 427 | void (*vertex_color_cb)(void *user_data, real_t x, real_t y, real_t z, |
| 428 | real_t r, real_t g, real_t b, bool has_color); |
| 429 | void (*normal_cb)(void *user_data, real_t x, real_t y, real_t z); |
| 430 | |
| 431 | // y and z are optional and set to 0 if there is no `y` and/or `z` item(s) in |
| 432 | // `vt` line. |
| 433 | void (*texcoord_cb)(void *user_data, real_t x, real_t y, real_t z); |
| 434 | |
| 435 | // called per 'f' line. num_indices is the number of face indices(e.g. 3 for |
| 436 | // triangle, 4 for quad) |
| 437 | // 0 will be passed for undefined index in index_t members. |
| 438 | void (*index_cb)(void *user_data, index_t *indices, int num_indices); |
| 439 | // `name` material name, `material_id` = the array index of material_t[]. -1 |
| 440 | // if |
| 441 | // a material not found in .mtl |
| 442 | void (*usemtl_cb)(void *user_data, const char *name, int material_id); |
| 443 | // `materials` = parsed material data. |
| 444 | void (*mtllib_cb)(void *user_data, const material_t *materials, |
| 445 | int num_materials); |
| 446 | // There may be multiple group names |
| 447 | void (*group_cb)(void *user_data, const char **names, int num_names); |
| 448 | void (*object_cb)(void *user_data, const char *name); |
| 449 | |
| 450 | callback_t() |
| 451 | : vertex_cb(NULL), |
| 452 | vertex_color_cb(NULL), |
| 453 | normal_cb(NULL), |
| 454 | texcoord_cb(NULL), |
| 455 | index_cb(NULL), |
| 456 | usemtl_cb(NULL), |
| 457 | mtllib_cb(NULL), |
| 458 | group_cb(NULL), |
| 459 | object_cb(NULL) {} |
| 460 | }; |
| 461 | |
| 462 | class MaterialReader { |
| 463 | public: |
nothing calls this directly
no outgoing calls
no test coverage detected