![]() |
|
|||
File indexing completed on 2025-02-21 09:30:10
0001 /* 0002 Open Asset Import Library (assimp) 0003 ---------------------------------------------------------------------- 0004 0005 Copyright (c) 2006-2024, assimp team 0006 0007 0008 All rights reserved. 0009 0010 Redistribution and use of this software in source and binary forms, 0011 with or without modification, are permitted provided that the 0012 following conditions are met: 0013 0014 * Redistributions of source code must retain the above 0015 copyright notice, this list of conditions and the 0016 following disclaimer. 0017 0018 * Redistributions in binary form must reproduce the above 0019 copyright notice, this list of conditions and the 0020 following disclaimer in the documentation and/or other 0021 materials provided with the distribution. 0022 0023 * Neither the name of the assimp team, nor the names of its 0024 contributors may be used to endorse or promote products 0025 derived from this software without specific prior 0026 written permission of the assimp team. 0027 0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0039 0040 ---------------------------------------------------------------------- 0041 */ 0042 0043 /** @file Declares a helper class, "StandardShapes" which generates 0044 * vertices for standard shapes, such as cylinders, cones, spheres .. 0045 */ 0046 #pragma once 0047 #ifndef AI_STANDARD_SHAPES_H_INC 0048 #define AI_STANDARD_SHAPES_H_INC 0049 0050 #ifdef __GNUC__ 0051 # pragma GCC system_header 0052 #endif 0053 0054 #include <assimp/vector3.h> 0055 #include <stddef.h> 0056 #include <vector> 0057 0058 struct aiMesh; 0059 0060 namespace Assimp { 0061 0062 // --------------------------------------------------------------------------- 0063 /** \brief Helper class to generate vertex buffers for standard geometric 0064 * shapes, such as cylinders, cones, boxes, spheres, elipsoids ... . 0065 */ 0066 class ASSIMP_API StandardShapes 0067 { 0068 // class cannot be instanced 0069 StandardShapes() {} 0070 0071 public: 0072 0073 0074 // ---------------------------------------------------------------- 0075 /** Generates a mesh from an array of vertex positions. 0076 * 0077 * @param positions List of vertex positions 0078 * @param numIndices Number of indices per primitive 0079 * @return Output mesh 0080 */ 0081 static aiMesh* MakeMesh(const std::vector<aiVector3D>& positions, 0082 unsigned int numIndices); 0083 0084 0085 static aiMesh* MakeMesh ( unsigned int (*GenerateFunc) 0086 (std::vector<aiVector3D>&)); 0087 0088 static aiMesh* MakeMesh ( unsigned int (*GenerateFunc) 0089 (std::vector<aiVector3D>&, bool)); 0090 0091 static aiMesh* MakeMesh ( unsigned int n, void (*GenerateFunc) 0092 (unsigned int,std::vector<aiVector3D>&)); 0093 0094 // ---------------------------------------------------------------- 0095 /** @brief Generates a hexahedron (cube) 0096 * 0097 * Hexahedrons can be scaled on all axes. 0098 * @param positions Receives output triangles. 0099 * @param polygons If you pass true here quads will be returned 0100 * @return Number of vertices per face 0101 */ 0102 static unsigned int MakeHexahedron( 0103 std::vector<aiVector3D>& positions, 0104 bool polygons = false); 0105 0106 // ---------------------------------------------------------------- 0107 /** @brief Generates an icosahedron 0108 * 0109 * @param positions Receives output triangles. 0110 * @return Number of vertices per face 0111 */ 0112 static unsigned int MakeIcosahedron( 0113 std::vector<aiVector3D>& positions); 0114 0115 0116 // ---------------------------------------------------------------- 0117 /** @brief Generates a dodecahedron 0118 * 0119 * @param positions Receives output triangles 0120 * @param polygons If you pass true here pentagons will be returned 0121 * @return Number of vertices per face 0122 */ 0123 static unsigned int MakeDodecahedron( 0124 std::vector<aiVector3D>& positions, 0125 bool polygons = false); 0126 0127 0128 // ---------------------------------------------------------------- 0129 /** @brief Generates an octahedron 0130 * 0131 * @param positions Receives output triangles. 0132 * @return Number of vertices per face 0133 */ 0134 static unsigned int MakeOctahedron( 0135 std::vector<aiVector3D>& positions); 0136 0137 0138 // ---------------------------------------------------------------- 0139 /** @brief Generates a tetrahedron 0140 * 0141 * @param positions Receives output triangles. 0142 * @return Number of vertices per face 0143 */ 0144 static unsigned int MakeTetrahedron( 0145 std::vector<aiVector3D>& positions); 0146 0147 0148 0149 // ---------------------------------------------------------------- 0150 /** @brief Generates a sphere 0151 * 0152 * @param tess Number of subdivions - 0 generates a octahedron 0153 * @param positions Receives output triangles. 0154 */ 0155 static void MakeSphere(unsigned int tess, 0156 std::vector<aiVector3D>& positions); 0157 0158 0159 // ---------------------------------------------------------------- 0160 /** @brief Generates a cone or a cylinder, either open or closed. 0161 * 0162 * @code 0163 * 0164 * |-----| <- radius 1 0165 * 0166 * __x__ <- ] ^ 0167 * / \ | height | 0168 * / \ | Y 0169 * / \ | 0170 * / \ | 0171 * /______x______\ <- ] <- end cap 0172 * 0173 * |-------------| <- radius 2 0174 * 0175 * @endcode 0176 * 0177 * @param height Height of the cone 0178 * @param radius1 First radius 0179 * @param radius2 Second radius 0180 * @param tess Number of triangles. 0181 * @param bOpened true for an open cone/cylinder. An open shape has 0182 * no 'end caps' 0183 * @param positions Receives output triangles 0184 */ 0185 static void MakeCone(ai_real height,ai_real radius1, 0186 ai_real radius2,unsigned int tess, 0187 std::vector<aiVector3D>& positions,bool bOpen= false); 0188 0189 0190 // ---------------------------------------------------------------- 0191 /** @brief Generates a flat circle 0192 * 0193 * The circle is constructed in the planned formed by the x,z 0194 * axes of the cartesian coordinate system. 0195 * 0196 * @param radius Radius of the circle 0197 * @param tess Number of segments. 0198 * @param positions Receives output triangles. 0199 */ 0200 static void MakeCircle(ai_real radius, unsigned int tess, 0201 std::vector<aiVector3D>& positions); 0202 0203 }; 0204 } // ! Assimp 0205 0206 #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 |
![]() ![]() |