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


C# Texture.GenerateMipSubLevels方法代码示例

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


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

示例1: OnReset

 /// <summary>
 /// Device has been reset - rebuild unmanaged resources
 /// </summary>
 public static void OnReset()
 {
     Debug.WriteLine("SkyBox.OnReset()");
     texture = TextureLoader.FromFile(Engine.Device, FileResource.Fsp("textures", "Sky.png"));
     texture.GenerateMipSubLevels();
 }
开发者ID:JamesTryand,项目名称:simergy,代码行数:9,代码来源:SkyBox.cs

示例2: OnReset

 public void OnReset(object sender, EventArgs e)
 {
     Debug.WriteLine("Terrain.Reset()");
     /// TODO: Load the whole library of textures!
     texture = TextureLoader.FromFile(Engine.Device,FileResource.Fsp("ground.bmp"));
     texture.GenerateMipSubLevels();
 }
开发者ID:JamesTryand,项目名称:simergy,代码行数:7,代码来源:Copy+of+Terrain.cs

示例3: CreateTexture

        /// <summary>
        /// The create texture.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="bitmap">The bitmap.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static Texture CreateTexture(ref Device device, Bitmap bitmap)
        {
            if (bitmap == null)
            {
                return null;
            }

            Texture texture = new Texture(
                device, bitmap.Width, bitmap.Height, 1, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);

            BitmapData bitmapData = bitmap.LockBits(
                new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
            int pitch;
            GraphicsStream textureData = texture.LockRectangle(0, LockFlags.None, out pitch);

            // Debug.Assert(bitmap.PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            // Debug.Assert(sizeof(int) == 4 && (bitmapData.Stride & 3) == 0 && (pitch & 3) == 0);
            unsafe
            {
                int* texturePointer = (int*)textureData.InternalDataPointer;
                for (int y = 0; y < bitmap.Height; y++)
                {
                    int* bitmapLinePointer = (int*)bitmapData.Scan0 + y * (bitmapData.Stride / sizeof(int));
                    int* textureLinePointer = texturePointer + y * (pitch / sizeof(int));
                    int length = bitmap.Width;
                    while (--length >= 0)
                    {
                        *textureLinePointer++ = *bitmapLinePointer++;
                    }
                }
            }

            bitmap.UnlockBits(bitmapData);
            texture.UnlockRectangle(0);
            texture.GenerateMipSubLevels();
            texture.AutoGenerateFilterType = TextureFilter.Linear;
            return texture;
        }
开发者ID:nolenfelten,项目名称:Blam_BSP,代码行数:45,代码来源:shad.cs

示例4: CopyToTexture

        public static void CopyToTexture(OpsContext context, Texture newTexture, string srcArg, Filter filter)
        {
            if(srcArg == null || srcArg.Length == 0)
                return;
            OpsTexture src = context.GetTexture(srcArg);
                
            if(src == null)
                throw new OpsException("Could not find source texture: "+srcArg );

            if(!(src.Texture is Texture))
                throw new OpsException("Source texture is not a texture2D: "+srcArg);

            Texture srcTex = src.Texture as Texture;

            SurfaceLoader.FromSurface(newTexture.GetSurfaceLevel(0), srcTex.GetSurfaceLevel(0), filter| (src.SRGB?Filter.SrgbIn:0), 0); 

            newTexture.GenerateMipSubLevels();
        }
开发者ID:steadyfield,项目名称:SourceEngine2007,代码行数:18,代码来源:newtex2d.cs


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