Search in sources :

Example 1 with NoiseFunction

use of com.jme3.scene.plugins.blender.textures.generating.NoiseGenerator.NoiseFunction in project jmonkeyengine by jMonkeyEngine.

the class TextureGeneratorDistnoise method musgraveVariableLunacrityNoise.

/**
     * "Variable Lacunarity Noise" A distorted variety of Perlin noise. This method is used to calculate distorted noise
     * texture.
     * @param x
     * @param y
     * @param z
     * @param distortion
     * @param nbas1
     * @param nbas2
     * @return
     */
private float musgraveVariableLunacrityNoise(float x, float y, float z, float distortion, int nbas1, int nbas2) {
    NoiseFunction abstractNoiseFunc1 = NoiseGenerator.noiseFunctions.get(Integer.valueOf(nbas1));
    if (abstractNoiseFunc1 == null) {
        abstractNoiseFunc1 = NoiseGenerator.noiseFunctions.get(Integer.valueOf(0));
    }
    NoiseFunction abstractNoiseFunc2 = NoiseGenerator.noiseFunctions.get(Integer.valueOf(nbas2));
    if (abstractNoiseFunc2 == null) {
        abstractNoiseFunc2 = NoiseGenerator.noiseFunctions.get(Integer.valueOf(0));
    }
    // get a random vector and scale the randomization
    float rx = abstractNoiseFunc1.execute(x + 13.5f, y + 13.5f, z + 13.5f) * distortion;
    float ry = abstractNoiseFunc1.execute(x, y, z) * distortion;
    float rz = abstractNoiseFunc1.execute(x - 13.5f, y - 13.5f, z - 13.5f) * distortion;
    // distorted-domain noise
    return abstractNoiseFunc2.executeSigned(x + rx, y + ry, z + rz);
}
Also used : NoiseFunction(com.jme3.scene.plugins.blender.textures.generating.NoiseGenerator.NoiseFunction)

Aggregations

NoiseFunction (com.jme3.scene.plugins.blender.textures.generating.NoiseGenerator.NoiseFunction)1