2018-12-05 01:19:31 +00:00
|
|
|
|
using Microsoft.Xna.Framework.Content.Pipeline;
|
2019-01-22 01:56:51 +00:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using RecrownedAthenaeum.Data;
|
2018-12-05 01:19:31 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
|
|
|
|
|
{
|
2019-01-13 23:09:27 +00:00
|
|
|
|
[ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer", DefaultProcessor = "TextureAtlasProcessor")]
|
2019-01-22 01:56:51 +00:00
|
|
|
|
internal class TextureAtlasImporter : ContentImporter<TextureAtlasImporter.Package>
|
2018-12-05 01:19:31 +00:00
|
|
|
|
{
|
2019-01-22 01:56:51 +00:00
|
|
|
|
public override Package Import(string filename, ContentImporterContext context)
|
2018-12-05 01:19:31 +00:00
|
|
|
|
{
|
2019-01-22 01:56:51 +00:00
|
|
|
|
Package package;
|
|
|
|
|
package.textureAtlasData = JsonConvert.DeserializeObject<TextureAtlasData>(File.ReadAllText(filename));
|
|
|
|
|
package.textureBytes = File.ReadAllBytes(package.textureAtlasData.textureName);
|
|
|
|
|
return package;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal struct Package
|
|
|
|
|
{
|
|
|
|
|
internal TextureAtlasData textureAtlasData;
|
|
|
|
|
internal byte[] textureBytes;
|
2018-12-05 01:19:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|