private IEnumerator CompileModels(RSM[] objects, float progressStep, Action <List <RSM.CompiledModel> > OnComplete) { /** * Calculate progress again because rsm objects * are way less than model descriptors and divide by 2 * beucase we still have the render loading */ float remainingProgress = 100 - Progress; float modelProgress = remainingProgress / objects.Length / 2; List <RSM.CompiledModel> models = new List <RSM.CompiledModel>(); for (int i = 0; i < objects.Length; i++) { var compiledModel = ModelLoader.Compile(objects[i]); models.Add(compiledModel); Progress += modelProgress; if (i % 5 == 0) { yield return(new WaitForEndOfFrame()); } } OnComplete(models); yield return(models); }
public void ThreadPoolCallback(object threadContext) { try { compiledModel = ModelLoader.Compile(_obj); } finally { if (Interlocked.Decrement(ref pendingCMThreads) == 0) { doneCMEvent.Set(); } } }