![]() |
|
|||
File indexing completed on 2025-02-21 09:30:10
0001 /** Helper class to construct a dummy mesh for file formats containing only motion data */ 0002 0003 /* 0004 Open Asset Import Library (assimp) 0005 ---------------------------------------------------------------------- 0006 0007 Copyright (c) 2006-2024, assimp team 0008 0009 All rights reserved. 0010 0011 Redistribution and use of this software in source and binary forms, 0012 with or without modification, are permitted provided that the 0013 following conditions are met: 0014 0015 * Redistributions of source code must retain the above 0016 copyright notice, this list of conditions and the 0017 following disclaimer. 0018 0019 * Redistributions in binary form must reproduce the above 0020 copyright notice, this list of conditions and the 0021 following disclaimer in the documentation and/or other 0022 materials provided with the distribution. 0023 0024 * Neither the name of the assimp team, nor the names of its 0025 contributors may be used to endorse or promote products 0026 derived from this software without specific prior 0027 written permission of the assimp team. 0028 0029 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0030 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0031 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0032 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0033 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0034 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0035 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0036 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0037 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0038 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0039 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0040 0041 ---------------------------------------------------------------------- 0042 */ 0043 0044 /** @file SkeletonMeshBuilder.h 0045 * Declares SkeletonMeshBuilder, a tiny utility to build dummy meshes 0046 * for animation skeletons. 0047 */ 0048 0049 #pragma once 0050 #ifndef AI_SKELETONMESHBUILDER_H_INC 0051 #define AI_SKELETONMESHBUILDER_H_INC 0052 0053 #ifdef __GNUC__ 0054 #pragma GCC system_header 0055 #endif 0056 0057 #include <assimp/mesh.h> 0058 #include <vector> 0059 0060 struct aiMaterial; 0061 struct aiScene; 0062 struct aiNode; 0063 0064 namespace Assimp { 0065 0066 // --------------------------------------------------------------------------- 0067 /** 0068 * This little helper class constructs a dummy mesh for a given scene 0069 * the resembles the node hierarchy. This is useful for file formats 0070 * that don't carry any mesh data but only animation data. 0071 */ 0072 class ASSIMP_API SkeletonMeshBuilder { 0073 public: 0074 // ------------------------------------------------------------------- 0075 /** The constructor processes the given scene and adds a mesh there. 0076 * 0077 * Does nothing if the scene already has mesh data. 0078 * @param pScene The scene for which a skeleton mesh should be constructed. 0079 * @param root The node to start with. nullptr is the scene root 0080 * @param bKnobsOnly Set this to true if you don't want the connectors 0081 * between the knobs representing the nodes. 0082 */ 0083 SkeletonMeshBuilder(aiScene *pScene, aiNode *root = nullptr, 0084 bool bKnobsOnly = false); 0085 0086 protected: 0087 // ------------------------------------------------------------------- 0088 /** Recursively builds a simple mesh representation for the given node 0089 * and also creates a joint for the node that affects this part of 0090 * the mesh. 0091 * @param pNode The node to build geometry for. 0092 */ 0093 void CreateGeometry(const aiNode *pNode); 0094 0095 // ------------------------------------------------------------------- 0096 /** Creates the mesh from the internally accumulated stuff and returns it. 0097 */ 0098 aiMesh *CreateMesh(); 0099 0100 // ------------------------------------------------------------------- 0101 /** Creates a dummy material and returns it. */ 0102 aiMaterial *CreateMaterial(); 0103 0104 private: 0105 /** space to assemble the mesh data: points */ 0106 std::vector<aiVector3D> mVertices; 0107 0108 /** faces */ 0109 struct Face { 0110 unsigned int mIndices[3]; 0111 Face(); 0112 Face(unsigned int p0, unsigned int p1, unsigned int p2) { 0113 mIndices[0] = p0; 0114 mIndices[1] = p1; 0115 mIndices[2] = p2; 0116 } 0117 }; 0118 std::vector<Face> mFaces; 0119 0120 /** bones */ 0121 std::vector<aiBone *> mBones; 0122 0123 bool mKnobsOnly; 0124 }; 0125 0126 } // end of namespace Assimp 0127 0128 #endif // AI_SKELETONMESHBUILDER_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 |
![]() ![]() |