public static List <Brick> SubdivideCell(ProbeReferenceVolume.Volume cellVolume, ProbeSubdivisionContext subdivisionCtx, GPUSubdivisionContext ctx, List <(Renderer component, ProbeReferenceVolume.Volume volume)> renderers, List <(ProbeVolume component, ProbeReferenceVolume.Volume volume)> probeVolumes)
static IEnumerable <(ProbeReferenceVolume.Volume volume, Vector3 parentPosition)> SubdivideVolumeIntoSubVolume(GPUSubdivisionContext ctx, ProbeReferenceVolume.Volume volume) { volume.CalculateCenterAndSize(out var center, out var size); float maxBrickInSubCell = Mathf.Pow(3, k_MaxSubdivisionInSubCell); float subdivisionCount = ctx.maxBrickCountPerAxis / (float)ctx.maxBrickCountPerAxisInSubCell; var subVolumeSize = size / subdivisionCount; for (int x = 0; x < (int)subdivisionCount; x++) { for (int y = 0; y < (int)subdivisionCount; y++) { for (int z = 0; z < (int)subdivisionCount; z++) { var subVolume = new ProbeReferenceVolume.Volume() { corner = volume.corner + new Vector3(x * subVolumeSize.x, y * subVolumeSize.y, z * subVolumeSize.z), X = volume.X / subdivisionCount, Y = volume.Y / subdivisionCount, Z = volume.Z / subdivisionCount, maxSubdivisionMultiplier = volume.maxSubdivisionMultiplier, minSubdivisionMultiplier = volume.minSubdivisionMultiplier, }; var parentCellPosition = new Vector3(x, y, z); yield return(subVolume, parentCellPosition); } } } }