fix significant oversights in noise & random

This commit is contained in:
2024-09-05 21:46:49 +10:00
parent 2a4eb2283a
commit 301aa28c4d
9 changed files with 41 additions and 55 deletions

View File

@ -18,7 +18,7 @@ struct StandardWorldGenerator: WorldGenerator {
let chunkOrigin = chunkID &<< Chunk.shift
var chunk = Chunk(position: chunkOrigin)
chunk.fill(allBy: { position in
let fpos = SIMD3<Float>(position)
let fpos = SIMD3<Float>(chunkOrigin &+ position)
let threshold: Float = 0.6
let value = fpos.y / 16.0
+ self.noise.get(fpos * 0.05) * 1.1

View File

@ -6,15 +6,15 @@ struct TerrorTowerGenerator: WorldGenerator {
public mutating func reset(seed: UInt64) {
var random = Xoroshiro128PlusPlus(state: SplitMix64.createState(seed: seed))
self.noise1 = LayeredNoise(random: &random, octaves: 4, frequency: 0.05, amplitude: 1.1)
self.noise2 = LayeredNoise(random: &random, octaves: 3, frequency: 0.1, amplitude: 0.5)
self.noise1 = LayeredNoise(random: &random, octaves: 4, frequency: 0.05, amplitude: 2.2)
self.noise2 = LayeredNoise(random: &random, octaves: 3, frequency: 0.1)
}
public func makeChunk(id chunkID: SIMD3<Int>) -> Chunk {
let chunkOrigin = chunkID &<< Chunk.shift
var chunk = Chunk(position: chunkOrigin)
chunk.fill(allBy: { position in
let fpos = SIMD3<Float>(position)
let fpos = SIMD3<Float>(chunkOrigin &+ position)
let threshold: Float = 0.6
let gradient = simd_length(fpos.xz) / 14.0
let value = self.noise1.get(fpos) - 0.25