public void ThreadBuildTransExec() { surfExtractorTrans.Init(); List <IntVector4> locTransPosList = new List <IntVector4>(); List <VFVoxelChunkData> locTransChunkList = new List <VFVoxelChunkData>(); while (bTransVoxelEnabled) { if (curStatus == ETransBuildStatus.Status_ToBuild) { locTransPosList = transRebuildList.Keys.ToList(); locTransChunkList = transRebuildList.Values.ToList(); for (int i = 0; i < locTransChunkList.Count; i++) { VFVoxelChunkData cdata = locTransChunkList[i]; //if(cdata.LOD != 0) continue; if (cdata.LOD == LODOctreeMan._maxLod || null == (System.Object)cdata.ChunkGo) { continue; } int oldFaceMask = null == (System.Object)cdata.ChunkGo.TransvoxelGo ? 0 : cdata.ChunkGo.TransvoxelGo._faceMask; int faceMask = 0; int curLod = cdata.LOD; int posMask = (-1) << (curLod + 1); for (int dirIdx = 0; dirIdx < Transvoxel.Lengyel.Tables.TransitionFaceDir.Length; dirIdx++) { IntVector3 unitOfs = Transvoxel.Lengyel.Tables.TransitionFaceDir[dirIdx]; IntVector4 nearLow = new IntVector4((cdata.ChunkPosLod.x + (unitOfs.x << curLod)) & posMask, (cdata.ChunkPosLod.y + (unitOfs.y << curLod)) & posMask, (cdata.ChunkPosLod.z + (unitOfs.z << curLod)) & posMask, curLod + 1); if (locTransPosList.Contains(nearLow)) { faceMask |= 1 << dirIdx; } } if (faceMask == oldFaceMask) { continue; } surfExtractorTrans.AddSurfExtractReq(new SurfExtractReqTrans(faceMask, cdata)); } surfExtractorTrans.Exec(); curStatus = ETransBuildStatus.Status_FinBuild; } System.Threading.Thread.Sleep(16); } curStatus = ETransBuildStatus.Status_Idle; }
public static void CheckGenSurfExtractor() { // Init indice s_indiceMax = new int[SurfExtractorsMan.c_vertsCntMax]; // max number of vertices in an unity mesh for (int i = 0; i < SurfExtractorsMan.c_vertsCntMax; i++) { s_indiceMax [i] = i; } s_indice4Pool = new int[SurfExtractorsMan.c_vertsCnt4Pool]; Array.Copy(s_indiceMax, s_indice4Pool, SurfExtractorsMan.c_vertsCnt4Pool); // Init extractor if (_vxSurfOpt != null && _vxSurfOpt.CompareTo(oclManager.CurOclOpt) == 0) { _vxSurfExtractor.Reset(); } else { if (_vxSurfExtractor != null) { _vxSurfExtractor.CleanUp(); } #if UNITY_EDITOR oclManager.CurOclOpt = oclManager.OclOptionList[0]; //oclManager.CurOclOpt = "aa"; //oclManager.CurOclOpt = "OpenCL|NVIDIA CUDA |GeForce GTX 560".Replace(' ', '_'); //oclManager.CurOclOpt = "OpenCL|Intel(R) OpenCL | Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz".Replace(' ', '_'); #endif oclManager.InitOclFromOpt(); if (oclManager.ActiveOclMan != null) { _vxSurfExtractor = new SurfExtractorOclMC(); _vxSurfExtractor.Init(); } else { _vxSurfExtractor = new SurfExtractorCpuMC(); _vxSurfExtractor.Init(); } _vxSurfOpt = string.Copy(oclManager.CurOclOpt); } if (_b45BuildSurfExtractor != null) { _b45BuildSurfExtractor.CleanUp(); } _b45BuildSurfExtractor = new SurfExtractorCpuB45(); _b45BuildSurfExtractor.Init(); }