untested texture atlas pipeline system complete.
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
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;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
|
||||
{
|
||||
class TextureAtlasProcessor : ContentProcessor<TextureAtlasFile, TextureAtlasFile>
|
||||
[ContentProcessor(DisplayName = "Texture Atlas Processor")]
|
||||
class TextureAtlasProcessor : ContentProcessor<TextureAtlasData, byte[]>
|
||||
{
|
||||
|
||||
public override TextureAtlasFile Process(TextureAtlasFile input, ContentProcessorContext context)
|
||||
public override byte[] Process(TextureAtlasData input, ContentProcessorContext context)
|
||||
{
|
||||
return input;
|
||||
string serialized = JsonConvert.SerializeObject(input);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(serialized);
|
||||
|
||||
MemoryStream outStream = new MemoryStream();
|
||||
GZipStream gZStream = new GZipStream(outStream, CompressionLevel.Optimal);
|
||||
|
||||
gZStream.Write(bytes, 0, bytes.Length);
|
||||
|
||||
byte[] compressed = outStream.ToArray();
|
||||
|
||||
gZStream.Dispose();
|
||||
outStream.Dispose();
|
||||
return compressed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user