fixed rendering

This commit is contained in:
2025-09-09 19:43:27 +02:00
parent ce456b6b26
commit 50f9d4c0c8
5 changed files with 66 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
using OpenTK.Graphics.OpenGL4;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -13,7 +14,7 @@ namespace Voxel
public int Y;
private byte[] _packedData;
public bool NeedsUpdate = false;
public int Length = 0;
public int Size = 0;
private List<FaceData> _faces;
public ChunkMesh(int x, int y)
@@ -25,7 +26,7 @@ namespace Voxel
public void SetFaces(List<FaceData> faces)
{
Length = faces.Count;
Size = faces.Count;
_faces = faces;
NeedsUpdate = true;
}
@@ -35,7 +36,6 @@ namespace Voxel
if (NeedsUpdate)
{
_packedData = _faces.SelectMany(f => f.Pack()).ToArray();
NeedsUpdate = false;
}
return _packedData;