1 /* 2 Open Asset Import Library (assimp) 3 ---------------------------------------------------------------------- 4 5 Copyright (c) 2006-2021, assimp team 6 7 8 All rights reserved. 9 10 Redistribution and use of this software in source and binary forms, 11 with or without modification, are permitted provided that the 12 following conditions are met: 13 14 * Redistributions of source code must retain the above 15 copyright notice, this list of conditions and the 16 following disclaimer. 17 18 * Redistributions in binary form must reproduce the above 19 copyright notice, this list of conditions and the 20 following disclaimer in the documentation and/or other 21 materials provided with the distribution. 22 23 * Neither the name of the assimp team, nor the names of its 24 contributors may be used to endorse or promote products 25 derived from this software without specific prior 26 written permission of the assimp team. 27 28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 40 ---------------------------------------------------------------------- 41 */ 42 43 /** @file Defines a post processing step to search all meshes for 44 degenerated faces */ 45 #ifndef AI_SCENE_PREPROCESSOR_H_INC 46 #define AI_SCENE_PREPROCESSOR_H_INC 47 48 #include <assimp/defs.h> 49 #include <stddef.h> 50 51 struct aiScene; 52 struct aiAnimation; 53 struct aiMesh; 54 55 class ScenePreprocessorTest; 56 namespace Assimp { 57 58 // ---------------------------------------------------------------------------------- 59 /** ScenePreprocessor: Preprocess a scene before any post-processing 60 * steps are executed. 61 * 62 * The step computes data that needn't necessarily be provided by the 63 * importer, such as aiMesh::mPrimitiveTypes. 64 */ 65 // ---------------------------------------------------------------------------------- 66 class ASSIMP_API ScenePreprocessor { 67 // Make ourselves a friend of the corresponding test unit. 68 friend class ::ScenePreprocessorTest; 69 70 public: 71 // ---------------------------------------------------------------- 72 /** Default c'tpr. Use SetScene() to assign a scene to the object. 73 */ ScenePreprocessor()74 ScenePreprocessor() : 75 scene(nullptr) {} 76 77 /** Constructs the object and assigns a specific scene to it 78 */ ScenePreprocessor(aiScene * _scene)79 ScenePreprocessor(aiScene *_scene) : 80 scene(_scene) {} 81 82 // ---------------------------------------------------------------- 83 /** Assign a (new) scene to the object. 84 * 85 * One 'SceneProcessor' can be used for multiple scenes. 86 * Call ProcessScene to have the scene preprocessed. 87 * @param sc Scene to be processed. 88 */ SetScene(aiScene * sc)89 void SetScene(aiScene *sc) { 90 scene = sc; 91 } 92 93 // ---------------------------------------------------------------- 94 /** Preprocess the current scene 95 */ 96 void ProcessScene(); 97 98 protected: 99 // ---------------------------------------------------------------- 100 /** Preprocess an animation in the scene 101 * @param anim Anim to be preprocessed. 102 */ 103 void ProcessAnimation(aiAnimation *anim); 104 105 // ---------------------------------------------------------------- 106 /** Preprocess a mesh in the scene 107 * @param mesh Mesh to be preprocessed. 108 */ 109 void ProcessMesh(aiMesh *mesh); 110 111 protected: 112 //! Scene we're currently working on 113 aiScene *scene; 114 }; 115 116 } // namespace Assimp 117 118 #endif // include guard 119