private void modelInitReloadAllFrameByIndex(int indexFrame) { int min, max = 0; int half = GlobalVariableBackground.Instance.modelCacheCount / 2; if (indexFrame - half < 0) { min = 0; max = GlobalVariableBackground.Instance.modelCacheCount - 1; } else if (indexFrame + half > vtkAllFrame.FileCount) { min = vtkAllFrame.FileCount - 1 - GlobalVariableBackground.Instance.modelCacheCount; max = vtkAllFrame.FileCount - 1; } else { min = indexFrame - half; max = indexFrame + half; } for (int i = min; i <= max; i++) { int childIndex = i % GlobalVariableBackground.Instance.modelCacheCount; modelFrameManager modelFrameManager = transform.GetChild(childIndex).GetComponent <modelFrameManager>(); if (modelFrameManager == null) { transform.GetChild(childIndex).gameObject.AddComponent <modelFrameManager>(); modelFrameManager.vtkframe = new VTK_Frame(); modelFrameManager.isCollider = vtkAllFrame.loadFile.dataType == Enums.DataType.Default; } else { if (modelFrameManager.isCutModelGO) { //transform.GetChild(i) 里面含有切割生成的对象 continue; } } VTK_Frame vtkframe = modelFrameManager.vtkframe; vtkframe.go = transform.GetChild(childIndex).gameObject; Others.ThreadLoadFilePack pack = new Others.ThreadLoadFilePack(); pack.vtkFrame = vtkframe; pack.vtkAllFrame = vtkAllFrame; DirectoryInfo folder = new DirectoryInfo(vtkAllFrame.loadFile.FileDir); FileInfo[] fileinfoArray; fileinfoArray = folder.GetFiles("*.qf"); Array.Sort(fileinfoArray, new FileNameSort()); //填充 线程数据包-》单一文件 pack.fileAddres = fileinfoArray[i]; vtkframe.selfFrameIndex = i; VTKCManager m = new VTKCManager(); vtkframe.timeStartLession = DateTime.Now; if (vtkAllFrame.modelState.isSmooth && vtkAllFrame.loadFile.dataType == Enums.DataType.Water) { Others.ThreadSmoothModePack packsm = new Others.ThreadSmoothModePack(); packsm.fileAddres = pack.fileAddres; packsm.smoothCount = 20; packsm.vtkAllFrame = pack.vtkAllFrame; packsm.vtkFrame = pack.vtkFrame; m.SmoothDispose(packsm); //ThreadPool.QueueUserWorkItem(new WaitCallback(m.SmoothDispose), packsm as object); //Thread t = new Thread(m.SmoothDispose); //t.IsBackground = true; //t.Start(packsm); } else { ThreadPool.QueueUserWorkItem(new WaitCallback(m.DisposeData), pack as object); } } }