3D Repo Bouncer  1.4
All Classes Namespaces Functions Variables Enumerations
repo_mesh_map_reorganiser.h
1 
17 #pragma once
18 #include <unordered_map>
19 #include "../../core/model/bson/repo_node_mesh.h"
20 
21 namespace repo{
22  namespace manipulator{
23  namespace modelutility{
25  {
26  public:
35  const repo::core::model::MeshNode *mesh,
36  const size_t &vertThreshold);
38 
43  std::vector<std::vector<float>> getIDMapArrays() const;
44 
49  std::vector<std::vector<repo_mesh_mapping_t>> getMappingsPerSubMesh() const;
50 
56 
61  std::vector<uint16_t> getSerialisedFaces() const;
62 
67  std::unordered_map<repoUUID, std::vector<uint32_t>, RepoUUIDHasher> getSplitMapping() const;
68 
69  private:
78  void finishSubMesh(
79  repo_mesh_mapping_t &mapping,
80  std::vector<float> &minBox,
81  std::vector<float> &maxBox,
82  const size_t &nVertices,
83  const size_t &nFaces
84  );
85 
86  void newMatMapEntry(
87  const repo_mesh_mapping_t &mapping,
88  const size_t &sVertices,
89  const size_t &sFaces
90  );
91 
92  void completeLastMatMapEntry(
93  const size_t &eVertices,
94  const size_t &eFaces,
95  const std::vector<float> &minBox = std::vector<float>(),
96  const std::vector<float> &maxBox = std::vector<float>()
97  );
98 
103  bool performSplitting();
104 
115  bool splitLargeMesh(
116  const repo_mesh_mapping_t currentSubMesh,
117  std::vector<repo_mesh_mapping_t> &newMappings,
118  size_t &idMapIdx,
119  size_t &orgFaceIdx,
120  size_t &totalVertexCount,
121  size_t &totalFaceCount);
122 
131  void startSubMesh(
132  repo_mesh_mapping_t &mapping,
133  const repoUUID &meshID,
134  const repoUUID &matID,
135  const size_t &sVertices,
136  const size_t &sFaces
137  );
138 
146  void updateBoundingBoxes(
147  std::vector<float> &min,
148  std::vector<float> &max,
149  const repo_vector_t &smMin,
150  const repo_vector_t &smMax);
151 
157  void updateIDMapArray(
158  const size_t &n,
159  const size_t &value);
160 
161  bool reMapSuccess;
162 
163  const repo::core::model::MeshNode *mesh;
164  const size_t maxVertices;
165  const std::vector<repo_vector_t> oldVertices;
166  const std::vector<repo_vector_t> oldNormals;
167  const std::vector<std::vector<repo_vector2d_t>> oldUVs;
168  const std::vector<repo_face_t> oldFaces;
169  const std::vector<repo_color4d_t> oldColors;
170 
171  std::vector<repo_vector_t> newVertices;
172  std::vector<repo_vector_t> newNormals;
173  std::vector<repo_face_t> newFaces;
174  std::vector<repo_color4d_t> newColors;
175  std::vector<std::vector<repo_vector2d_t>> newUVs;
176 
177  std::vector<uint16_t> serialisedFaces;
178 
179  std::vector<std::vector<float>> idMapBuf;
180  std::unordered_map<repoUUID, std::vector<uint32_t>, RepoUUIDHasher> splitMap;
181  std::vector<std::vector<repo_mesh_mapping_t>> matMap;
182  std::vector<repo_mesh_mapping_t> reMappedMappings;
183  };
184  }
185  }
186 }
repo::core::model::MeshNode getRemappedMesh() const
Definition: repo_mesh_map_reorganiser.cpp:145
std::vector< uint16_t > getSerialisedFaces() const
Definition: repo_mesh_map_reorganiser.cpp:136
MeshMapReorganiser(const repo::core::model::MeshNode *mesh, const size_t &vertThreshold)
Definition: repo_mesh_map_reorganiser.cpp:23
Definition: repo_connection_pool_mongo.h:32
std::vector< std::vector< float > > getIDMapArrays() const
Definition: repo_mesh_map_reorganiser.cpp:127
Definition: repo_mesh_map_reorganiser.h:24
Definition: repo_node_utils.h:67
std::unordered_map< repoUUID, std::vector< uint32_t >, RepoUUIDHasher > getSplitMapping() const
Definition: repo_mesh_map_reorganiser.cpp:141
Definition: repo_node_utils.h:81
Definition: repo_node_utils.h:40
Definition: repo_node_mesh.h:62
std::vector< std::vector< repo_mesh_mapping_t > > getMappingsPerSubMesh() const
Definition: repo_mesh_map_reorganiser.cpp:132