1/*
2Open Asset Import Library (assimp)
3----------------------------------------------------------------------
4
5Copyright (c) 2006-2019, assimp team
6
7
8All rights reserved.
9
10Redistribution and use of this software in source and binary forms,
11with or without modification, are permitted provided that the
12following conditions are met:
13
14* Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
17
18* Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
22
23* Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
27
28THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
40----------------------------------------------------------------------
41*/
42
43/** @file Defines a helper class to evaluate subdivision surfaces.*/
44#pragma once
45#ifndef AI_SUBDISIVION_H_INC
46#define AI_SUBDISIVION_H_INC
47
48#include <cstddef>
49#include <assimp/types.h>
50
51struct aiMesh;
52
53namespace Assimp {
54
55// ------------------------------------------------------------------------------
56/** Helper class to evaluate subdivision surfaces. Different algorithms
57 * are provided for choice. */
58// ------------------------------------------------------------------------------
59class ASSIMP_API Subdivider {
60public:
61
62 /** Enumerates all supported subvidision algorithms */
63 enum Algorithm {
64 CATMULL_CLARKE = 0x1
65 };
66
67 virtual ~Subdivider();
68
69 // ---------------------------------------------------------------
70 /** Create a subdivider of a specific type
71 *
72 * @param algo Algorithm to be used for subdivision
73 * @return Subdivider instance. */
74 static Subdivider* Create (Algorithm algo);
75
76 // ---------------------------------------------------------------
77 /** Subdivide a mesh using the selected algorithm
78 *
79 * @param mesh First mesh to be subdivided. Must be in verbose
80 * format.
81 * @param out Receives the output mesh, allocated by me.
82 * @param num Number of subdivisions to perform.
83 * @param discard_input If true is passed, the input mesh is
84 * deleted after the subdivision is complete. This can
85 * improve performance because it allows the optimization
86 * to reuse the existing mesh for intermediate results.
87 * @pre out!=mesh*/
88 virtual void Subdivide ( aiMesh* mesh,
89 aiMesh*& out, unsigned int num,
90 bool discard_input = false) = 0;
91
92 // ---------------------------------------------------------------
93 /** Subdivide multiple meshes using the selected algorithm. This
94 * avoids erroneous smoothing on objects consisting of multiple
95 * per-material meshes. Usually, most 3d modellers smooth on a
96 * per-object base, regardless the materials assigned to the
97 * meshes.
98 *
99 * @param smesh Array of meshes to be subdivided. Must be in
100 * verbose format.
101 * @param nmesh Number of meshes in smesh.
102 * @param out Receives the output meshes. The array must be
103 * sufficiently large (at least @c nmesh elements) and may not
104 * overlap the input array. Output meshes map one-to-one to
105 * their corresponding input meshes. The meshes are allocated
106 * by the function.
107 * @param discard_input If true is passed, input meshes are
108 * deleted after the subdivision is complete. This can
109 * improve performance because it allows the optimization
110 * of reusing existing meshes for intermediate results.
111 * @param num Number of subdivisions to perform.
112 * @pre nmesh != 0, smesh and out may not overlap*/
113 virtual void Subdivide (
114 aiMesh** smesh,
115 size_t nmesh,
116 aiMesh** out,
117 unsigned int num,
118 bool discard_input = false) = 0;
119
120};
121
122inline
123Subdivider::~Subdivider() {
124 // empty
125}
126
127} // end namespace Assimp
128
129
130#endif // !! AI_SUBDISIVION_H_INC
131
132

source code of qt3d/src/3rdparty/assimp/src/include/assimp/Subdivision.h