Skip to content

A1essandro/perlin-noise-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perlin-noise-generator

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

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
]);