Improved biome generation, get grass color from gradient interpolation, improved performance of generation, try to recreate grass colors from imported chunks, closes #2845, closes #1792

This commit is contained in:
Shoghi Cervantes
2015-06-07 15:17:02 +02:00
parent d881dbf1a2
commit cbb1c55a06
23 changed files with 142 additions and 126 deletions

View File

@ -31,11 +31,10 @@ class Perlin extends Noise{
];
public function __construct(Random $random, $octaves, $frequency, $amplitude, $lacunarity){
public function __construct(Random $random, $octaves, $persistence, $expansion = 1){
$this->octaves = $octaves;
$this->frequency = $frequency;
$this->lacunarity = $lacunarity;
$this->amplitude = $amplitude;
$this->persistence = $persistence;
$this->expansion = $expansion;
$this->offsetX = $random->nextFloat() * 256;
$this->offsetY = $random->nextFloat() * 256;
$this->offsetZ = $random->nextFloat() * 256;
@ -80,9 +79,9 @@ class Perlin extends Noise{
//$fX = self::fade($x);
//$fY = self::fade($y);
//$fZ = self::fade($z);
$fX = $x ** 3 * ($x * ($x * 6 - 15) + 10);
$fY = $y ** 3 * ($y * ($y * 6 - 15) + 10);
$fZ = $z ** 3 * ($z * ($z * 6 - 15) + 10);
$fX = $x * $x * $x * ($x * ($x * 6 - 15) + 10);
$fY = $y * $y * $y * ($y * ($y * 6 - 15) + 10);
$fZ = $z * $z * $z * ($z * ($z * 6 - 15) + 10);
//Cube corners
$A = $this->perm[$X] + $Y;