|
|
|||
File indexing completed on 2026-04-06 16:50:29
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 ProgressHandler.hpp 0043 * @brief Abstract base class 'ProgressHandler'. 0044 */ 0045 #pragma once 0046 #ifndef AI_PROGRESSHANDLER_H_INC 0047 #define AI_PROGRESSHANDLER_H_INC 0048 0049 #ifdef __GNUC__ 0050 # pragma GCC system_header 0051 #endif 0052 0053 #include <assimp/types.h> 0054 0055 namespace Assimp { 0056 0057 // ------------------------------------------------------------------------------------ 0058 /** @brief CPP-API: Abstract interface for custom progress report receivers. 0059 * 0060 * Each #Importer instance maintains its own #ProgressHandler. The default 0061 * implementation provided by Assimp doesn't do anything at all. */ 0062 class ASSIMP_API ProgressHandler 0063 #ifndef SWIG 0064 : public Intern::AllocateFromAssimpHeap 0065 #endif 0066 { 0067 protected: 0068 /// @brief Default constructor 0069 ProgressHandler () AI_NO_EXCEPT = default; 0070 0071 public: 0072 /// @brief Virtual destructor. 0073 virtual ~ProgressHandler () = default; 0074 0075 // ------------------------------------------------------------------- 0076 /** @brief Progress callback. 0077 * @param percentage An estimate of the current loading progress, 0078 * in percent. Or -1.f if such an estimate is not available. 0079 * 0080 * There are restriction on what you may do from within your 0081 * implementation of this method: no exceptions may be thrown and no 0082 * non-const #Importer methods may be called. It is 0083 * not generally possible to predict the number of callbacks 0084 * fired during a single import. 0085 * 0086 * @return Return false to abort loading at the next possible 0087 * occasion (loaders and Assimp are generally allowed to perform 0088 * all needed cleanup tasks prior to returning control to the 0089 * caller). If the loading is aborted, #Importer::ReadFile() 0090 * returns always nullptr. 0091 * */ 0092 virtual bool Update(float percentage = -1.f) = 0; 0093 0094 // ------------------------------------------------------------------- 0095 /** @brief Progress callback for file loading steps 0096 * @param numberOfSteps The number of total post-processing 0097 * steps 0098 * @param currentStep The index of the current post-processing 0099 * step that will run, or equal to numberOfSteps if all of 0100 * them has finished. This number is always strictly monotone 0101 * increasing, although not necessarily linearly. 0102 * 0103 * @note This is currently only used at the start and the end 0104 * of the file parsing. 0105 * */ 0106 virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { 0107 float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; 0108 Update( f * 0.5f ); 0109 } 0110 0111 // ------------------------------------------------------------------- 0112 /** @brief Progress callback for post-processing steps 0113 * @param numberOfSteps The number of total post-processing 0114 * steps 0115 * @param currentStep The index of the current post-processing 0116 * step that will run, or equal to numberOfSteps if all of 0117 * them has finished. This number is always strictly monotone 0118 * increasing, although not necessarily linearly. 0119 * */ 0120 virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { 0121 float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; 0122 Update( f * 0.5f + 0.5f ); 0123 } 0124 0125 0126 // ------------------------------------------------------------------- 0127 /** @brief Progress callback for export steps. 0128 * @param numberOfSteps The number of total processing 0129 * steps 0130 * @param currentStep The index of the current post-processing 0131 * step that will run, or equal to numberOfSteps if all of 0132 * them has finished. This number is always strictly monotone 0133 * increasing, although not necessarily linearly. 0134 * */ 0135 virtual void UpdateFileWrite(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { 0136 float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; 0137 Update(f * 0.5f); 0138 } 0139 }; // !class ProgressHandler 0140 0141 // ------------------------------------------------------------------------------------ 0142 0143 } // Namespace Assimp 0144 0145 #endif // AI_PROGRESSHANDLER_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 |
|