/src/assimp/code/AssetLib/Assjson/mesh_splitter.h
Line | Count | Source |
1 | | /* |
2 | | Assimp2Json |
3 | | Copyright (c) 2011, Alexander C. Gessler |
4 | | |
5 | | Licensed under a 3-clause BSD license. See the LICENSE file for more information. |
6 | | |
7 | | */ |
8 | | |
9 | | #ifndef INCLUDED_MESH_SPLITTER |
10 | | #define INCLUDED_MESH_SPLITTER |
11 | | |
12 | | // ---------------------------------------------------------------------------- |
13 | | // Note: this is largely based on assimp's SplitLargeMeshes_Vertex process. |
14 | | // it is refactored and the coding style is slightly improved, though. |
15 | | // ---------------------------------------------------------------------------- |
16 | | |
17 | | #include <vector> |
18 | | |
19 | | struct aiScene; |
20 | | struct aiMesh; |
21 | | struct aiNode; |
22 | | |
23 | | // --------------------------------------------------------------------------- |
24 | | /** Splits meshes of unique vertices into meshes with no more vertices than |
25 | | * a given, configurable threshold value. |
26 | | */ |
27 | | class MeshSplitter { |
28 | | public: |
29 | | unsigned int LIMIT; |
30 | | |
31 | 4.96k | void SetLimit(unsigned int l) { |
32 | 4.96k | LIMIT = l; |
33 | 4.96k | } |
34 | | |
35 | 0 | unsigned int GetLimit() const { |
36 | 0 | return LIMIT; |
37 | 0 | } |
38 | | |
39 | | // ------------------------------------------------------------------- |
40 | | /** Executes the post processing step on the given imported data. |
41 | | * At the moment a process is not supposed to fail. |
42 | | * @param pScene The imported data to work at. |
43 | | */ |
44 | | void Execute(aiScene *pScene); |
45 | | |
46 | | private: |
47 | | void UpdateNode(aiNode *pcNode, const std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map); |
48 | | void SplitMesh(unsigned int index, aiMesh *mesh, std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map); |
49 | | |
50 | | }; |
51 | | |
52 | | #endif // INCLUDED_MESH_SPLITTER |