diff --git a/code/Importer.cpp b/code/Importer.cpp index c6b9daf67..50ce016d5 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -768,6 +768,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) { BaseProcess* process = pimpl->mPostProcessingSteps[a]; + pimpl->mProgressHandler->UpdatePostProcess( a, pimpl->mPostProcessingSteps.size() ); if( process->IsActive( pFlags)) { if (profiler) { @@ -775,7 +776,6 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) } process->ExecuteOnScene ( this ); - pimpl->mProgressHandler->Update(); if (profiler) { profiler->EndRegion("postprocess"); @@ -803,6 +803,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) } #endif // ! DEBUG } + pimpl->mProgressHandler->UpdatePostProcess( pimpl->mPostProcessingSteps.size(), pimpl->mPostProcessingSteps.size() ); // update private scene flags if( pimpl->mScene ) diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index 31c746c59..7a4cec84f 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -88,6 +88,19 @@ public: virtual bool Update(float percentage = -1.f) = 0; + // ------------------------------------------------------------------- + /** @brief Progress callback for post-processing steps + * @param numberOfSteps The number of total post-processing + * steps + * @param currentStep The index of the current post-processing + * step that will run, or equal to numberOfSteps if all of + * them has finished. This number is always strictly monotone + * increasing, although not necessarily linearly. + * */ + virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { + float f = currentStep / (float)numberOfSteps; + Update( f * 0.5f + 0.5f ); + }; }; // !class ProgressHandler // ------------------------------------------------------------------------------------