Removed PNG loader from the TextureData.

In support of new loading pipeline.
This commit is contained in:
Harrison Deng 2020-04-17 22:07:38 -05:00
parent 20f67886bc
commit 9c19b21ffb

View File

@ -16,17 +16,6 @@ namespace RecrownedGTK.Graphics {
public Color4 borderColor;
public TextureMinFilter textureMinFilter;
public TextureMagFilter textureMagFilter;
/// <summary>
/// Generates a texture data with a png.
/// </summary>
/// <param name="path">A path to a texture represented in PNG format.</param>
public TextureData(string path) {
int width;
int height;
byte[] textureData = LoadPNG(path, out width, out height);
GenerateTexture(textureData, width, height);
}
/// <summary>
/// Generates a texture using a byte array of the texture data.
@ -43,28 +32,6 @@ namespace RecrownedGTK.Graphics {
this.height = height;
GenerateTexture(textureData, width, height);
}
/// <summary>
///Load PNG data to this texture representation.
///
/// Decodes the PNG into a byte array to be stored.
/// </summary>
/// <param name="path">The path to the PNG file to be represented.</param>
/// <param name="width">Outputs the width of the PNG file.</param>
/// <param name="height">Outputs the height of the PNG file.</param>
/// <returns>A byte array representing the PNG.</returns>
private byte[] LoadPNG(string path, out int width, out int height) {
byte[] textureData = null;
using (FileStream file = new FileStream(path, FileMode.Open)) {
using (Bitmap bitmap = new Bitmap(file)) {
ImageConverter converter = new ImageConverter();
textureData = (byte[]) converter.ConvertTo(bitmap, typeof(byte[]));
width = bitmap.Width;
height = bitmap.Height;
}
}
return textureData;
}
/// <summary>
/// Generates a texture in the OpenGL context.