https://github.com/landlockedboat/cordillera
Very simple heightmap generator
https://github.com/landlockedboat/cordillera
Last synced: 3 months ago
JSON representation
Very simple heightmap generator
- Host: GitHub
- URL: https://github.com/landlockedboat/cordillera
- Owner: landlockedboat
- License: mit
- Created: 2018-10-01T11:04:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T12:02:10.000Z (over 6 years ago)
- Last Synced: 2025-02-16T20:08:24.904Z (3 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# cordillera [](https://travis-ci.org/vikepic/cordillera)
> A heightmap generator. Shamelessly stolen from @hunterloftis.
For more info about how it works, visit this [page](http://www.playfuljs.com/realistic-terrain-in-130-lines/);
## Install
```
$ npm install cordillera
```## Usage
```js
const Cordillera = require('cordillera');var width = 3;
var height = 5;
var roughness = .7;
const heightmap = new Cordillera(roughness, width, height);
/*
Cordillera {
size: 9,
width: 3,
height: 5,
max: 8,
maxGenValue: 9.075803001895423,
minGenValue: -2.206409904484188,
map:
[ [ 8, 9.007745742797852, 8.201483726501465 ],
[ 6.600325584411621, 7.849488258361816, 7.690467834472656 ],
[ 7.2525739669799805, 7.150480270385742, 4.565466403961182 ],
[ 4.739648818969727, 5.628500938415527, 6.544771194458008 ],
[ 3.1494858264923096, 3.598397970199585, 6.680818557739258 ] ] }
*/const levels = heightmap.getLevels(3);
/*
[ [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 1 ], [ 1, 2, 2 ], [ 1, 1, 2 ] ]
*/```
## License
MIT © [vikepic](https://vikepic.github.io)