Commit Graph

1 Commits (fdfb6e0660985a4d367b443ea4bb147906e675d0)

Author SHA1 Message Date
Jan Krassnigg 1e93280f47 Infrastructure for reporting progress
This commit adds two classes:
* ProgressTracker
* ProgressScope

The first is for users to implement, and to instantiate when they desire
to get informed about the overall progress.

The second is to be added to all functions that may take a considerable
amount of time, such that they can report back how far along they are.

These are much more convenient to use than the existing ProgressHandler.
ProgressScope is designed such that it only requires "local knowledge"
about upcoming and finished work. Scopes are nested and combined to
form the final global progress.

The active ProgressTracker is stored in a thread_local pointer.
This is a consicius decision since in assimp there is often no 'context'
passed through. The ProgressTracker may be needed anywhere, and it would
be tedious and a huge change to pass it through to every function.
Therefore, using a thread_local variable makes it accessible everywhere,
without a major interface change. Since assimmp is single-threaded,
but may be run in parallel on multiple threads, a thread_local is a
good trade-off, in my opinion.

This change only adds few uses of ProgressScope, to generally show how
it would be used. Also for our use cases these where the most pressing
places to add progress reporting, so this already covers loading from FBX
files pretty well.
2023-08-01 14:06:12 +02:00