Blender  V3.3
obj_import_objects.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include "BKE_lib_id.h"
10 
11 #include "BLI_map.hh"
12 #include "BLI_math_base.hh"
13 #include "BLI_math_vec_types.hh"
14 #include "BLI_set.hh"
15 #include "BLI_vector.hh"
16 
17 #include "DNA_meshdata_types.h"
18 #include "DNA_object_types.h"
19 
20 namespace blender::io::obj {
21 
29 
39  };
41 };
42 
46 struct PolyCorner {
47  /* These indices range from zero to total vertices in the OBJ file. */
49  /* -1 is to indicate absence of UV vertices. Only < 0 condition should be checked since
50  * it can be less than -1 too. */
51  int uv_vert_index = -1;
53 };
54 
55 struct PolyElem {
57  int material_index = -1;
58  bool shaded_smooth = false;
59  int start_index_ = 0;
60  int corner_count_ = 0;
61 };
62 
66 struct NurbsElement {
71  std::string group_;
72  int degree = 0;
77  /* Values in the parm u/v line in a curve definition. */
79 };
80 
84 };
85 
86 struct Geometry {
88  std::string geometry_name_;
93 
94  int vertex_index_min_ = INT_MAX;
96  /* Global vertex indices used by this geometry. */
98  /* Mapping from global vertex index to geometry-local vertex index. */
100  /* Loose edges in the file. */
102 
105 
106  bool has_invalid_polys_ = false;
107  bool has_vertex_groups_ = false;
109  int total_loops_ = 0;
110 
111  int get_vertex_count() const
112  {
113  return (int)vertices_.size();
114  }
115  void track_vertex_index(int index)
116  {
117  vertices_.add(index);
120  }
122  {
124  for (int i = 0; i < count; ++i) {
125  vertices_.add(i);
126  }
127  vertex_index_min_ = 0;
128  vertex_index_max_ = count - 1;
129  }
130 };
131 
132 } // namespace blender::io::obj
Object is a sort of wrapper for general info.
@ OB_MESH
@ OB_CURVES_LEGACY
int64_t size() const
Definition: BLI_set.hh:539
void reserve(const int64_t n)
Definition: BLI_set.hh:589
bool add(const Key &key)
Definition: BLI_set.hh:253
int count
void min_inplace(T &a, const T &b)
void max_inplace(T &a, const T &b)
Vector< PolyElem > face_elements_
Vector< std::string > material_order_
Map< int, int > global_to_local_vertices_
Map< std::string, int > group_indices_
Vector< std::string > group_order_
Map< std::string, int > material_indices_
Vector< PolyCorner > face_corners_
Vector< VertexColorsBlock > vertex_colors