UVAtlas icon indicating copy to clipboard operation
UVAtlas copied to clipboard

Parameter `callbackFrequency` seems to have no effect

Open lmorvan opened this issue 3 years ago • 2 comments

When calling UVAtlasCreate with a callback for a given mesh, the number of times the callback is called is always the same no matter callbackFrequency was given: about once per 1 ms.

Would it be a bug or something that I missed?

lmorvan avatar Aug 18 '21 13:08 lmorvan

The callbackFrequency implementation is a little odd in this codebase. It's implemented as a 0-1 scalar instead of as a time-based value:

// Call callback function per m_dwCallbackDelta steps
m_dwCallbackDelta = static_cast<size_t>(
            m_fCallbackFrequency * float(dwTaskWork) / fPercentOfAllTasks);
static const float UVATLAS_DEFAULT_CALLBACK_FREQUENCY = 0.0001f;

What values have you tried?

walbourn avatar Aug 18 '21 17:08 walbourn

I tried 0, 1, 0.5, 0.01. I also tried 25 but there is a check that returns a failure (something like bad argument) if this value is not between 0 and 1.

Reading the code, I understood that it is supposed to ensure that the callback is called each time callFrequency "percent" is added to the overall process "percentage". Which seems not to be the case.

lmorvan avatar Aug 19 '21 07:08 lmorvan