implement parallel chunk mesh building

This commit is contained in:
Alex Zenla
2024-09-03 09:48:29 -04:00
parent 94ae0c26b1
commit cfb985cff6
4 changed files with 55 additions and 9 deletions

View File

@ -1,7 +1,5 @@
struct ChunkMeshBuilder {
public static func build(world: World, chunkID: SIMD3<Int>) -> Mesh<VertexPositionNormalColorTexcoord, UInt16> {
guard let chunk = world.getChunk(id: chunkID) else { return .empty }
public static func build(world: World, chunk: Chunk) -> Mesh<VertexPositionNormalColorTexcoord, UInt16> {
var vertices = [VertexPositionNormalColorTexcoord]()
var indices = [UInt16]()
chunk.forEach { block, position in