docs: add godoc comments to all exported functions and methods

This commit is contained in:
adman
2026-07-30 00:20:55 +02:00
parent 56c97a2b3f
commit 0d6b6e1ab9
50 changed files with 186 additions and 408 deletions
+1
View File
@@ -48,6 +48,7 @@ type BiomeNoise struct {
Temperature, Humidity, ContinentalNess, Erosion, Shift, Weirdness DoublePerlin
}
// BiomeNoiseFromXoroshiro creates a BiomeNoise from the given Xoroshiro source.
func BiomeNoiseFromXoroshiro(x Xoroshiro, large bool) (v BiomeNoise) {
x = x.Split()
+1
View File
@@ -6,6 +6,7 @@ type DoublePerlin struct {
B Octave
}
// DoublePerlinFromXoroshiro creates a DoublePerlin from the given Xoroshiro source.
func DoublePerlinFromXoroshiro(x *Xoroshiro, amplitudes []float64, omin int, lenn int, nmax int) (d DoublePerlin) {
na := -1
nb := -1
+1
View File
@@ -116,6 +116,7 @@ func (n PerlinNoise) Sample(x, y, z float64, yamp, ymin float64) (v float64) {
return lerp(t3, l1, l5)
}
// PerlinNoiseFromXoroshiro initializes a PerlinNoise from the given Xoroshiro source.
func PerlinNoiseFromXoroshiro(x Xoroshiro) (p PerlinNoise) {
p.xoffset = x.NextFloat64() * 256.0
p.yoffset = x.NextFloat64() * 256.0
+1
View File
@@ -28,6 +28,7 @@ var octaveLacunaInits = []float64{1, .5, .25, 1. / 8, 1. / 16, 1. / 32, 1. / 64,
var octavePersistInits = []float64{0, 1, 2. / 3, 4. / 7, 8. / 15, 16. / 31, 32. / 63, 64. / 127, 128. / 255, 256. / 511, 512. / 1023,
1024. / 2047, 2048. / 4095, 4096. / 8191, 8192. / 16383, 16384. / 32767, 32768. / 65535}
// OctaveFromXoroshiro creates an Octave (multi-octave Perlin noise) from the given Xoroshiro source.
func OctaveFromXoroshiro(x *Xoroshiro, amplitudes []float64, omin int, lenn int, nmax int) (o Octave) {
if (-omin < 0 || -omin >= len(octaveLacunaInits)) || (lenn < 0 || lenn >= len(octavePersistInits)) {
panic("octave initialization out of range")
+1
View File
@@ -183,6 +183,7 @@ func landSpline(f, g, h, i, j, k float32, bl bool) Spline {
return s
}
// CreateBiomeDepthSpline builds the Minecraft biome depth spline used for terrain generation.
func CreateBiomeDepthSpline() Spline {
sp1 := landSpline(-0.15, 0.00, 0.0, 0.1, 0.00, -0.03, false)
sp2 := landSpline(-0.10, 0.03, 0.1, 0.1, 0.01, -0.03, false)
+2
View File
@@ -42,6 +42,7 @@ func (x *Xoroshiro) NextFloat64() float64 {
return float64(x.Next()>>(64-53)) * 1.1102230246251565e-16
}
// XoroshiroFromString creates an Xoroshiro from an MD5 hash of the given string.
func XoroshiroFromString(s string) (x Xoroshiro) {
sum := md5.Sum([]byte(s))
x.L = binary.BigEndian.Uint64(sum[:8])
@@ -49,6 +50,7 @@ func XoroshiroFromString(s string) (x Xoroshiro) {
return
}
// XoroshiroFromSeed creates an Xoroshiro from an int64 seed.
func XoroshiroFromSeed(seed int64) (x Xoroshiro) {
x.L = uint64(seed) ^ 0x6a09e667f3bcc909
x.H = x.L + 0x9e3779b97f4a7c15