worldgen: add vanilla biome search and decoration RNG
This commit is contained in:
parent
736f387b41
commit
fd32c65da9
6 changed files with 383 additions and 10 deletions
25
internal/worldgen/simplex_noise_test.go
Normal file
25
internal/worldgen/simplex_noise_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package worldgen
|
||||
|
||||
import (
|
||||
"math"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBiomeInfoNoiseVanillaVectors(t *testing.T) {
|
||||
tests := []struct {
|
||||
x, z int
|
||||
want float64
|
||||
}{
|
||||
{0, 0, 0},
|
||||
{16, 0, 0.6210549241139091},
|
||||
{0, 16, -0.005784055694146521},
|
||||
{-16, -16, -0.3789716250634575},
|
||||
{123, 456, 0.43256906665489797},
|
||||
}
|
||||
for _, test := range tests {
|
||||
got := BiomeInfoNoise(float64(test.x)/80, float64(test.z)/80)
|
||||
if math.Float64bits(got) != math.Float64bits(test.want) {
|
||||
t.Errorf("BiomeInfoNoise(%d,%d) = %.17g, want %.17g", test.x, test.z, got, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue