a1essandro / perlin-noise
Algorithm for generating heightmaps
Installs: 4 065
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 4
Open Issues: 2
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.7.*
- satooshi/php-coveralls: ~1.0
This package is not auto-updated.
Last update: 2025-01-04 19:37:33 UTC
README
Description
Heightmaps generator on PHP using perlin-noise algorithm.
See also Diamond-Square algorithm with the similar API.
Requirements
This package is only supported on PHP 5.3 and above.
Installing
Composer
See more getcomposer.org.
Execute command
composer require a1essandro/perlin-noise ~1.0
Usage
$generator = new MapGenerator\PerlinNoiseGenerator(); $generator->setSize(100); //heightmap size: 100x100 $generator->setPersistence(0.8); //map roughness $generator->setMapSeed('value'); //optional $map = $generator->generate();
or
$generator = new MapGenerator\PerlinNoiseGenerator(); $map = $generator->generate([ PerlinNoiseGenerator::SIZE => 100, PerlinNoiseGenerator::PERSISTENCE => 0.8, PerlinNoiseGenerator::MAP_SEED => 'value' ]);
mixed:
$generator = new MapGenerator\PerlinNoiseGenerator(); $generator->setSize(100); $map = $generator->generate([ PerlinNoiseGenerator::PERSISTENCE => 0.8 ]);