Example #1
0
        /// <summary>
        /// Loads a texture from a stream.
        /// </summary>
        /// <param name="device">The <see cref="GraphicsDevice" />.</param>
        /// <param name="image">The image.</param>
        /// <param name="textureFlags">True to load the texture with unordered access enabled. Default is false.</param>
        /// <param name="usage">Usage of the resource. Default is <see cref="GraphicsResourceUsage.Immutable" /></param>
        /// <returns>A texture</returns>
        /// <exception cref="System.InvalidOperationException">Dimension not supported</exception>
        public static Texture New(GraphicsDevice device, Image image, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }
            switch (image.Description.Dimension)
            {
            case TextureDimension.Texture1D:
                return(Texture1D.New(device, image, textureFlags, usage));

            case TextureDimension.Texture2D:
                return(Texture2D.New(device, image, textureFlags, usage));

            case TextureDimension.Texture3D:
                return(Texture3D.New(device, image, textureFlags, usage));

            case TextureDimension.TextureCube:
                return(TextureCube.New(device, image, textureFlags, usage));
            }

            throw new InvalidOperationException("Dimension not supported");
        }
Example #2
0
 protected internal TextureCube(GraphicsDevice device, TextureCube texture) : base(device, texture)
 {
     throw new NotImplementedException();
 }
 internal TextureCube(GraphicsDevice device, TextureCube texture, ViewType viewType = ViewType.Full, int arraySlice = 0, int mipMapSlice = 0, PixelFormat viewFormat = PixelFormat.None)
     : base(device, texture, viewType, arraySlice, mipMapSlice, viewFormat)
 {
 }
Example #4
0
 protected internal TextureCube(GraphicsDevice device, TextureCube texture) : base(device, texture)
 {
     throw new NotImplementedException();
 }
Example #5
0
 /// <summary>
 /// Creates a new texture from a <see cref="Direct3D11.Texture2D"/>.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="texture">The native texture <see cref="Direct3D11.Texture2D"/>.</param>
 /// <returns>
 /// A new instance of <see cref="TextureCube"/> class.
 /// </returns>
 public static TextureCube New(GraphicsDevice device, TextureCube texture)
 {
     return(new TextureCube(device, texture));
 }