File: mesh_splitter.h

package info (click to toggle)
assimp 6.0.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 160,144 kB
  • sloc: cpp: 165,949; cobol: 65,664; ansic: 16,612; xml: 11,246; python: 4,729; java: 2,303; sh: 578; objc: 122; pascal: 100; makefile: 66
file content (52 lines) | stat: -rw-r--r-- 1,525 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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