public void GetMeshArrays(Mesh mesh, out Vector3[] meshVerts, out int[] meshTris) { //finding proper recent mesh data meshVerts = null; meshTris = null; if (recentMeshes.ContainsKey(mesh) && recentMeshes.GetVal1(mesh) == mesh.name) //if contains mesh and it's name has not changed (i.e. mesh itself has not changed) { meshVerts = recentMeshes.GetVal2(mesh); meshTris = recentMeshes.GetVal3(mesh); } //retrieving and saving current mesh data else { meshVerts = mesh.vertices; meshTris = mesh.triangles; recentMeshes.CheckAdd(mesh, mesh.name, meshVerts, meshTris, overwrite: true); } //flushing recent meshes if the number of meshes is too big (ansd adding current one) if (recentMeshes.Count > 20) { recentMeshes.Clear(); recentMeshes.Add(mesh, mesh.name, meshVerts, meshTris); } }
public static void GetProgresByTag(string tag, out float contained, out float calculated, out float ready) { if (profile) { Profiler.BeginSample("Get Progress Tag"); } DictTuple <string, bool, bool> dict = new DictTuple <string, bool, bool>(); int queueCount = queue.Count; contained = 0; calculated = 0; ready = 0; for (int i = 0; i < queueCount; i++) { ThreadWorker worker = queue[i]; if (worker.stage == Stage.stop || worker.stage == Stage.blank) { continue; } if (!worker.tag.Contains(tag)) { continue; } //contains if (!dict.ContainsKey(worker.tag)) { dict.Add(worker.tag, true, true); } //calculated TupleSet <bool, bool> tuple = dict[worker.tag]; if (worker.stage != Stage.applyEnqueued && worker.stage != Stage.coroutineEnqueued && worker.stage != Stage.coroutineRunning && worker.stage != Stage.ready) { tuple.item1 = false; tuple.item2 = false; dict[worker.tag] = tuple; } //ready if (worker.stage != Stage.ready) { tuple.item2 = false; dict[worker.tag] = tuple; } } //calculating total statistics contained = dict.Count; foreach (TupleSet <bool, bool> tuple in dict.Values()) { if (tuple.item1) { calculated++; } if (tuple.item2) { ready++; } } if (profile) { Profiler.EndSample(); } }