Giter Site home page Giter Site logo

accidentalnoiselibraryforjava's Introduction

Image

Joise

Joise is a 2D, 3D, 4D and 6D modular noise library written in Java.

Joise is derived from Joshua Tippetts' Accidental Noise Library written in C++.

Maven:

groupId=com.sudoplay.joise
artifactId=joise
version=1.0.1

Why Joise?

Joise was created to facilitate the creation of complex noise functions from chained modules, and represent the chained modules in a consistent format.

Joise was originally created to power the procedural world-building algorithms behind the PC game, Lodestar: Stygian Skies.

What is in this repository?

Documentation:

  • README.md this file
  • LICENSE the license (link)

The repo contains the following packages:

  • com.sudoplay.joise contains classes to work with module maps.
  • com.sudoplay.joise.generator contains classes to generate pseudo-random numbers.
  • com.sudoplay.joise.mapping contains classes assist in mapping noise to arrays.
  • com.sudoplay.joise.module contains all the noise function modules.
  • com.sudoplay.joise.noise contains the core noise functions.
  • com.sudoplay.util contains common utility classes.

The following packages are provided separately to reduce dependencies:

Examples

###Chaining Modules Most modules accept one or more sources. Sources can either be a module or a double value.

ModuleBasisFunction basis = new ModuleBasisFunction();
basis.setType(BasisType.SIMPLEX);
basis.setSeed(42);

ModuleAutoCorrect correct = new ModuleAutoCorrect();
correct.setSource(basis);
correct.calculate();

ModuleScaleDomain scaleDomain = new ModuleScaleDomain();
scaleDomain.setSource(correct);
scaleDomain.setScaleX(4.0);
scaleDomain.setScaleY(4.0);

###Sampling Chained Modules A module chain can be sampled in either two, three, four or six dimensions. Four and six dimensional noise is used for creating seamless two and three dimensional noise, respectively.

lastModuleInChain.get(x, y);
lastModuleInChain.get(x, y, z);
lastModuleInChain.get(x, y, z, w);
lastModuleInChain.get(x, y, z, w, u, v);

###Exporting a Module Chain Module chains can be converted to and from a ModuleMap. This is convenient for serializing module chains, as serializers have a consistent format to rely on.

// convert to a ModuleMap
ModuleMap moduleMap = lastModuleInChain.getModuleMap();
// convert from a ModuleMap
Joise joise = new Joise(moduleMap);
// sample the resulting chain
joise.get(x, y, z);

###Naming Seeds Seeds can be named. This is convenient if you want to load a module chain from an external format, and set seeds programatically.

ModuleBasisFunction basis = new ModuleBasisFunction();
basis.setSeedName("worldseed");
ModuleMap moduleMap = basis.getModuleMap();

// ... save the module map to some external format ...

// ... load the module map back in later ...

Joise joise = new Joise(loadedModuleMap);
if (joise.hasSeed("worldseed")) {
  joise.setSeed("worldseed", 42);
}

##License

Copyright (C) 2013 Jason Taylor. Released as open-source under Apache License, Version 2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.