Exemple #1
0
        public static bool UpdateShaderFields(UnderMaterialOptions options, int mask)
        {
            var hashCode = options.GetHashCode();

            if (hashCode != CurrentHashCode || CurrentVersion != options.Version)
            {
                Accessor.SetGlobalValues(options, group => ShaderAccessor.FilterByMask(group, mask));
                CurrentHashCode = hashCode;
                CurrentVersion  = options.Version;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public void UpdateMaterial()
        {
            RegenerateResult();

            foreach (var lodQuality in lodQualitys)
            {
                lodQuality.Material.renderQueue = (int)ProjectSettings.Current.RenderQueue;

                ModeOptions.Accessor.Copy(lodQuality.ModeObject.Mode, lodQuality.Material);
                int mask = ModeOptions.Accessor.GetEnabledKeywords(lodQuality.ModeObject.Mode);
                mask |= (int)OceanMode.Tessellation;
                MaterialOptions.Accessor.CopyWithoutKeywords(Result, lodQuality.Material, group => ShaderAccessor.FilterByMask(group, mask));

                if (lodQuality.MarkMaterial != null)
                {
                    mask = (int)(WaveOptions.WaveAll | OceanMode.Tessellation);
                    ModeOptions.Accessor.Copy(lodQuality.ModeObject.Mode, lodQuality.MarkMaterial, group => ShaderAccessor.FilterByMask(group, mask));
                    MaterialOptions.Accessor.CopyWithoutKeywords(Result, lodQuality.MarkMaterial, group => ShaderAccessor.FilterByMask(group, mask));
                }
            }
        }