Package org.lwjgl.stb

Class STBPerlin


  • public class STBPerlin
    extends java.lang.Object
    Native bindings to stb_perlin.h from the stb library.

    Revised Perlin noise (3D input, 1D output).

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static float stb_perlin_fbm_noise3​(float x, float y, float z, float lacunarity, float gain, int octaves)
      Computes Fractal Brownian Motion noise.
      static float stb_perlin_noise3​(float x, float y, float z, int x_wrap, int y_wrap, int z_wrap)
      Computes a random value at the coordinate (x,y,z).
      static float stb_perlin_noise3_seed​(float x, float y, float z, int x_wrap, int y_wrap, int z_wrap, int seed)
      As perlin_noise3, but seed selects from multiple different variations of the noise function.
      static float stb_perlin_noise3_wrap_nonpow2​(float x, float y, float z, int x_wrap, int y_wrap, int z_wrap, byte seed)  
      static float stb_perlin_ridge_noise3​(float x, float y, float z, float lacunarity, float gain, float offset, int octaves)
      Computes ridged noise.
      static float stb_perlin_turbulence_noise3​(float x, float y, float z, float lacunarity, float gain, int octaves)
      Computes turbulence noise.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stb_perlin_noise3

        public static float stb_perlin_noise3​(float x,
                                              float y,
                                              float z,
                                              int x_wrap,
                                              int y_wrap,
                                              int z_wrap)
        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 - the x coordinate
        y - the y coordinate
        z - the z coordinate
        x_wrap - 0, or a power of two value that specifies the x wraparound coordinate
        y_wrap - 0, or a power of two value that specifies the y wraparound coordinate
        z_wrap - 0, or a power of two value that specifies the z wraparound coordinate
      • stb_perlin_noise3_seed

        public static float stb_perlin_noise3_seed​(float x,
                                                   float y,
                                                   float z,
                                                   int x_wrap,
                                                   int y_wrap,
                                                   int z_wrap,
                                                   int seed)
        As perlin_noise3, 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 - the x coordinate
        y - the y coordinate
        z - the z coordinate
        x_wrap - 0, or a power of two value that specifies the x wraparound coordinate
        y_wrap - 0, or a power of two value that specifies the y wraparound coordinate
        z_wrap - 0, or a power of two value that specifies the z wraparound coordinate
        seed - selects from multiple different variations of the noise function
      • stb_perlin_ridge_noise3

        public static float stb_perlin_ridge_noise3​(float x,
                                                    float y,
                                                    float z,
                                                    float lacunarity,
                                                    float gain,
                                                    float offset,
                                                    int octaves)
        Computes ridged noise. Calls perlin_noise3 octaves times, so this parameter will affect runtime.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        z - the z coordinate
        lacunarity - spacing between successive octaves (use exactly 2.0 for wrapping output)
        gain - relative weighting applied to each successive octave
        offset - used to invert the ridges, may need to be larger, not sure
        octaves - number of "octaves" of noise3() to sum
      • stb_perlin_fbm_noise3

        public static float stb_perlin_fbm_noise3​(float x,
                                                  float y,
                                                  float z,
                                                  float lacunarity,
                                                  float gain,
                                                  int octaves)
        Computes Fractal Brownian Motion noise. Calls perlin_noise3 octaves times, so this parameter will affect runtime.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        z - the z coordinate
        lacunarity - spacing between successive octaves (use exactly 2.0 for wrapping output)
        gain - relative weighting applied to each successive octave
        octaves - number of "octaves" of noise3() to sum
      • stb_perlin_turbulence_noise3

        public static float stb_perlin_turbulence_noise3​(float x,
                                                         float y,
                                                         float z,
                                                         float lacunarity,
                                                         float gain,
                                                         int octaves)
        Computes turbulence noise. Calls perlin_noise3 octaves times, so this parameter will affect runtime.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        z - the z coordinate
        lacunarity - spacing between successive octaves (use exactly 2.0 for wrapping output)
        gain - relative weighting applied to each successive octave
        octaves - number of "octaves" of noise3() to sum
      • stb_perlin_noise3_wrap_nonpow2

        public static float stb_perlin_noise3_wrap_nonpow2​(float x,
                                                           float y,
                                                           float z,
                                                           int x_wrap,
                                                           int y_wrap,
                                                           int z_wrap,
                                                           byte seed)