Package overrungl.stb

Class STBPerlin

java.lang.Object
overrungl.stb.STBPerlin

public final class STBPerlin extends Object
The STB perlin noise generator.
Since:
0.1.0
Author:
squid233
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    fbmNoise3(float x, float y, float z, float lacunarity, float gain, int octaves)
    Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided.
    static float
    noise3(float x, float y, float z, int wrapX, int wrapY, int wrapZ)
    This function computes a random value at the coordinate (x,y,z).
    Adjacent random values are continuous but the noise fluctuates its randomness with period 1, i.e.
    static float
    noise3seed(float x, float y, float z, int wrapX, int wrapY, int wrapZ, int seed)
    As noise3(float, float, float, int, int, int), but 'seed' selects from multiple different variations of the noise function.
    static float
    noise3wrapNonpow2(float x, float y, float z, int wrapX, int wrapY, int wrapZ, byte seed)
     
    static float
    ridgeNoise3(float x, float y, float z, float lacunarity, float gain, float offset, int octaves)
    Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided.
    static float
    turbulenceNoise3(float x, float y, float z, float lacunarity, float gain, int octaves)
    Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • noise3

      public static float noise3(float x, float y, float z, int wrapX, int wrapY, int wrapZ)
      This function computes a random value at the coordinate (x,y,z).
      Adjacent random values are continuous but the noise fluctuates its randomness with period 1, i.e. takes on wholly unrelated values at integer points. Specifically, this implements Ken Perlin's revised noise function from 2002.

      The "wrap" parameters can be used to create wraparound noise that wraps at powers of two. The numbers MUST be powers of two. Specify 0 to mean "don't care". (The noise always wraps every 256 due details of the implementation, even if you ask for larger or no wrapping.)

      Parameters:
      x - x
      y - y
      z - z
      wrapX - wrap x
      wrapY - wrap y
      wrapZ - wrap z
      Returns:
      the value
    • noise3seed

      public static float noise3seed(float x, float y, float z, int wrapX, int wrapY, int wrapZ, int seed)
      As noise3(float, float, float, int, int, int), but 'seed' selects from multiple different variations of the noise function. The current implementation only uses the bottom 8 bits of 'seed', but possibly in the future more bits will be used.
      Parameters:
      x - x
      y - y
      z - z
      wrapX - wrap x
      wrapY - wrap y
      wrapZ - wrap z
      seed - the seed
      Returns:
      the value
    • ridgeNoise3

      public static float ridgeNoise3(float x, float y, float z, float lacunarity, float gain, float offset, int octaves)
      Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided. Note that each function will call stb_perlin_noise3 'octaves' times, so this parameter will affect runtime.
      Parameters:
      x - x
      y - y
      z - z
      lacunarity - = ~ 2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output)
      gain - = 0.5 -- relative weighting applied to each successive octave
      offset - = 1.0? -- used to invert the ridges, may need to be larger, not sure
      octaves - = 6 -- number of "octaves" of noise3() to sum
      Returns:
      the value
    • fbmNoise3

      public static float fbmNoise3(float x, float y, float z, float lacunarity, float gain, int octaves)
      Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided. Note that each function will call stb_perlin_noise3 'octaves' times, so this parameter will affect runtime.
      Parameters:
      x - x
      y - y
      z - z
      lacunarity - = ~ 2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output)
      gain - = 0.5 -- relative weighting applied to each successive octave
      octaves - = 6 -- number of "octaves" of noise3() to sum
      Returns:
      the value
    • turbulenceNoise3

      public static float turbulenceNoise3(float x, float y, float z, float lacunarity, float gain, int octaves)
      Three common fractal noise functions are included, which produce a wide variety of nice effects depending on the parameters provided. Note that each function will call stb_perlin_noise3 'octaves' times, so this parameter will affect runtime.
      Parameters:
      x - x
      y - y
      z - z
      lacunarity - = ~ 2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output)
      gain - = 0.5 -- relative weighting applied to each successive octave
      octaves - = 6 -- number of "octaves" of noise3() to sum
      Returns:
      the value
    • noise3wrapNonpow2

      public static float noise3wrapNonpow2(float x, float y, float z, int wrapX, int wrapY, int wrapZ, byte seed)