2020-04-22 00:30:55 +02:00
|
|
|
using System.IO;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
2020-09-16 23:39:01 +02:00
|
|
|
namespace MLEM.Data.Content {
|
2020-05-21 12:53:42 +02:00
|
|
|
/// <inheritdoc />
|
2020-04-22 00:30:55 +02:00
|
|
|
public class Texture2DReader : RawContentReader<Texture2D> {
|
|
|
|
|
2020-05-21 12:53:42 +02:00
|
|
|
/// <inheritdoc />
|
2020-04-22 00:30:55 +02:00
|
|
|
protected override Texture2D Read(RawContentManager manager, string assetPath, Stream stream, Texture2D existing) {
|
|
|
|
if (existing != null) {
|
|
|
|
existing.Reload(stream);
|
|
|
|
return existing;
|
|
|
|
} else {
|
|
|
|
return Texture2D.FromStream(manager.GraphicsDevice, stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 12:53:42 +02:00
|
|
|
/// <inheritdoc />
|
2020-04-22 00:30:55 +02:00
|
|
|
public override string[] GetFileExtensions() {
|
|
|
|
return new[] {"png", "bmp", "gif", "jpg", "tif", "dds"};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|