Blender V4.3
obj_import_file_reader.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "IO_wavefront_obj.hh"
12
13#include "BLI_map.hh"
14#include "BLI_vector.hh"
15
16#include "obj_import_objects.hh"
17
18namespace blender::io::obj {
19
20struct MTLMaterial;
21
22/* NOTE: the OBJ parser implementation is planned to get fairly large changes "soon",
23 * so don't read too much into current implementation... */
24class OBJParser {
25 private:
26 const OBJImportParams &import_params_;
27 FILE *obj_file_;
28 Vector<std::string> mtl_libraries_;
29 size_t read_buffer_size_;
30
31 public:
35 OBJParser(const OBJImportParams &import_params, size_t read_buffer_size);
36 ~OBJParser();
37
42 void parse(Vector<std::unique_ptr<Geometry>> &r_all_geometries,
43 GlobalVertices &r_global_vertices);
48
49 private:
50 void add_mtl_library(StringRef path);
51 void add_default_mtl_library();
52};
53
54class MTLParser {
55 private:
56 char mtl_file_path_[FILE_MAX];
60 char mtl_dir_path_[FILE_MAX];
61
62 public:
66 MTLParser(StringRefNull mtl_library_, StringRefNull obj_filepath);
67
71 void parse_and_store(Map<std::string, std::unique_ptr<MTLMaterial>> &r_materials);
72};
73} // namespace blender::io::obj
#define FILE_MAX
void parse_and_store(Map< std::string, std::unique_ptr< MTLMaterial > > &r_materials)
MTLParser(StringRefNull mtl_library_, StringRefNull obj_filepath)
Span< std::string > mtl_libraries() const
OBJParser(const OBJImportParams &import_params, size_t read_buffer_size)
void parse(Vector< std::unique_ptr< Geometry > > &r_all_geometries, GlobalVertices &r_global_vertices)