mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 13:11:33 +00:00
turn the ChunkID type alias into a real type
This commit is contained in:
@ -15,7 +15,7 @@ struct StandardWorldGenerator: WorldGenerator {
|
||||
self.colorNoise = .init(random: &random, octaves: 15, frequency: 0.006667, amplitude: 3)
|
||||
}
|
||||
|
||||
public func makeChunk(id chunkID: SIMD3<Int>) -> Chunk {
|
||||
public func makeChunk(id chunkID: ChunkID) -> Chunk {
|
||||
let blockFunc = { (height: Float, position: SIMD3<Float>) -> BlockType in
|
||||
#if true
|
||||
let value = height + self.terrainNoise.get(position * SIMD3(1, 2, 1))
|
||||
@ -37,7 +37,7 @@ struct StandardWorldGenerator: WorldGenerator {
|
||||
saturation: 0.47, value: 0.9).linear)
|
||||
}
|
||||
|
||||
let chunkOrigin = chunkID &<< Chunk.shift
|
||||
let chunkOrigin = chunkID.getPosition()
|
||||
var chunk = Chunk(position: chunkOrigin)
|
||||
for z in 0..<Chunk.size {
|
||||
for x in 0..<Chunk.size {
|
||||
|
@ -10,8 +10,8 @@ struct TerrorTowerGenerator: WorldGenerator {
|
||||
self.noise2 = LayeredNoise(random: &random, octaves: 3, frequency: 0.1)
|
||||
}
|
||||
|
||||
public func makeChunk(id chunkID: SIMD3<Int>) -> Chunk {
|
||||
let chunkOrigin = chunkID &<< Chunk.shift
|
||||
public func makeChunk(id chunkID: ChunkID) -> Chunk {
|
||||
let chunkOrigin = chunkID.getPosition()
|
||||
var chunk = Chunk(position: chunkOrigin)
|
||||
chunk.fill(allBy: { position in
|
||||
let fpos = SIMD3<Float>(chunkOrigin &+ position)
|
||||
|
@ -1,6 +1,6 @@
|
||||
public protocol WorldGenerator {
|
||||
mutating func reset(seed: UInt64)
|
||||
func makeChunk(id: SIMD3<Int>) -> Chunk
|
||||
func makeChunk(id: ChunkID) -> Chunk
|
||||
}
|
||||
|
||||
internal extension RandomProvider where Output == UInt64, Self: RandomSeedable, SeedType == UInt64 {
|
||||
|
Reference in New Issue
Block a user