Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 08:43:04

0001 /*
0002 Open Asset Import Library (assimp)
0003 ----------------------------------------------------------------------
0004 
0005 Copyright (c) 2006-2025, assimp team
0006 
0007 All rights reserved.
0008 
0009 Redistribution and use of this software in source and binary forms,
0010 with or without modification, are permitted provided that the
0011 following conditions are met:
0012 
0013 * Redistributions of source code must retain the above
0014   copyright notice, this list of conditions and the
0015   following disclaimer.
0016 
0017 * Redistributions in binary form must reproduce the above
0018   copyright notice, this list of conditions and the
0019   following disclaimer in the documentation and/or other
0020   materials provided with the distribution.
0021 
0022 * Neither the name of the assimp team, nor the names of its
0023   contributors may be used to endorse or promote products
0024   derived from this software without specific prior
0025   written permission of the assimp team.
0026 
0027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0028 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0029 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0030 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0031 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0032 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0033 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0034 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0035 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0036 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0038 
0039 ----------------------------------------------------------------------
0040 */
0041 
0042 /** @file Defines a helper class to evaluate subdivision surfaces.*/
0043 #pragma once
0044 #ifndef AI_SUBDISIVION_H_INC
0045 #define AI_SUBDISIVION_H_INC
0046 
0047 #ifdef __GNUC__
0048 #   pragma GCC system_header
0049 #endif
0050 
0051 #include <assimp/types.h>
0052 
0053 struct aiMesh;
0054 
0055 namespace Assimp {
0056 
0057 // ------------------------------------------------------------------------------
0058 /** Helper class to evaluate subdivision surfaces. Different algorithms
0059  *  are provided for choice. */
0060 // ------------------------------------------------------------------------------
0061 class ASSIMP_API Subdivider {
0062 public:
0063 
0064     /** Enumerates all supported subvidision algorithms */
0065     enum Algorithm  {
0066         CATMULL_CLARKE = 0x1
0067     };
0068 
0069     virtual ~Subdivider();
0070 
0071     // ---------------------------------------------------------------
0072     /** Create a subdivider of a specific type
0073      *
0074      *  @param algo Algorithm to be used for subdivision
0075      *  @return Subdivider instance. */
0076     static Subdivider* Create (Algorithm algo);
0077 
0078     // ---------------------------------------------------------------
0079     /** Subdivide a mesh using the selected algorithm
0080      *
0081      *  @param mesh First mesh to be subdivided. Must be in verbose
0082      *    format.
0083      *  @param out Receives the output mesh, allocated by me.
0084      *  @param num Number of subdivisions to perform.
0085      *  @param discard_input If true is passed, the input mesh is
0086      *    deleted after the subdivision is complete. This can
0087      *    improve performance because it allows the optimization
0088      *    to reuse the existing mesh for intermediate results.
0089      *  @pre out!=mesh*/
0090     virtual void Subdivide ( aiMesh* mesh,
0091         aiMesh*& out, unsigned int num,
0092         bool discard_input = false) = 0;
0093 
0094     // ---------------------------------------------------------------
0095     /** Subdivide multiple meshes using the selected algorithm. This
0096      *  avoids erroneous smoothing on objects consisting of multiple
0097      *  per-material meshes. Usually, most 3d modellers smooth on a
0098      *  per-object base, regardless the materials assigned to the
0099      *  meshes.
0100      *
0101      *  @param smesh Array of meshes to be subdivided. Must be in
0102      *    verbose format.
0103      *  @param nmesh Number of meshes in smesh.
0104      *  @param out Receives the output meshes. The array must be
0105      *    sufficiently large (at least @c nmesh elements) and may not
0106      *    overlap the input array. Output meshes map one-to-one to
0107      *    their corresponding input meshes. The meshes are allocated
0108      *    by the function.
0109      *  @param discard_input If true is passed, input meshes are
0110      *    deleted after the subdivision is complete. This can
0111      *    improve performance because it allows the optimization
0112      *    of reusing existing meshes for intermediate results.
0113      *  @param num Number of subdivisions to perform.
0114      *  @pre nmesh != 0, smesh and out may not overlap*/
0115     virtual void Subdivide (
0116         aiMesh** smesh,
0117         size_t nmesh,
0118         aiMesh** out,
0119         unsigned int num,
0120         bool discard_input = false) = 0;
0121 
0122 };
0123 
0124 inline Subdivider::~Subdivider() = default;
0125 
0126 } // end namespace Assimp
0127 
0128 
0129 #endif // !!  AI_SUBDISIVION_H_INC
0130