当前位置: 首页>>代码示例>>C#>>正文


C# TextureTarget.ToString方法代码示例

本文整理汇总了C#中TextureTarget.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TextureTarget.ToString方法的具体用法?C# TextureTarget.ToString怎么用?C# TextureTarget.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextureTarget的用法示例。


在下文中一共展示了TextureTarget.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        /// <summary>
        /// Update the texture quality settings for the currently bound texture
        /// </summary>
        /// <param name="target">The GL texture target</param>
        public void Update(TextureTarget target)
        {
            if(mipmapsDirty)
            {
                mipmapsDirty = false;

                if(mipmaps)
                {
                    GL.TexParameter(target, TextureParameterName.TextureBaseLevel, 0);

                    int levels = mipmapLevels;
                    if (levels < 0)
                    {
                        levels = 1000;
                    }
                    //GL.TexParameter(target, TextureParameterName.TextureMaxLevel, levels);

                    if(!pregeneratedMipmaps)
                    {
                        GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
                        GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);

                        switch (target)
                        {
                            case TextureTarget.Texture1D:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture1D);
                                break;
                            case TextureTarget.Texture2D:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
                                break;
                            case TextureTarget.Texture3D:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture3D);
                                break;
                            case TextureTarget.Texture1DArray:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture1DArray);
                                break;
                            case TextureTarget.Texture2DArray:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture2DArray);
                                break;
                            case TextureTarget.TextureCubeMap:
                                GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap);
                                break;
                            case TextureTarget.TextureCubeMapArray:
                                GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMapArray);
                                break;
                            case TextureTarget.Texture2DMultisample:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture2DMultisample);
                                break;
                            case TextureTarget.Texture2DMultisampleArray:
                                GL.GenerateMipmap(GenerateMipmapTarget.Texture2DMultisampleArray);
                                break;
                            default:
                                throw new NotImplementedException("Generating mipmaps not supported for TextureTarget." + target.ToString() + ". Currently supported mipmaps are: Texture1D, Texture2D, Texture3D, Texture1DArray, Texture2DArray, TextureCubeMap, TextureCubeMapArray, Texture2DMultisample, Texture2DMultisampleArray.");
                        }
                    }
                }
            }

            if(textureFilteringDirty)
            {

                if(target == TextureTarget.Texture2D || target == TextureTarget.TextureCubeMap)
                {
                    switch (textureFiltering)
                    {
                        case TextureFiltering.Nearest:

                            GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);

                            if (mipmaps)
                            {
                                GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.NearestMipmapNearest);
                            }
                            else
                            {
                                GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
                            }

                            break;

                        case TextureFiltering.Bilinear:

                            GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

                            if (mipmaps)
                            {
                                GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapNearest);
                            }
                            else
                            {
                                GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
                            }

                            break;

                        case TextureFiltering.Trilinear:
//.........这里部分代码省略.........
开发者ID:Lazzu,项目名称:Hatzap,代码行数:101,代码来源:TextureQuality.cs


注:本文中的TextureTarget.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。