|
|
|||
File indexing completed on 2026-09-19 08:49:21
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 Declares a helper class, "StandardShapes" which generates 0043 * vertices for standard shapes, such as cylinders, cones, spheres .. 0044 */ 0045 #pragma once 0046 #ifndef AI_STANDARD_SHAPES_H_INC 0047 #define AI_STANDARD_SHAPES_H_INC 0048 0049 #ifdef __GNUC__ 0050 # pragma GCC system_header 0051 #endif 0052 0053 #include <assimp/vector3.h> 0054 #include <stddef.h> 0055 #include <vector> 0056 0057 struct aiMesh; 0058 0059 namespace Assimp { 0060 0061 // --------------------------------------------------------------------------- 0062 /** \brief Helper class to generate vertex buffers for standard geometric 0063 * shapes, such as cylinders, cones, boxes, spheres, elipsoids ... . 0064 */ 0065 class ASSIMP_API StandardShapes 0066 { 0067 // class cannot be instanced 0068 StandardShapes() {} 0069 0070 public: 0071 0072 0073 // ---------------------------------------------------------------- 0074 /** Generates a mesh from an array of vertex positions. 0075 * 0076 * @param positions List of vertex positions 0077 * @param numIndices Number of indices per primitive 0078 * @return Output mesh 0079 */ 0080 static aiMesh* MakeMesh(const std::vector<aiVector3D>& positions, 0081 unsigned int numIndices); 0082 0083 0084 static aiMesh* MakeMesh ( unsigned int (*GenerateFunc) 0085 (std::vector<aiVector3D>&)); 0086 0087 static aiMesh* MakeMesh ( unsigned int (*GenerateFunc) 0088 (std::vector<aiVector3D>&, bool)); 0089 0090 static aiMesh* MakeMesh ( unsigned int n, void (*GenerateFunc) 0091 (unsigned int,std::vector<aiVector3D>&)); 0092 0093 // ---------------------------------------------------------------- 0094 /** @brief Generates a hexahedron (cube) 0095 * 0096 * Hexahedrons can be scaled on all axes. 0097 * @param positions Receives output triangles. 0098 * @param polygons If you pass true here quads will be returned 0099 * @return Number of vertices per face 0100 */ 0101 static unsigned int MakeHexahedron( 0102 std::vector<aiVector3D>& positions, 0103 bool polygons = false); 0104 0105 // ---------------------------------------------------------------- 0106 /** @brief Generates an icosahedron 0107 * 0108 * @param positions Receives output triangles. 0109 * @return Number of vertices per face 0110 */ 0111 static unsigned int MakeIcosahedron( 0112 std::vector<aiVector3D>& positions); 0113 0114 0115 // ---------------------------------------------------------------- 0116 /** @brief Generates a dodecahedron 0117 * 0118 * @param positions Receives output triangles 0119 * @param polygons If you pass true here pentagons will be returned 0120 * @return Number of vertices per face 0121 */ 0122 static unsigned int MakeDodecahedron( 0123 std::vector<aiVector3D>& positions, 0124 bool polygons = false); 0125 0126 0127 // ---------------------------------------------------------------- 0128 /** @brief Generates an octahedron 0129 * 0130 * @param positions Receives output triangles. 0131 * @return Number of vertices per face 0132 */ 0133 static unsigned int MakeOctahedron( 0134 std::vector<aiVector3D>& positions); 0135 0136 0137 // ---------------------------------------------------------------- 0138 /** @brief Generates a tetrahedron 0139 * 0140 * @param positions Receives output triangles. 0141 * @return Number of vertices per face 0142 */ 0143 static unsigned int MakeTetrahedron( 0144 std::vector<aiVector3D>& positions); 0145 0146 0147 0148 // ---------------------------------------------------------------- 0149 /** @brief Generates a sphere 0150 * 0151 * @param tess Number of subdivions - 0 generates a octahedron 0152 * @param positions Receives output triangles. 0153 */ 0154 static void MakeSphere(unsigned int tess, 0155 std::vector<aiVector3D>& positions); 0156 0157 0158 // ---------------------------------------------------------------- 0159 /** @brief Generates a cone or a cylinder, either open or closed. 0160 * 0161 * @code 0162 * 0163 * |-----| <- radius 1 0164 * 0165 * __x__ <- ] ^ 0166 * / \ | height | 0167 * / \ | Y 0168 * / \ | 0169 * / \ | 0170 * /______x______\ <- ] <- end cap 0171 * 0172 * |-------------| <- radius 2 0173 * 0174 * @endcode 0175 * 0176 * @param height Height of the cone 0177 * @param radius1 First radius 0178 * @param radius2 Second radius 0179 * @param tess Number of triangles. 0180 * @param bOpened true for an open cone/cylinder. An open shape has 0181 * no 'end caps' 0182 * @param positions Receives output triangles 0183 */ 0184 static void MakeCone(ai_real height,ai_real radius1, 0185 ai_real radius2,unsigned int tess, 0186 std::vector<aiVector3D>& positions,bool bOpen= false); 0187 0188 0189 // ---------------------------------------------------------------- 0190 /** @brief Generates a flat circle 0191 * 0192 * The circle is constructed in the planned formed by the x,z 0193 * axes of the cartesian coordinate system. 0194 * 0195 * @param radius Radius of the circle 0196 * @param tess Number of segments. 0197 * @param positions Receives output triangles. 0198 */ 0199 static void MakeCircle(ai_real radius, unsigned int tess, 0200 std::vector<aiVector3D>& positions); 0201 0202 }; 0203 } // ! Assimp 0204 0205 #endif // !! AI_STANDARD_SHAPES_H_INC
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|