protected virtual void ReadBase(IntPtr data, Format format) { throw new NotImplementedException(); }
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))); }
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)); }
internal LayeredTexture(Format format, Vector4i dimensions) : base(format, dimensions) { }
internal Texture(Format format, Vector4i dimensions) : this() { Storage(format, dimensions); }
public TextureRectangle(Format format, Vector2i dimensions) : base(format, new Vector4i(dimensions, 1, 1)) { }
internal FlatTexture(Format format, Vector4i dimensions) : base(format, dimensions) { }
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); }
/// <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);
protected override void ReadBase(IntPtr data, Format format) { using (Texture.Lock()) GL.GetTexImage(Target, Level, format.PixelFormat.Value, format.PixelType.Value, data); }
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(); } }
/// <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)); }
/// <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)); }
/// <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); }
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); }
public void Storage(Format format, Vector4i dimensions) { Storage(CalculateLevels(dimensions), format, dimensions); }
protected virtual void DataCompressedBase(Format format, Vector2i dimensions, IntPtr data) { throw new NotImplementedException(); }
public TextureRectangle(Format format, int width, int height) : this(format, new Vector2i(width, height)) { }