Пример #1
0
 protected virtual void ReadBase(IntPtr data, Format format)
 {
     throw new NotImplementedException();
 }
Пример #2
0
 public static TTexture Create <TTexture>(Format format, int dimensionsX, int dimensionsY = 1, int dimensionsZ = 1, int dimensionsW = 1) where TTexture : Texture
 {
     return(Create <TTexture>(format, new Vector4i(dimensionsX, dimensionsY, dimensionsZ, dimensionsW)));
 }
Пример #3
0
 public static TTexture Create <TTexture>(Format format, Vector2i dimensions, int dimensionsZ = 1, int dimensionsW = 1) where TTexture : Texture
 {
     return(Create <TTexture>(format, dimensions.X, dimensions.Y, dimensionsZ, dimensionsW));
 }
Пример #4
0
 internal LayeredTexture(Format format, Vector4i dimensions) : base(format, dimensions)
 {
 }
Пример #5
0
 internal Texture(Format format, Vector4i dimensions)
     : this()
 {
     Storage(format, dimensions);
 }
Пример #6
0
 public TextureRectangle(Format format, Vector2i dimensions) : base(format, new Vector4i(dimensions, 1, 1))
 {
 }
Пример #7
0
 internal FlatTexture(Format format, Vector4i dimensions) : base(format, dimensions)
 {
 }
Пример #8
0
        protected void Data2D <T>(int level, Vector2i dimensions, Format storageFormat, T[] data, int start = 0, Format uploadFormat = null) where T : struct
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (uploadFormat == null)
            {
                uploadFormat = storageFormat;
            }
            if (start > data.Length || start < 0)
            {
                throw new ArgumentOutOfRangeException("data");
            }
            if (dimensions.Product * uploadFormat.BytesPerSample / Marshal.SizeOf(typeof(T)) + start > data.Length)
            {
                throw new ArgumentOutOfRangeException("data");
            }

            IntPtr pointer;

            using (data.Pin(out pointer, start))
                Data2D(level, dimensions, storageFormat, pointer, uploadFormat);
        }
Пример #9
0
 /// <summary>Set the dimensions of the entire texture, assigning level-of-detail chains appropriately. Unused dimensions need to be 1.</summary>
 /// <param name="dimensions">The dimensions of the <see cref="Texture"/>.</param>
 /// <param name="format"></param>
 public abstract void Storage(int levels, Format format, Vector4i dimensions);
Пример #10
0
 protected override void ReadBase(IntPtr data, Format format)
 {
     using (Texture.Lock())
         GL.GetTexImage(Target, Level, format.PixelFormat.Value, format.PixelType.Value, data);
 }
Пример #11
0
        protected void Data2D(int level, Vector2i dimensions, Format storageFormat, IntPtr pointer, Format uploadFormat = null)
        {
            int maxSize = Device.Capabilities.MaxTextureDimension2D;

            if (level < 0)
            {
                throw new ArgumentOutOfRangeException("level");
            }
            if (dimensions.X < 0 || dimensions.X > maxSize)
            {
                throw new ArgumentOutOfRangeException("dimensions.X");
            }
            if (dimensions.Y < 0 || dimensions.Y > maxSize)
            {
                throw new ArgumentOutOfRangeException("dimensions.Y");
            }
            if (storageFormat == null)
            {
                throw new ArgumentNullException("storageFormat");
            }
            if (uploadFormat == null)
            {
                uploadFormat = storageFormat;
            }

            using (Lock()) {
                GL.TexImage2D(Target, level, storageFormat.PixelInternalFormat.Value, dimensions.X, dimensions.Y, 0, uploadFormat.PixelFormat.Value, uploadFormat.PixelType.Value, pointer);
                Context.CheckError();
            }
        }
Пример #12
0
 /// <summary>Prepare the texture with unitialised data. This automatically generates the appropriate number of levels.</summary>
 /// <param name="format">The texture format. This must be an item from <see cref="TextureFormats"/>.</param>
 /// <param name="width">The width in pixels of the texture.</param>
 /// <param name="height">The height in pixels of the texture.</param>
 public void Storage(Format format, int width, int height)
 {
     Storage(format, new Vector4i(width, height, 1, 1));
 }
Пример #13
0
 /// <summary>Prepare the texture with unitialised data.</summary>
 /// <param name="levels">The number of levels to generate.</param>
 /// <param name="format">The texture format. This must be an item from <see cref="TextureFormats"/>.</param>
 /// <param name="width">The width in pixels of the texture.</param>
 /// <param name="height">The height in pixels of the texture.</param>
 public void Storage(int levels, Format format, int width, int height)
 {
     Storage(levels, format, new Vector4i(width, height, 1, 1));
 }
Пример #14
0
 /// <summary>Prepare the texture with uninitialised data.</summary>
 /// <param name="levels">The number of levels to generate.</param>
 /// <param name="format">The texture format. This must be an item from <see cref="TextureFormats"/>.</param>
 /// <param name="dimensions">The width and height of the texture. Z and W must be 1.</param>
 public override void Storage(int levels, Format format, Vector4i dimensions)
 {
     Storage2D(levels, format, dimensions);
 }
Пример #15
0
 public void DataCompressed <T>(Format format, int width, int height, T[] data, int start = 0) where T : struct
 {
     DataCompressed(format, new Vector2i(width, height), data, start);
 }
Пример #16
0
 public void Storage(Format format, Vector4i dimensions)
 {
     Storage(CalculateLevels(dimensions), format, dimensions);
 }
Пример #17
0
 protected virtual void DataCompressedBase(Format format, Vector2i dimensions, IntPtr data)
 {
     throw new NotImplementedException();
 }
Пример #18
0
 public TextureRectangle(Format format, int width, int height) : this(format, new Vector2i(width, height))
 {
 }