public void Execute(int index) { BoundingSphereInfo boundingSphereInfo = BoundingSphereInfoList[index]; boundingSphereInfo.BoundingSphere.position += FloatingOriginOffset; if (boundingSphereInfo.Enabled == 0) { return; } boundingSphereInfo.Visibility = NoFrustumCulling ? 1 : SphereInFrustum(boundingSphereInfo.BoundingSphere); float distance = math.distance(boundingSphereInfo.BoundingSphere.position, DistanceReferencePoint); boundingSphereInfo.CurrentDistanceBand = -1; for (int i = 0; i <= DistancesList.Length - 1; i++) { if (distance < DistancesList[i]) { boundingSphereInfo.CurrentDistanceBand = i; break; } } //TODO set all invisible bounding spheres within distance band 1 to visible with currentDistanceband = 1. For shadow culling if (AddShadowCells && !NoFrustumCulling) { if (boundingSphereInfo.Visibility == -1 && boundingSphereInfo.CurrentDistanceBand >= 0) { boundingSphereInfo.Visibility = 1; boundingSphereInfo.CurrentDistanceBand = 1; } } //changes for collider system if (boundingSphereInfo.CurrentDistanceBand == -1) { boundingSphereInfo.Visibility = -1; } boundingSphereInfo.BoundingSphere.position -= FloatingOriginOffset; BoundingSphereInfoList[index] = boundingSphereInfo; }
public void ProcessDistanceBandEvents() { for (int i = 0; i <= _distanceBandEventList.Length - 1; i++) { int index = _distanceBandEventList[i]; BoundingSphereInfo boundingSphereInfo = BundingSphereInfoList[index]; if (OnDistanceBandStateChanged != null) { JobCullingGroupEvent evt = new JobCullingGroupEvent { IsVisible = boundingSphereInfo.Visibility == (int)BoundingSphereVisibility.Visible, Index = index, CurrentDistanceBand = boundingSphereInfo.CurrentDistanceBand, PreviousDistanceBand = boundingSphereInfo.PreviousDistanceBand }; OnDistanceBandStateChanged(evt); } boundingSphereInfo.PreviousDistanceBand = boundingSphereInfo.CurrentDistanceBand; BundingSphereInfoList[index] = boundingSphereInfo; } }