boolean hasBlock(double density, double x, double y, double z, int seed) { return density >= this.densityThreshold && Noise.gradientCoherentNoise3D(x * this.frequency, y * this.frequency, z * this.frequency, seed ^ this.seedModifier, NoiseQuality.FAST) >= this.noiseThreshold; }
@Override public double getValue(double x, double y, double z) { int ix = Utils.floor(Utils.makeInt32Range(x)); int iy = Utils.floor(Utils.makeInt32Range(y)); int iz = Utils.floor(Utils.makeInt32Range(z)); return ((ix & 1 ^ iy & 1 ^ iz & 1) != 0) ? -1.0 : 1.0; } }
/** * Generates a value-noise value from the coordinates of a three-dimensional input value. * * @param x The @a x coordinate of the input value. * @param y The @a y coordinate of the input value. * @param z The @a z coordinate of the input value. * @param seed A random number seed. * @return The generated value-noise value. * <p/> * The return value ranges from 0 to 1. * <p/> * A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it. */ public static double valueNoise3D(int x, int y, int z, int seed) { return intValueNoise3D(x, y, z, seed) / 2147483647.0; } }
nx = Utils.makeInt32Range(x1); ny = Utils.makeInt32Range(y1); nz = Utils.makeInt32Range(z1); signal = Noise.gradientCoherentNoise3D(nx, ny, nz, seed, noiseQuality); value += signal * curPersistence;
@Override public double getValue(double x, double y, double z) { double z1 = z; double x1 = x; x1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 4.0); // Puts it in the -1.0 to +1.0 range. } }
nx = Utils.makeInt32Range(x1); ny = Utils.makeInt32Range(y1); nz = Utils.makeInt32Range(z1); signal = Noise.gradientCoherentNoise3D(nx, ny, nz, seed, noiseQuality); value += signal * curPersistence;
break; if (Noise.gradientCoherentNoise3D(xx * 0.01, 0, zz * 0.01, intSeed ^ layerNumber, NoiseQuality.FAST) < HOLE_THRESHOLD) { layerIteration: for (GroundCoverLayer layer : LAYERS) {
@Override public double getValue(double x, double y, double z) { int ix = Utils.floor(Utils.makeInt32Range(x)); int iy = Utils.floor(Utils.makeInt32Range(y)); int iz = Utils.floor(Utils.makeInt32Range(z)); return ((ix & 1 ^ iy & 1 ^ iz & 1) != 0) ? 0 : 1.0; } }
@Override public double getValue(double x, double y, double z) { double z1 = z; double x1 = x; x1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 2.0); // Puts it in the 0 to 1 range. } }
/** * Generates a value-noise value from the coordinates of a three-dimensional input value. * * @param x The @a x coordinate of the input value. * @param y The @a y coordinate of the input value. * @param z The @a z coordinate of the input value. * @param seed A random number seed. * @return The generated value-noise value. * <p/> * The return value ranges from -1.0 to +1.0. * <p/> * A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it. */ public static double valueNoise3D(int x, int y, int z, int seed) { return 1.0 - (intValueNoise3D(x, y, z, seed) / 1073741824.0); } }
nx = Utils.makeInt32Range(x1); ny = Utils.makeInt32Range(y1); nz = Utils.makeInt32Range(z1); signal = Noise.gradientCoherentNoise3D(nx, ny, nz, seed, noiseQuality); value += signal * curPersistence;
boolean hasBlock(double density, double x, double y, double z, int seed) { return density >= this.densityThreshold && Noise.gradientCoherentNoise3D(x * this.frequency, y * this.frequency, z * this.frequency, seed ^ this.seedModifier, NoiseQuality.FAST) >= this.noiseThreshold; }
@Override public double getValue(double x, double y, double z) { int ix = Utils.floor(Utils.makeInt32Range(x)); int iy = Utils.floor(Utils.makeInt32Range(y)); int iz = Utils.floor(Utils.makeInt32Range(z)); return ((ix & 1 ^ iy & 1 ^ iz & 1) != 0) ? 0 : 1.0; } }
@Override public double getValue(double x, double y, double z) { double z1 = z; double x1 = x; x1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 2.0); // Puts it in the 0 to 1 range. } }
/** * Generates a value-noise value from the coordinates of a three-dimensional input value. * * @param x The @a x coordinate of the input value. * @param y The @a y coordinate of the input value. * @param z The @a z coordinate of the input value. * @param seed A random number seed. * @return The generated value-noise value. * <p/> * The return value ranges from 0 to 1. * <p/> * A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it. */ public static double valueNoise3D(int x, int y, int z, int seed) { return intValueNoise3D(x, y, z, seed) / 2147483647.0; } }
nx = Utils.makeInt32Range(x1); ny = Utils.makeInt32Range(y1); nz = Utils.makeInt32Range(z1); signal = Noise.gradientCoherentNoise3D(nx, ny, nz, seed, quality); signal = 2.0 * Math.abs(signal) - 1.0; value += signal * curPersistence;
@Override public double getValue(double x, double y, double z) { double x1 = x; double y1 = y; double z1 = z; x1 *= frequency; y1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 4.0); // Puts it in the -1.0 to +1.0 range. } }
nx = Utils.makeInt32Range(x1); ny = Utils.makeInt32Range(y1); nz = Utils.makeInt32Range(z1); signal = Noise.gradientCoherentNoise3D(nx, ny, nz, seed, quality) * 2 - 1; signal = Math.abs(signal); value += signal * curPersistence;
@Override public double getValue(double x, double y, double z) { double x1 = x; double y1 = y; double z1 = z; x1 *= frequency; y1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 2.0); // Puts it in the 0 to 1 range. } }
@Override public double getValue(double x, double y, double z) { double x1 = x; double y1 = y; double z1 = z; x1 *= frequency; y1 *= frequency; z1 *= frequency; double distFromCenter = Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1); double distFromSmallerSphere = distFromCenter - Utils.floor(distFromCenter); double distFromLargerSphere = 1.0 - distFromSmallerSphere; double nearestDist = Math.min(distFromSmallerSphere, distFromLargerSphere); return 1.0 - (nearestDist * 2.0); // Puts it in the 0 to 1 range. } }