ActiveTextureManagement.TexInfo.SetScalingParams C# (CSharp) Method

SetScalingParams() public method

public SetScalingParams ( int scale, int maxSize, int minSize ) : void
scale int
maxSize int
minSize int
return void
        public void SetScalingParams(int scale, int maxSize, int minSize)
        {
            this.scale = scale;
            this.maxSize = maxSize;
            this.minSize = minSize;
        }

Usage Example

        static public TextureInfoWrapper UpdateTexture(TexInfo texture)
        {
            string     overrideName    = overridesList.Find(n => texture.name.Length == Regex.Match(texture.name, n).Length);
            bool       mipmaps         = true;
            bool       compress        = texture.isNormalMap ? false : true;
            int        scale           = 1;
            int        maxSize         = 0;
            int        minSize         = 64;
            FilterMode filterMode      = FilterMode.Bilinear;
            bool       makeNotReadable = false;

            if (foldersList.Exists(n => texture.name.StartsWith(n)))
            {
                if (texture.isNormalMap)
                {
                    mipmaps  = DatabaseLoaderTexture_ATM.config_mipmaps_normals;
                    compress = DatabaseLoaderTexture_ATM.config_compress_normals;
                    scale    = DatabaseLoaderTexture_ATM.config_scale_normals;
                    maxSize  = DatabaseLoaderTexture_ATM.config_max_size_normals;
                    minSize  = DatabaseLoaderTexture_ATM.config_min_size_normals;
                }
                else
                {
                    mipmaps  = DatabaseLoaderTexture_ATM.config_mipmaps;
                    compress = DatabaseLoaderTexture_ATM.config_compress;
                    scale    = DatabaseLoaderTexture_ATM.config_scale;
                    maxSize  = DatabaseLoaderTexture_ATM.config_max_size;
                    minSize  = DatabaseLoaderTexture_ATM.config_min_size;
                }
                filterMode      = config_filter_mode;
                makeNotReadable = config_make_not_readable;

                if (overrideName != null)
                {
                    ConfigNode overrideNode            = overrides.GetNode(overrideName);
                    String     normalString            = texture.isNormalMap ? "_normals" : "";
                    String     mipmapsString           = overrideNode.GetValue("mipmaps" + normalString);
                    String     compressString          = overrideNode.GetValue("compress" + normalString);
                    String     scaleString             = overrideNode.GetValue("scale" + normalString);
                    String     max_sizeString          = overrideNode.GetValue("max_size" + normalString);
                    String     min_sizeString          = overrideNode.GetValue("min_size" + normalString);
                    String     filter_modeString       = overrideNode.GetValue("filter_mode");
                    String     make_not_readableString = overrideNode.GetValue("make_not_readable");

                    if (mipmapsString != null)
                    {
                        bool.TryParse(mipmapsString, out mipmaps);
                    }
                    if (compressString != null)
                    {
                        bool.TryParse(compressString, out compress);
                    }
                    if (scaleString != null)
                    {
                        int.TryParse(scaleString, out scale);
                    }
                    if (filter_modeString != null)
                    {
                        try
                        {
                            filterMode = (FilterMode)Enum.Parse(typeof(FilterMode), filter_modeString);
                        }
                        catch
                        {
                            filterMode = config_filter_mode;
                        }
                    }
                    if (make_not_readableString != null)
                    {
                        bool.TryParse(make_not_readableString, out makeNotReadable);
                    }
                    if (max_sizeString != null)
                    {
                        int.TryParse(max_sizeString, out maxSize);
                    }
                    if (min_sizeString != null)
                    {
                        int.TryParse(min_sizeString, out minSize);
                    }
                }
            }
            texture.SetScalingParams(scale, maxSize, minSize);
            texture.makeNotReadable = makeNotReadable && !readableList.Contains(texture.name);
            TextureInfoWrapper ret = CacheController.FetchCacheTexture(texture, compress, mipmaps);

            ret.texture.filterMode = filterMode;
            return(ret);
        }
All Usage Examples Of ActiveTextureManagement.TexInfo::SetScalingParams