Esempio n. 1
0
            // if no file texture can be loaded, the function will return false and default value in parameters
            bool GetCorrectedFileTextureParams(out MyFileTextureParams parameters)
            {
                //parameters = new MyFileTextureParams();
                foreach (string filepath in m_listSubresourceFilenames)
                {
                    if (MyFileTextureParamsManager.LoadFromFile(filepath, out parameters))
                    {
                        if (MyCompilationSymbols.ReinterpretFormatsStoredInFiles)
                        {
                            if (m_type != MyFileTextureEnum.NORMALMAP_GLOSS)
                            {
                                parameters.Format = MyResourceUtils.MakeSrgb(parameters.Format);
                            }
                        }

                        int skipMipmaps = 0;
                        if (m_type != MyFileTextureEnum.GUI && m_type != MyFileTextureEnum.GPUPARTICLES)
                        {
                            skipMipmaps = MyRender11.RenderSettings.TextureQuality.MipmapsToSkip(parameters.Resolution.X, parameters.Resolution.Y);
                        }

                        if (parameters.Mipmaps > 1)
                        {
                            parameters.Mipmaps     -= skipMipmaps;
                            parameters.Resolution.X = MyResourceUtils.GetMipmapSize(parameters.Resolution.X, skipMipmaps);
                            parameters.Resolution.Y = MyResourceUtils.GetMipmapSize(parameters.Resolution.Y, skipMipmaps);
                        }
                        return(true);
                    }
                }
                parameters.Format     = m_recoverySystem.FormatBytePattern;
                parameters.Mipmaps    = 3;
                parameters.Resolution = new Vector2I(4, 4);
                parameters.ArraySize  = 1;
                return(false);
            }
            // if no file texture can be loaded, the function will return false and default value in parameters
            bool GetCorrectedFileTextureParams(out MyFileTextureParams parameters)
            {
                //parameters = new MyFileTextureParams();
                foreach (string filepath in m_listSubresourceFilenames)
                {
                    if (MyFileTextureParamsManager.LoadFromFile(filepath, out parameters))
                    {
                        if (MyCompilationSymbols.ReinterpretFormatsStoredInFiles)
                            if (m_type != MyFileTextureEnum.NORMALMAP_GLOSS)
                                parameters.Format = MyResourceUtils.MakeSrgb(parameters.Format);

                        int skipMipmaps = 0;
                        if (m_type != MyFileTextureEnum.GUI && m_type != MyFileTextureEnum.GPUPARTICLES)
                            skipMipmaps = MyRender11.RenderSettings.TextureQuality.MipmapsToSkip(parameters.Resolution.X, parameters.Resolution.Y);

                        if (parameters.Mipmaps > 1)
                        {
                            parameters.Mipmaps -= skipMipmaps;
                            parameters.Resolution.X = MyResourceUtils.GetMipmapSize(parameters.Resolution.X, skipMipmaps);
                            parameters.Resolution.Y = MyResourceUtils.GetMipmapSize(parameters.Resolution.Y, skipMipmaps);
                        }
                        return true;
                    }
                }
                parameters.Format = m_recoverySystem.FormatBytePattern;
                parameters.Mipmaps = 3;
                parameters.Resolution = new Vector2I(4, 4);
                parameters.ArraySize = 1;
                return false;
            }