~ubuntu-branches/ubuntu/trusty/assimp/trusty-proposed

« back to all changes in this revision

Viewing changes to code/Subdivision.h

  • Committer: Package Import Robot
  • Author(s): IOhannes m zmoelnig (gpg-key at iem)
  • Date: 2011-08-23 16:51:26 UTC
  • Revision ID: package-import@ubuntu.com-20110823165126-rvbjt1qtcusine1c
Tags: upstream-2.0.863+dfsg
ImportĀ upstreamĀ versionĀ 2.0.863+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Open Asset Import Library (ASSIMP)
 
3
----------------------------------------------------------------------
 
4
 
 
5
Copyright (c) 2006-2010, ASSIMP Development Team
 
6
All rights reserved.
 
7
 
 
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:
 
11
 
 
12
* Redistributions of source code must retain the above
 
13
  copyright notice, this list of conditions and the
 
14
  following disclaimer.
 
15
 
 
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.
 
20
 
 
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 Development Team.
 
25
 
 
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.
 
37
 
 
38
----------------------------------------------------------------------
 
39
*/
 
40
 
 
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        {
 
45
 
 
46
// ------------------------------------------------------------------------------
 
47
/** Helper class to evaluate subdivision surfaces. Different algorithms
 
48
 *  are provided for choice. */
 
49
// ------------------------------------------------------------------------------
 
50
class ASSIMP_API Subdivider
 
51
{
 
52
public:
 
53
 
 
54
        /** Enumerates all supported subvidision algorithms */
 
55
        enum Algorithm  {
 
56
                CATMULL_CLARKE = 0x1
 
57
        };
 
58
 
 
59
public:
 
60
 
 
61
        virtual ~Subdivider() {
 
62
        }
 
63
 
 
64
public:
 
65
 
 
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);
 
72
 
 
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 (const aiMesh* mesh, 
 
86
                aiMesh*& out, unsigned int num,
 
87
                bool discard_input = false) = 0;
 
88
 
 
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
                const aiMesh* const * smesh, 
 
112
                size_t nmesh,
 
113
                aiMesh** out, 
 
114
                unsigned int num,
 
115
                bool discard_input = false) = 0;
 
116
 
 
117
private:
 
118
};
 
119
 
 
120
} // end namespace Assimp
 
121
 
 
122
 
 
123
#endif // !!  AI_SUBDISIVION_H_INC
 
124