MeshLoaderJob ExtractJob() { lock (jobs.SyncRoot) { if (jobs.Count > 0) { MeshLoaderJob job = (MeshLoaderJob)jobs[0]; foreach (MeshLoaderJob j in jobs) { if (j.priority > job.priority) { job = j; } } jobs.Remove(job); return(job); } return(null); } }
public Mesh CreateMesh(FileInfo fileInfo, IPointCloudManager manager, float priority) { if (!jobs.ContainsKey(fileInfo.FullName)) { MeshLoaderJob job = jobPool.GetInstance(); if (job != null) { jobs[fileInfo.FullName] = job; job.AsynMeshLoading(fileInfo, manager, thread, priority); } } else { MeshLoaderJob job = jobs[fileInfo.FullName]; if (job.IsDone) { Mesh mesh = meshPool.GetInstance(); if (mesh != null) { //Debug.Log("Remaining Meshes: " + meshPool.remaining); job.LoadMeshData(mesh); if (mesh != null) { jobs.Remove(fileInfo.FullName); jobPool.ReleaseInstance(job); } return(mesh); } } else { //Changing priority if not finished job.priority = priority; } } return(null); }