public void RetrieveVisibleMesh(Plane[] planes, Vector3 viewCenter, float[] lodPolicy, MTArray <uint> visible) { if (GeometryUtility.TestPlanesAABB(planes, Bound)) { if (mSubNode == null) { float distance = Vector3.Distance(viewCenter, Bound.center); for (uint lod = 0; lod < lodPolicy.Length; ++lod) { if (distance <= lodPolicy[lod]) { uint patchId = (uint)MeshID; patchId <<= 2; patchId |= lod; visible.Add(patchId); break; } } } else { for (int i = 0; i < 4; ++i) { mSubNode[i].RetrieveVisibleMesh(planes, viewCenter, lodPolicy, visible); } } } }
public void GetVisibleMesh(Plane[] planes, Vector3 viewCenter, float[] lodPolicy, MTArray <uint> visible) { //TODO 原理是只有这个块完全在视野内 在会显示 有问题 需要只露出一点点就显示 if (GeometryUtility.TestPlanesAABB(planes, Bound)) { if (m_SubNodes == null) { float distance = Vector3.Distance(viewCenter, Bound.center); for (uint lod = 0; lod < lodPolicy.Length; ++lod) { if (distance <= lodPolicy[lod]) { uint patchId = (uint)MeshID; patchId <<= 2; patchId |= lod; visible.Add(patchId); break; } } } else { for (int i = 0; i < 4; ++i)//递归一下 { m_SubNodes[i].GetVisibleMesh(planes, viewCenter, lodPolicy, visible); } } } }