/// <summary>
    /// bake visible flag for one renderer.
    /// </summary>
    /// <param name="pvsManager">the PVS manager.</param>
    /// <param name="index">the renderer index.</param>
    /// <param name="progress">the baking progress.</param>
    public static bool BakeVisibleFlagForRenderer(PVSManager pvsManager, int index, float progress)
    {
//    if (EditorUtility.DisplayCancelableProgressBar("Backing", $"Renderer: {index}/{pvsManager.renderers.Count}", progress))
//    {
//      return false;
//    }

        var renderer     = pvsManager.renderers[index];
        var targetBounds = renderer.bounds;

        targetBounds.Expand(1e-5f);
        var targetPlanes = PVSManager.GetPlanesFromBounds(ref targetBounds);

        for (var cellIndexX = 0; cellIndexX < pvsManager.cachedCellCountX; ++cellIndexX)
        {
            if (EditorUtility.DisplayCancelableProgressBar("Backing", $"Renderer: {index}/{pvsManager.renderers.Count} Cell: {cellIndexX}/{pvsManager.cachedCellCountX}", progress))
            {
                return(false);
            }

            for (var cellIndexY = 0; cellIndexY < pvsManager.cachedCellCountY; ++cellIndexY)
            {
//        if (EditorUtility.DisplayCancelableProgressBar("Backing", $"Renderer: {index}/{pvsManager.renderers.Count} Cell: {cellIndexX}/{pvsManager.cachedCellCountX}, {cellIndexY}/{pvsManager.cachedCellCountY}", progress))
//        {
//          return false;
//        }

                for (var cellIndexZ = 0; cellIndexZ < pvsManager.cachedCellCountZ; ++cellIndexZ)
                {
//          if (EditorUtility.DisplayCancelableProgressBar("Backing", $"Renderer: {index}/{pvsManager.renderers.Count} Cell: {cellIndexX}/{pvsManager.cachedCellCountX}, {cellIndexY}/{pvsManager.cachedCellCountY}, {cellIndexZ}/{pvsManager.cachedCellCountZ}", progress))
//          {
//            return false;
//          }

                    var viewBounds = new Bounds(
                        pvsManager.worldBounds.min + new Vector3(
                            cellIndexX * pvsManager.cellSize.x + 0.5f * pvsManager.cellSize.x,
                            cellIndexY * pvsManager.cellSize.y + 0.5f * pvsManager.cellSize.y,
                            cellIndexZ * pvsManager.cellSize.z + 0.5f * pvsManager.cellSize.z),
                        pvsManager.cellSize);

                    // check visible.
                    var isVisible = false;
                    if (viewBounds.Intersects(targetBounds))
                    {
                        isVisible = true;
                    }
                    else
                    {
                        var viewPlanes = PVSManager.GetPlanesFromBounds(ref viewBounds);

                        // find view bounds and target bounds side face side planes.
                        foreach (var viewPlane in viewPlanes)
                        {
                            foreach (var targetPlane in targetPlanes)
                            {
                                if (!PVSManager.IsPlaneFacePlane(viewPlane, targetPlane))
                                {
                                    continue;
                                }

                                isVisible = pvsManager.RayTracingPlane2PlaneGPU(viewPlane, targetPlane);
                                if (isVisible)
                                {
                                    break;
                                }
                            }

                            if (isVisible)
                            {
                                break;
                            }
                        }
                    }

                    pvsManager.SetVisibleFlag(index, cellIndexX, cellIndexY, cellIndexZ, isVisible);
                }
            }
        }

        return(true);
    }