| 550 | } |
| 551 | |
| 552 | s32 parse(Mesh &m, const char *path, CompileOptions &opts) |
| 553 | { |
| 554 | MeshCache *cache = (MeshCache *)opts._data_compiler.user_data(RESOURCE_TYPE_MESH); |
| 555 | |
| 556 | if (cache == NULL) { |
| 557 | RETURN_IF_FILE_MISSING(MESH, path, opts); |
| 558 | Buffer buf = opts.read(path); |
| 559 | return parse_internal(m, buf, opts); |
| 560 | } else { |
| 561 | s32 err = 0; |
| 562 | StringId64 path_id(path); |
| 563 | Mesh *mesh = mesh_cache::get(*cache, path); |
| 564 | if (mesh == NULL) { |
| 565 | mesh = CE_NEW(default_allocator(), Mesh)(default_allocator()); |
| 566 | RETURN_IF_FILE_MISSING(MESH, path, opts); |
| 567 | Buffer buf = opts.read(path); |
| 568 | err = parse_internal(*mesh, buf, opts); |
| 569 | ENSURE_OR_RETURN(MESH, err == 0, opts); |
| 570 | mesh->_path = path_id; |
| 571 | mesh_cache::add(*cache, mesh); |
| 572 | } |
| 573 | |
| 574 | m = *mesh; |
| 575 | return err; |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | s32 parse(Mesh &m, CompileOptions &opts) |
| 580 | { |
no test coverage detected