vrshoot

view libs/assimp/Subdivision.h @ 0:b2f14e535253

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