Allow mods and maps to define voxel sequences.

This commit is contained in:
Paul Chote
2013-02-23 14:42:44 +13:00
parent a00696ec3b
commit 82faf7e929
6 changed files with 109 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ namespace OpenRA.Graphics
{
SheetBuilder sheetBuilder;
Cache<Pair<string,string>, Voxel> voxels;
IVertexBuffer<Vertex> vertexBuffer;
List<Vertex[]> vertices;
int totalVertexCount;
@@ -42,6 +43,7 @@ namespace OpenRA.Graphics
public VoxelLoader()
{
voxels = new Cache<Pair<string,string>, Voxel>(LoadFile);
vertices = new List<Vertex[]>();
totalVertexCount = 0;
cachedVertexCount = 0;
@@ -190,5 +192,17 @@ namespace OpenRA.Graphics
return vertexBuffer;
}
}
Voxel LoadFile(Pair<string,string> files)
{
var vxl = new VxlReader(FileSystem.OpenWithExts(files.First, ".vxl"));
var hva = new HvaReader(FileSystem.OpenWithExts(files.Second, ".hva"));
return new Voxel(this, vxl, hva);
}
public Voxel Load(string vxl, string hva)
{
return voxels[Pair.New(vxl, hva)];
}
}
}