internal void UpdateSettings(PostProcessLayer postProcessLayer, Camera camera)
        {
            ReplaceData(postProcessLayer);
            int       value               = postProcessLayer.volumeLayer.value;
            Transform volumeTrigger       = postProcessLayer.volumeTrigger;
            bool      flag                = volumeTrigger == null;
            Vector3   vector              = (!flag) ? volumeTrigger.position : Vector3.zero;
            List <PostProcessVolume> list = GrabVolumes(value);

            foreach (PostProcessVolume item in list)
            {
                if (item.enabled && !(item.profileRef == null) && !(item.weight <= 0f))
                {
                    List <PostProcessEffectSettings> settings = item.profileRef.settings;
                    if (item.isGlobal)
                    {
                        postProcessLayer.OverrideSettings(settings, Mathf.Clamp01(item.weight));
                    }
                    else if (!flag)
                    {
                        List <Collider> tempColliders = m_TempColliders;
                        item.GetComponents(tempColliders);
                        if (tempColliders.Count != 0)
                        {
                            float num = float.PositiveInfinity;
                            foreach (Collider item2 in tempColliders)
                            {
                                if (item2.enabled)
                                {
                                    Vector3 a            = item2.ClosestPoint(vector);
                                    float   sqrMagnitude = ((a - vector) / 2f).sqrMagnitude;
                                    if (sqrMagnitude < num)
                                    {
                                        num = sqrMagnitude;
                                    }
                                }
                            }
                            tempColliders.Clear();
                            float num2 = item.blendDistance * item.blendDistance;
                            if (!(num > num2))
                            {
                                float num3 = 1f;
                                if (num2 > 0f)
                                {
                                    num3 = 1f - num / num2;
                                }
                                postProcessLayer.OverrideSettings(settings, num3 * Mathf.Clamp01(item.weight));
                            }
                        }
                    }
                }
            }
        }
        internal void UpdateSettings(PostProcessLayer postProcessLayer)
        {
            // Reset to base state
            ReplaceData(postProcessLayer);

            // If no trigger is set, only global volumes will have influence
            var mask          = postProcessLayer.volumeLayer.value;
            var volumeTrigger = postProcessLayer.volumeTrigger;
            var onlyGlobal    = volumeTrigger == null;
            var triggerPos    = onlyGlobal ? Vector3.zero : volumeTrigger.position;

            // Sort the cached volume list(s) for the given layer mask if needed and return it
            var volumes = GrabVolumes(mask);

            // Traverse all volumes
            foreach (var volume in volumes)
            {
                // Skip disabled volumes and volumes without any data or weight
                if (!volume.enabled || volume.profileRef == null || volume.weight <= 0f)
                {
                    continue;
                }

                var settings = volume.profileRef.settings;

                // Global volume always have influence
                if (volume.isGlobal)
                {
                    postProcessLayer.OverrideSettings(settings, Mathf.Clamp01(volume.weight));
                    continue;
                }

                if (onlyGlobal)
                {
                    continue;
                }

                // If volume isn't global and has no collider, skip it as it's useless
                var colliders = m_TempColliders;
                volume.GetComponents(colliders);
                if (colliders.Count == 0)
                {
                    continue;
                }

                // Find closest distance to volume, 0 means it's inside it
                var closestDistanceSqr = float.PositiveInfinity;

                foreach (var collider in colliders)
                {
                    if (!collider.enabled)
                    {
                        continue;
                    }

                    var closestPoint = collider.ClosestPoint(triggerPos); // 5.6-only API
                    var d            = ((closestPoint - triggerPos) / 2f).sqrMagnitude;

                    if (d < closestDistanceSqr)
                    {
                        closestDistanceSqr = d;
                    }
                }

                colliders.Clear();
                var blendDistSqr = volume.blendDistance * volume.blendDistance;

                // Volume has no influence, ignore it
                // Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but
                //       we can't use a >= comparison as blendDistSqr could be set to 0 in which
                //       case volume would have total influence
                if (closestDistanceSqr > blendDistSqr)
                {
                    continue;
                }

                // Volume has influence
                var interpFactor = 1f;

                if (blendDistSqr > 0f)
                {
                    interpFactor = 1f - closestDistanceSqr / blendDistSqr;
                }

                // No need to clamp01 the interpolation factor as it'll always be in [0;1[ range
                postProcessLayer.OverrideSettings(settings, interpFactor * Mathf.Clamp01(volume.weight));
            }
        }
        internal void UpdateSettings(PostProcessLayer postProcessLayer)
        {
            // Reset to base state
            postProcessLayer.OverrideSettings(m_BaseSettings, 1f);

            // If no trigger is set, only global volumes will have influence
            int  mask          = postProcessLayer.volumeLayer.value;
            var  volumeTrigger = postProcessLayer.volumeTrigger;
            bool onlyGlobal    = volumeTrigger == null;
            var  triggerPos    = onlyGlobal ? Vector3.zero : volumeTrigger.position;

            for (int i = 0; i < k_MaxLayerCount; i++)
            {
                // Skip layers not in the mask
                if ((mask & (1 << i)) == 0)
                {
                    continue;
                }

                // Skip empty layers
                var volumes = m_Volumes[i];

                if (volumes == null)
                {
                    continue;
                }

                // Sort the volume list if needed
                if (m_SortNeeded[i])
                {
                    SortByPriority(volumes);
                    m_SortNeeded[i] = false;
                }

                // Traverse all volumes
                foreach (var volume in volumes)
                {
                    // Skip disabled volumes and volumes without any data or weight
                    if (!volume.enabled || volume.profileRef == null || volume.weight <= 0f)
                    {
                        continue;
                    }

                    var settings = volume.profileRef.settings;

                    // Global volume always have influence
                    if (volume.isGlobal)
                    {
                        postProcessLayer.OverrideSettings(settings, volume.weight);
                        continue;
                    }

                    if (onlyGlobal)
                    {
                        continue;
                    }

                    // If volume isn't global and has no collider, skip it as it's useless
                    var colliders = m_TempColliders;
                    volume.GetComponents(colliders);
                    if (colliders.Count == 0)
                    {
                        continue;
                    }

                    // Find closest distance to volume, 0 means it's inside it
                    float closestDistanceSqr = float.PositiveInfinity;

                    foreach (var collider in colliders)
                    {
                        if (!collider.enabled)
                        {
                            continue;
                        }

                        var closestPoint = collider.ClosestPoint(triggerPos); // 5.6-only API
                        var d            = ((closestPoint - triggerPos) / 2f).sqrMagnitude;

                        if (d < closestDistanceSqr)
                        {
                            closestDistanceSqr = d;
                        }
                    }

                    colliders.Clear();
                    float blendDistSqr = volume.blendDistance * volume.blendDistance;

                    // Volume has no influence, ignore it
                    // Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but
                    //       we can't use a >= comparison as blendDistSqr could be set to 0 in which
                    //       case volume would have total influence
                    if (closestDistanceSqr > blendDistSqr)
                    {
                        continue;
                    }

                    // Volume has influence
                    float interpFactor = 1f;

                    if (blendDistSqr > 0f)
                    {
                        interpFactor = 1f - (closestDistanceSqr / blendDistSqr);
                    }

                    // No need to clamp01 the interpolation factor as it'll always be in [0;1[ range
                    postProcessLayer.OverrideSettings(settings, interpFactor * volume.weight);
                }
            }
        }