Split off postprocessing progress

pull/326/head
Gargaj 2014-08-04 23:57:08 +02:00
parent 5d861a8250
commit dfe1f03e5b
2 changed files with 15 additions and 1 deletions

View File

@ -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 )

View File

@ -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
// ------------------------------------------------------------------------------------