A noise library for LFE/Erlang


License
Apache-2.0

Documentation

Loise

Build Status LFE Versions Erlang Versions Tags

A noise library for LFE/Erlang

Loise project logo

Contents

Introduction

This is a library, written in LFE, useful for generating Perlin and Simplex noise. There's more info in the docs on the background of both. This LFE noise library may be used as simply that (a library) but it also supports more: stateful management of multiple "matrices" (renderable as images) and the navigation / examination of that generated noise data.

Dependencies

This project requires that you have Erlang installed (tested with R15B03, R16B03, 17.5, 18.0, and 18.3). It also assumes that you have rebar3 installed somwhere in your $PATH.

Building and Starting

Preliminary steps:

rebar3 compile
rebar3 lfe repl

The loise library maintains state and as such must be run in order to use, even when simply used as a library. From the REPL:

lfe> (loise:start)
#(ok (loise))

For non-REPL use, in your project, simply add loise to the applications list:

{applications, [
    kernel,
    stdlib,
    loise
]},

Usage Examples

The following usage example is just the merest fraction of what you can do with loise. Be sure to see the Documentation section below for links to usage examples for specific features.

Perlin smooth:

lfe> (set opts #m(noise perlin multiplier 1))
lfe> (loise:image "perlin-4.png" (mupd opts 'multiplier 4))
ok

Perlin graded:

lfe> (set opts `#m(noise perlin
                   multiplier 4
                   graded? true
                   grades-count 8))
lfe> (loise:image "perlin-8-shades.png" opts)
ok

Simplex smooth:

lfe> (set opts #m(noise simplex multiplier 4))
lfe> (loise:image "simplex-4.png" opts)
ok

Simplex graded:

lfe> (set opts (mset opts 'graded? 'true
                          'grades-count 5
                          'multiplier 4))
lfe> (loise:image "simplex-5-shades.png" opts)
ok

Simplex as coloured ASCII:

lfe> (loise:format-ascii #m(color? true))

Documentation

License

Copyright © 2013-2023 Duncan McGreggor

Distributed under the Apache License, Version 2.0.