chunk meshes
This commit is contained in:
19
ChunkMesh.cs
19
ChunkMesh.cs
@@ -8,11 +8,24 @@ namespace Voxel
|
||||
{
|
||||
public class ChunkMesh
|
||||
{
|
||||
public List<FaceData> Faces;
|
||||
public int X;
|
||||
public int Y;
|
||||
public byte[] PackedData;
|
||||
public bool NeedsUpdate = true;
|
||||
public int Length = 0;
|
||||
|
||||
public ChunkMesh(int maxBlocks)
|
||||
public ChunkMesh(int x, int y)
|
||||
{
|
||||
Faces = new List<FaceData>(maxBlocks * 6);
|
||||
PackedData = new byte[0];
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public void SetFaces(List<FaceData> faces)
|
||||
{
|
||||
Length = faces.Count;
|
||||
PackedData = faces.SelectMany(f => f.Pack()).ToArray();
|
||||
NeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user