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


C# TextureFlags类代码示例

本文整理汇总了C#中TextureFlags的典型用法代码示例。如果您正苦于以下问题:C# TextureFlags类的具体用法?C# TextureFlags怎么用?C# TextureFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TextureItem

 public TextureItem(TexturePackage package, string name, TextureFlags flags)
 {
     Package = package;
     Name = name;
     Flags = flags;
     _subItems = new Dictionary<TextureSubItemType, TextureSubItem>();
 }
开发者ID:silky,项目名称:sledge,代码行数:7,代码来源:TextureItem.cs

示例2: New1D

 private static TextureDescription New1D(int width, PixelFormat format, TextureFlags flags, int mipCount, int arraySize, GraphicsResourceUsage usage)
 {
     usage = (flags & TextureFlags.UnorderedAccess) != 0 ? GraphicsResourceUsage.Default : usage;
     var desc = new TextureDescription()
     {
         Dimension = TextureDimension.Texture1D,
         Width = width,
         Height = 1,
         Depth = 1,
         ArraySize = arraySize,
         Flags = flags,
         Format = format,
         MipLevels = Texture.CalculateMipMapCount(mipCount, width),
         Usage = Texture.GetUsageWithFlags(usage, flags),
     };
     return desc;
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:17,代码来源:TextureDescription.Extensions1D.cs

示例3: New3D

        private static TextureDescription New3D(int width, int height, int depth, PixelFormat format, TextureFlags flags, int mipCount, GraphicsResourceUsage usage)
        {
            var desc = new TextureDescription()
            {
                Width = width,
                Height = height,
                Depth = depth,
                Flags = flags,
                Format = format,
                MipLevels = Texture.CalculateMipMapCount(mipCount, width, height, depth),
                Usage = Texture.GetUsageWithFlags(usage, flags),
                ArraySize = 1,
                Dimension = TextureDimension.Texture3D,
                MultiSampleLevel = MSAALevel.None
            };

            return desc;
        } 
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:18,代码来源:TextureDescription.Extensions3D.cs

示例4: New2D

        private static TextureDescription New2D(int width, int height, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, GraphicsResourceUsage usage)
        {
            if ((textureFlags & TextureFlags.UnorderedAccess) != 0)
                usage = GraphicsResourceUsage.Default;

            var desc = new TextureDescription()
            {
                Dimension = TextureDimension.Texture2D,
                Width = width,
                Height = height,
                Depth = 1,
                ArraySize = arraySize,
                MultiSampleLevel = MSAALevel.None,
                Flags = textureFlags,
                Format = format,
                MipLevels = Texture.CalculateMipMapCount(mipCount, width, height),
                Usage = Texture.GetUsageWithFlags(usage, textureFlags),
            };
            return desc;
        }
开发者ID:cg123,项目名称:xenko,代码行数:20,代码来源:TextureDescription.Extensions2D.cs

示例5: Create

        public static GLTexture Create(string name, Bitmap bitmap, int width, int height, TextureFlags flags)
        {
            if (Exists(name)) {
                Delete(name);
            }
            var actualBitmap = bitmap;
            if (ForceNonPowerOfTwoResize || !SupportsNonPowerOfTwo())
            {
                var w = NextPowerOfTwo(bitmap.Width);
                var h = NextPowerOfTwo(bitmap.Height);
                if (w != bitmap.Width || h != bitmap.Height) actualBitmap = new Bitmap(bitmap, w, h);
            }
            var data = actualBitmap.LockBits(
                new Rectangle(0, 0, actualBitmap.Width, actualBitmap.Height),
                ImageLockMode.ReadOnly,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb
                );
            var tex = CreateAndBindTexture();
            SetTextureParameters();
            GL.TexImage2D(
                TextureTarget.Texture2D,
                0,
                PixelInternalFormat,
                data.Width,
                data.Height,
                0,
                PixelFormat.Bgra,
                PixelType.UnsignedByte,
                data.Scan0
                );

            actualBitmap.UnlockBits(data);
            if (actualBitmap != bitmap)
            {
                actualBitmap.Dispose();
            }
            var texobj = new GLTexture(tex, name, flags) { Width = width, Height = height };
            Textures.Add(name, texobj);
            return texobj;
        }
开发者ID:silky,项目名称:sledge,代码行数:40,代码来源:TextureHelper.cs

示例6: New

 /// <summary>
 /// Creates a new <see cref="RenderTargetCube" />.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param>
 /// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param>
 /// <param name="format">Describes the format to use.</param>
 /// <param name="flags">Sets the texture flags (for unordered access...etc.)</param>
 /// <returns>A new instance of <see cref="RenderTargetCube" /> class.</returns>
 /// <msdn-id>ff476521</msdn-id>
 ///   <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged>
 ///   <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short>
 public static RenderTargetCube New(GraphicsDevice device, int size, MipMapCount mipCount, PixelFormat format, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource)
 {
     return new RenderTargetCube(device, NewRenderTargetDescription(size, format, flags | TextureFlags.RenderTarget, mipCount));
 }
开发者ID:pH200,项目名称:SharpDX,代码行数:16,代码来源:RenderTargetCube.cs

示例7: MyTexture

 /// <summary>
 /// Initializes a new instance of the <see cref="MyTexture"/> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="loadMethod">The load method. See <code>LoadMethod</code> enum.</param>
 /// <param name="flags">The flags.</param>
 protected MyTexture(string path, LoadMethod loadMethod, TextureFlags flags)
 {
     this.flags = flags;
     this.Name = path;
     //  this.Manager = manager;
     switch (loadMethod)
     {
         case LoadMethod.External:
             this.LoadState = LoadState.Pending;
             break;
         case LoadMethod.Lazy:
             this.LoadState = LoadState.LoadYourself;
             break;
         case LoadMethod.LazyBackground:
             this.LoadState = LoadState.LoadYourselfBackground;
             break;
         default:
             throw new ArgumentOutOfRangeException("loadMethod");
     }
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:27,代码来源:MyTexture.cs

示例8: bgfx_create_frame_buffer

 public static extern ushort bgfx_create_frame_buffer(ushort width, ushort height, TextureFormat format, TextureFlags flags);
开发者ID:prepare,项目名称:SharpBgfx,代码行数:1,代码来源:NativeMethods.cs

示例9: bgfx_create_texture_cube

 public static extern ushort bgfx_create_texture_cube(ushort size, byte numMips, TextureFormat format, TextureFlags flags, MemoryBlock.DataPtr* mem);
开发者ID:prepare,项目名称:SharpBgfx,代码行数:1,代码来源:NativeMethods.cs

示例10: bgfx_create_texture_2d_scaled

 public static extern ushort bgfx_create_texture_2d_scaled(BackbufferRatio ratio, byte numMips, TextureFormat format, TextureFlags flags);
开发者ID:prepare,项目名称:SharpBgfx,代码行数:1,代码来源:NativeMethods.cs

示例11: MyTextureCube

 /// <summary>
 /// Initializes a new instance of the <see cref="MyTexture2D"/> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="loadMethod">if set to <c>true</c> [external load].</param>
 /// <param name="flags">The flags.</param>
 public MyTextureCube(string path, LoadMethod loadMethod, TextureFlags flags)
     : base(path, loadMethod, flags)
 {
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:11,代码来源:MyTextureCube.cs

示例12: NewCube

 /// <summary>
 /// Creates a new Cube <see cref="TextureDescription"/>.
 /// </summary>
 /// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param>
 /// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int &gt;=1 for a particular mipmap count.</param>
 /// <param name="format">Describes the format to use.</param>
 /// <param name="textureFlags">The texture flags.</param>
 /// <param name="usage">The usage.</param>
 /// <returns>A new instance of <see cref="TextureDescription"/> class.</returns>
 public static TextureDescription NewCube(int size, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return NewCube(size, format, textureFlags, mipCount, usage);
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:13,代码来源:TextureDescription.ExtensionsCube.cs

示例13: CreateDescription

        internal static Texture2DDescription CreateDescription(GraphicsDevice device, int width, int height, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, MSAALevel multiSampleCount)
        {
            // Make sure that the texture to create is a render target
            textureFlags |= TextureFlags.RenderTarget;
            var desc = Texture2DBase.NewDescription(width, height, format, textureFlags, mipCount, arraySize, ResourceUsage.Default);

            // Sets the MSAALevel
            int maximumMSAA = (int)device.Features[format].MSAALevelMax;
            desc.SampleDescription.Count = Math.Max(1, Math.Min((int)multiSampleCount, maximumMSAA));
            return desc;
        }
开发者ID:pH200,项目名称:SharpDX,代码行数:11,代码来源:RenderTarget2D.cs

示例14: NewDescription

        protected static Texture1DDescription NewDescription(int width, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, ResourceUsage usage)
        {
            if ((textureFlags & TextureFlags.UnorderedAccess) != 0)
                usage = ResourceUsage.Default;

            var desc = new Texture1DDescription()
                           {
                               Width = width,
                               ArraySize = arraySize,
                               BindFlags = GetBindFlagsFromTextureFlags(textureFlags),
                               Format = format,
                               MipLevels = CalculateMipMapCount(mipCount, width),
                               Usage = usage,
                               CpuAccessFlags = GetCputAccessFlagsFromUsage(usage),
                               OptionFlags = ResourceOptionFlags.None
                           };

            // If the texture is a RenderTarget + ShaderResource + MipLevels > 1, then allow for GenerateMipMaps method
            if ((desc.BindFlags & BindFlags.RenderTarget) != 0 && (desc.BindFlags & BindFlags.ShaderResource) != 0 && desc.MipLevels > 1)
            {
                desc.OptionFlags |= ResourceOptionFlags.GenerateMipMaps;
            }

            return desc;
        }
开发者ID:pH200,项目名称:SharpDX,代码行数:25,代码来源:Texture1DBase.cs

示例15: MyTexture2D

 /// <summary>
 /// Initializes a new instance of the <see cref="MyTexture2D"/> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="loadMethod">if set to <c>true</c> [external load].</param>
 /// <param name="flags">The flags.</param>
 public MyTexture2D(string contentDir, string path, LoadMethod loadMethod, TextureFlags flags)
     : base(contentDir, path, loadMethod, flags)
 {
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:11,代码来源:MyTexture2D.cs


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