Removed PNG loader from the TextureData.
In support of new loading pipeline.
This commit is contained in:
parent
20f67886bc
commit
9c19b21ffb
@ -17,17 +17,6 @@ namespace RecrownedGTK.Graphics {
|
||||
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.
|
||||
/// </summary>
|
||||
@ -44,28 +33,6 @@ namespace RecrownedGTK.Graphics {
|
||||
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.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user