chunk meshes

This commit is contained in:
maxwes08
2025-09-03 15:08:21 +02:00
parent 94ebc4ace4
commit 3678eaa5f8
8 changed files with 69 additions and 41 deletions

View File

@@ -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;
}
}
}