/// <summary>
        /// Forces the specified flags to on/off
        /// </summary>
        /// <param name="replacingFlags">The flags to replace</param>
        /// <param name="value">The forced value</param>
        /// <returns>The modified FrustumParametersEnum</returns>
        public static FrustumParametersEnum ReplaceFlags(this FrustumParametersEnum referenceFlags, FrustumParametersEnum replacingFlags, bool value)
        {
            FrustumParametersEnum newFlags = referenceFlags;

            if (value && !referenceFlags.HasFlags(replacingFlags) || !value && referenceFlags.HasFlags(replacingFlags))
            {
                newFlags = referenceFlags.ToggleFlags(replacingFlags);
            }

            return(newFlags);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Tells if the specified flags combinaision is found inside the parameters bitmask
 /// </summary>
 /// <param name="flags">A combinaison of flags</param>
 /// <returns>Is the flags combinaison found in the parameters bitmask</returns>
 public bool HasFlags(FrustumParametersEnum flags)
 {
     return(_frustumParameters.HasFlags(flags));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Recomputes the unique int relative to the combinaison of the different parameters
        /// </summary>
        /// <returns>A unique int relative to the combinaison of the different parameters</returns>
        public int ComputeFlags()
        {
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableOcclusionCulling, enableOcclusionCulling);

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableTemporalReprojection, enableTemporalReprojection && Aura.FrameId > 1 && !Mathf.Approximately(temporalReprojectionFactor, 0));

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableVolumes, enableVolumes && Aura.VolumesManager.HasVisibleVolumes);
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableVolumesNoiseMask, enableVolumesNoiseMask && _frustumParameters.HasFlags(FrustumParametersEnum.EnableVolumes));
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableVolumesTextureMask, enableVolumesTextureMask && _frustumParameters.HasFlags(FrustumParametersEnum.EnableVolumes) && Aura.VolumesManager.HasVolumeTexture);

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableDirectionalLights, enableDirectionalLights && Aura.LightsManager.DirectionalLightsManager.HasCandidateLights);
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableDirectionalLightsShadows, enableDirectionalLightsShadows && _frustumParameters.HasFlags(FrustumParametersEnum.EnableDirectionalLights) && Aura.LightsManager.DirectionalLightsManager.HasShadowCasters);
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.DirectionalLightsShadowsOneCascade, QualitySettings.shadowCascades == 1 && _frustumParameters.HasFlags(FrustumParametersEnum.EnableDirectionalLights));
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.DirectionalLightsShadowsTwoCascades, QualitySettings.shadowCascades == 2 && _frustumParameters.HasFlags(FrustumParametersEnum.EnableDirectionalLights));
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.DirectionalLightsShadowsFourCascades, QualitySettings.shadowCascades == 4 && _frustumParameters.HasFlags(FrustumParametersEnum.EnableDirectionalLights));

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableSpotLights, enableSpotLights && Aura.LightsManager.SpotLightsManager.HasVisibleLights);
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableSpotLightsShadows, enableSpotLightsShadows && _frustumParameters.HasFlags(FrustumParametersEnum.EnableSpotLights) && Aura.LightsManager.SpotLightsManager.HasShadowCasters);

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnablePointLights, enablePointLights && Aura.LightsManager.PointLightsManager.HasVisibleLights);
            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnablePointLightsShadows, enablePointLightsShadows && _frustumParameters.HasFlags(FrustumParametersEnum.EnablePointLights) && Aura.LightsManager.PointLightsManager.HasShadowCasters);

            _frustumParameters = _frustumParameters.ReplaceFlags(FrustumParametersEnum.EnableLightsCookies, enableLightsCookies && (_frustumParameters.HasFlags(FrustumParametersEnum.EnablePointLights) && Aura.LightsManager.PointLightsManager.HasCookieCasters || _frustumParameters.HasFlags(FrustumParametersEnum.EnableSpotLights) && Aura.LightsManager.SpotLightsManager.HasCookieCasters || _frustumParameters.HasFlags(FrustumParametersEnum.EnableDirectionalLights) && Aura.LightsManager.DirectionalLightsManager.HasCookieCasters));

            return(GetId());
        }