void Start() { List <ILODNodeDataMan> lodNodeDataMans = new List <ILODNodeDataMan> (); if (VFVoxelTerrain.self != null) { lodNodeDataMans.Add(VFVoxelTerrain.self); lodNodeDataMans.Add(VFVoxelWater.self); } if (Block45Man.self != null) { lodNodeDataMans.Add(Block45Man.self); } _lstActDependences.Add(SceneChunkDependence.Instance); _lstActDependences.Add(new SceneStaticObjDependence(_lstInactive)); LODOctreeMan.ResetRootChunkCount(); //(6+2*terLv,6,6+2*terLv); #if UNITY_EDITOR LoadLodDesc(); #endif int lodRefreshThreshold = 1; if (MaxLod > 3) { Debug.Log("[LOD]Too many levels"); MaxLod = 3; } //MaxLod = 3; //VFVoxelTerrain.MapDataPath_Zip = GameConfig.PEDataPath + GameConfig.MapDataDir_Zip + "/"; _lodMan = new LODOctreeMan(lodNodeDataMans.ToArray(), MaxLod, lodRefreshThreshold, PETools.PEUtil.MainCamTransform); }
void OnDestroy() { SceneChunkDependence.Instance.Reset(); if (_lodMan != null) { _lodMan.ReqDestroy(); _lodMan = null; } self = null; }
public LODOctree(LODOctreeMan man, int maxlod, IntVector3 idxPos, IntVector3 sideLen) { _parentMan = man; //_maxLOD = maxlod; //_sideLen = sideLen; _idxPos = idxPos; _pos = idxPos * sideLen; _root = new LODOctreeNode(null, maxlod, (int)LODOctreeMan.InitPos.x, (int)LODOctreeMan.InitPos.y, (int)LODOctreeMan.InitPos.z); // this pos can cause root to reposition. _rootHalfLen = LODOctreeNode._halfLens[_root.Lod]; _rootCenter = _root.Center; }
void LoadLodDesc() { try{ TerrainLodDescPaser.LoadTerLodDesc("TerrainLodDesc"); } catch { Debug.Log("TerrainLodDesc not found."); } if (TerrainLodDescPaser.terLodDesc != null) { LODOctreeMan.ResetRootChunkCount(TerrainLodDescPaser.terLodDesc.x, TerrainLodDescPaser.terLodDesc.y, TerrainLodDescPaser.terLodDesc.z); MaxLod = TerrainLodDescPaser.terLodDesc.lod; } }