public void DoWork() { while (true) { MyVoxelPrecalcTaskItem newTask; if (MyVoxelPrecalc.Tasks.TryDequeue(out newTask)) { // If there is task, then calculate it m_task.Precalc(newTask); } else { break; } } }
// Precalculate voxel cell into cache (makes triangles and vertex buffer from voxels) // Doesn't use threads, just main thread. Use when you don't want to precalculate many cells in parallel. public static void PrecalcImmediatelly(MyVoxelPrecalcTaskItem task) { m_singleCoreTask.Precalc(task); }