2018-12-04 19:19:31 -06:00
|
|
|
|
using Microsoft.Xna.Framework.Content.Pipeline;
|
2019-01-21 19:56:51 -06:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using RecrownedAthenaeum.Data;
|
2018-12-04 19:19:31 -06:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
|
|
|
|
|
{
|
2019-01-13 17:09:27 -06:00
|
|
|
|
[ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer", DefaultProcessor = "TextureAtlasProcessor")]
|
2019-01-21 19:56:51 -06:00
|
|
|
|
internal class TextureAtlasImporter : ContentImporter<TextureAtlasImporter.Package>
|
2018-12-04 19:19:31 -06:00
|
|
|
|
{
|
2019-01-21 19:56:51 -06:00
|
|
|
|
public override Package Import(string filename, ContentImporterContext context)
|
2018-12-04 19:19:31 -06:00
|
|
|
|
{
|
2019-01-21 19:56:51 -06: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-04 19:19:31 -06:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|