mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 21:21:34 +00:00
adjust chunk generation range
This commit is contained in:
@ -37,13 +37,18 @@ public struct ChunkGeneration {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let centerChunkID = World.makeID(position: position)
|
let centerChunkID = World.makeID(position: position)
|
||||||
for offset in ChunkGeneration.chunkGenerateNeighbors {
|
let range = -2...2
|
||||||
let chunkID = centerChunkID &+ offset
|
for z in range {
|
||||||
|
for y in range {
|
||||||
|
for x in range {
|
||||||
|
let chunkID = centerChunkID &+ SIMD3(x, y, z)
|
||||||
if world.getChunk(id: chunkID) == nil {
|
if world.getChunk(id: chunkID) == nil {
|
||||||
self.generate(chunkID: chunkID)
|
self.generate(chunkID: chunkID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public mutating func acceptReadyChunks() {
|
public mutating func acceptReadyChunks() {
|
||||||
guard let world = self.world else {
|
guard let world = self.world else {
|
||||||
@ -59,34 +64,4 @@ public struct ChunkGeneration {
|
|||||||
self.generatingChunkSet.remove(chunkID)
|
self.generatingChunkSet.remove(chunkID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static let chunkGenerateNeighbors: [SIMD3<Int>] = [
|
|
||||||
SIMD3<Int>(-1, -1, -1),
|
|
||||||
SIMD3<Int>(0, -1, -1),
|
|
||||||
SIMD3<Int>(1, -1, -1),
|
|
||||||
SIMD3<Int>(-1, 0, -1),
|
|
||||||
SIMD3<Int>(0, 0, -1),
|
|
||||||
SIMD3<Int>(1, 0, -1),
|
|
||||||
SIMD3<Int>(-1, 1, -1),
|
|
||||||
SIMD3<Int>(0, 1, -1),
|
|
||||||
SIMD3<Int>(1, 1, -1),
|
|
||||||
SIMD3<Int>(-1, -1, 0),
|
|
||||||
SIMD3<Int>(0, -1, 0),
|
|
||||||
SIMD3<Int>(1, -1, 0),
|
|
||||||
SIMD3<Int>(-1, 0, 0),
|
|
||||||
SIMD3<Int>(0, 0, 0),
|
|
||||||
SIMD3<Int>(1, 0, 0),
|
|
||||||
SIMD3<Int>(-1, 1, 0),
|
|
||||||
SIMD3<Int>(0, 1, 0),
|
|
||||||
SIMD3<Int>(1, 1, 0),
|
|
||||||
SIMD3<Int>(-1, -1, 1),
|
|
||||||
SIMD3<Int>(0, -1, 1),
|
|
||||||
SIMD3<Int>(1, -1, 1),
|
|
||||||
SIMD3<Int>(-1, 0, 1),
|
|
||||||
SIMD3<Int>(0, 0, 1),
|
|
||||||
SIMD3<Int>(1, 0, 1),
|
|
||||||
SIMD3<Int>(-1, 1, 1),
|
|
||||||
SIMD3<Int>(0, 1, 1),
|
|
||||||
SIMD3<Int>(1, 1, 1),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user