@@ -9,12 +9,21 @@ simplex-noise.js is a fast simplex noise implementation in Javascript. It works
99- [ 3D voxel world generation] ( http://29a.ch/sandbox/2012/voxelworld/ ) example.
1010- Film grain in [ analog film emulator] ( http://29a.ch/film-emulator/ ) .
1111
12+ Created something awesome with simplex-noise? Let me know so I can add it to the list.
13+
1214## Installation
1315
1416``` npm i -S simplex-noise ```
1517
1618## Usage
1719
20+ ``` javascript
21+ // when using es modules
22+ import SimplexNoise from ' simplex-noise' ;
23+ // when using commonjs
24+ const {SimplexNoise } = require (' simplex-noise' );
25+ ```
26+
1827By default simplex-noise.js will use Math.random() to seed the noise.
1928``` javascript
2029// initializing a new simplex instance
@@ -61,12 +70,18 @@ const SimplexNoise = require('simplex-noise'),
6170
6271## Benchmarks
6372
64- - [ Comparison between 2D and 3D noise] ( http://jsperf.com/simplex-noise/4 )
65- - [ Comparison with simplex implementation in three.js] ( http://jsperf.com/simplex-noise-comparison/3 )
73+ simplex-noise.js is reasonably quick.
74+ According to ` perf/benchmark.js ` I can perform about 50 million ` noise2D() ` calls/second on a single thread on my desktop (Ryzen 5950X).
75+ So ~ 20 nanoseconds per call.
6676
67- For development you can open ` perf/index.html ` and watch the console or run ` node perf/benchmark.js ` in a shell.
68- There is also a rake task for comparing your current changes can also run ` make compare ` .
69- The command works using git stash.
77+ ```
78+ $ node perf/index.js
79+ 27745787.933336906
80+ init: 192,590 ops/sec ±1%
81+ noise2D: 57,928,891 ops/sec ±1%
82+ noise3D: 34,159,230 ops/sec ±0%
83+ noise4D: 24,589,786 ops/sec ±0%
84+ ```
7085
7186## Tests
7287
@@ -77,7 +92,8 @@ npm install && npm test
7792
7893## Changelog
7994
80- ### main
95+ ### 3.0.0
96+ - Changed module structure. When using bundlers that import the es module even using require() the import might need to be updated.
8197- Dependency update
8298- Setting sideEffects: false in package.json
8399- Added snapshot tests
0 commit comments