summaryrefslogtreecommitdiff
path: root/src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-03-04 10:47:15 -0600
committersanine <sanine.not@pm.me>2022-03-04 10:47:15 -0600
commit058f98a63658dc1a2579826ba167fd61bed1e21f (patch)
treebcba07a1615a14d943f3af3f815a42f3be86b2f3 /src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h
parent2f8028ac9e0812cb6f3cbb08f0f419e4e717bd22 (diff)
add assimp submodule
Diffstat (limited to 'src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h')
-rw-r--r--src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h b/src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h
new file mode 100644
index 0000000..f7f9a93
--- /dev/null
+++ b/src/mesh/assimp-master/code/AssetLib/Assjson/mesh_splitter.h
@@ -0,0 +1,52 @@
+/*
+Assimp2Json
+Copyright (c) 2011, Alexander C. Gessler
+
+Licensed under a 3-clause BSD license. See the LICENSE file for more information.
+
+*/
+
+#ifndef INCLUDED_MESH_SPLITTER
+#define INCLUDED_MESH_SPLITTER
+
+// ----------------------------------------------------------------------------
+// Note: this is largely based on assimp's SplitLargeMeshes_Vertex process.
+// it is refactored and the coding style is slightly improved, though.
+// ----------------------------------------------------------------------------
+
+#include <vector>
+
+struct aiScene;
+struct aiMesh;
+struct aiNode;
+
+// ---------------------------------------------------------------------------
+/** Splits meshes of unique vertices into meshes with no more vertices than
+ * a given, configurable threshold value.
+ */
+class MeshSplitter {
+public:
+ unsigned int LIMIT;
+
+ void SetLimit(unsigned int l) {
+ LIMIT = l;
+ }
+
+ unsigned int GetLimit() const {
+ return LIMIT;
+ }
+
+ // -------------------------------------------------------------------
+ /** Executes the post processing step on the given imported data.
+ * At the moment a process is not supposed to fail.
+ * @param pScene The imported data to work at.
+ */
+ void Execute(aiScene *pScene);
+
+private:
+ void UpdateNode(aiNode *pcNode, const std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
+ void SplitMesh(unsigned int index, aiMesh *mesh, std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
+
+};
+
+#endif // INCLUDED_MESH_SPLITTER