untested texture atlas pipeline system complete.

This commit is contained in:
2018-12-05 02:28:09 -06:00
parent 87823b26d6
commit 4136b1ca22
10 changed files with 162 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.DataTypes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
@@ -11,15 +11,16 @@ using System.Xml.Serialization;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{
internal class TextureAtlasImporter : ContentImporter<TextureAtlasFile>
[ContentImporter(".atlas", DisplayName = "Texture Atlas Importer")]
internal class TextureAtlasImporter : ContentImporter<TextureAtlasData>
{
public override TextureAtlasFile Import(string filename, ContentImporterContext context)
public override TextureAtlasData Import(string filename, ContentImporterContext context)
{
StreamReader stream = new StreamReader(filename);
XmlSerializer serializer = new XmlSerializer(typeof(TextureAtlasFile));
TextureAtlasFile atlas = (TextureAtlasFile)serializer.Deserialize(stream);
context.AddDependency(atlas.textureName);
stream.Dispose();
TextureAtlasData atlas;
using (StreamReader stream = new StreamReader(filename))
{
atlas = JsonConvert.DeserializeObject<TextureAtlasData>(stream.ReadToEnd());
}
return atlas;
}
}