Replace float[] with float3 in voxel renderer.

This commit is contained in:
Paul Chote
2015-10-01 18:55:54 +01:00
parent a8dda39a72
commit 19a276da2b
2 changed files with 4 additions and 7 deletions

View File

@@ -21,9 +21,6 @@ namespace OpenRA.Graphics
public Vertex(float3 xyz, float u, float v, float p, float c) public Vertex(float3 xyz, float u, float v, float p, float c)
: this(xyz.X, xyz.Y, xyz.Z, u, v, p, c) { } : this(xyz.X, xyz.Y, xyz.Z, u, v, p, c) { }
public Vertex(float[] xyz, float u, float v, float p, float c)
: this(xyz[0], xyz[1], xyz[2], u, v, p, c) { }
public Vertex(float x, float y, float z, float u, float v, float p, float c) public Vertex(float x, float y, float z, float u, float v, float p, float c)
{ {
X = x; Y = y; Z = z; X = x; Y = y; Z = z;

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Graphics
sheetBuilder = CreateSheetBuilder(); sheetBuilder = CreateSheetBuilder();
} }
Vertex[] GenerateSlicePlane(int su, int sv, Func<int, int, VxlElement> first, Func<int, int, VxlElement> second, Func<int, int, float[]> coord) Vertex[] GenerateSlicePlane(int su, int sv, Func<int, int, VxlElement> first, Func<int, int, VxlElement> second, Func<int, int, float3> coord)
{ {
var colors = new byte[su * sv]; var colors = new byte[su * sv];
var normals = new byte[su * sv]; var normals = new byte[su * sv];
@@ -158,21 +158,21 @@ namespace OpenRA.Graphics
yield return GenerateSlicePlane(l.Size[1], l.Size[2], yield return GenerateSlicePlane(l.Size[1], l.Size[2],
(u, v) => get(x, u, v), (u, v) => get(x, u, v),
(u, v) => get(x - 1, u, v), (u, v) => get(x - 1, u, v),
(u, v) => new float[] { x, u, v }); (u, v) => new float3(x, u, v));
for (var y = 0; y <= l.Size[1]; y++) for (var y = 0; y <= l.Size[1]; y++)
if (yPlanes[y]) if (yPlanes[y])
yield return GenerateSlicePlane(l.Size[0], l.Size[2], yield return GenerateSlicePlane(l.Size[0], l.Size[2],
(u, v) => get(u, y, v), (u, v) => get(u, y, v),
(u, v) => get(u, y - 1, v), (u, v) => get(u, y - 1, v),
(u, v) => new float[] { u, y, v }); (u, v) => new float3(u, y, v));
for (var z = 0; z <= l.Size[2]; z++) for (var z = 0; z <= l.Size[2]; z++)
if (zPlanes[z]) if (zPlanes[z])
yield return GenerateSlicePlane(l.Size[0], l.Size[1], yield return GenerateSlicePlane(l.Size[0], l.Size[1],
(u, v) => get(u, v, z), (u, v) => get(u, v, z),
(u, v) => get(u, v, z - 1), (u, v) => get(u, v, z - 1),
(u, v) => new float[] { u, v, z }); (u, v) => new float3(u, v, z));
} }
public VoxelRenderData GenerateRenderData(VxlLimb l) public VoxelRenderData GenerateRenderData(VxlLimb l)