Search in sources :

Example 1 with VoronoiResult

use of rtg.api.util.noise.VoronoiResult in project Realistic-Terrain-Generation by Team-RTG.

the class IRealisticBiome method lakePressure.

default default float lakePressure(RTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) {
    if (!this.getConfig().ALLOW_SCENIC_LAKES.get())
        return 1f;
    SimplexOctave.Disk jitter = new SimplexOctave.Disk();
    rtgWorld.simplex.riverJitter().evaluateNoise((float) x / 240.0, (float) y / 240.0, jitter);
    double pX = x + jitter.deltax() * largeBendSize;
    double pY = y + jitter.deltay() * largeBendSize;
    rtgWorld.simplex.mountain().evaluateNoise((float) x / 80.0, (float) y / 80.0, jitter);
    pX += jitter.deltax() * mediumBendSize;
    pY += jitter.deltay() * mediumBendSize;
    rtgWorld.simplex.octave(4).evaluateNoise((float) x / 30.0, (float) y / 30.0, jitter);
    pX += jitter.deltax() * smallBendSize;
    pY += jitter.deltay() * smallBendSize;
    //double results =simplexCell.river().noise(pX / lakeInterval, pY / lakeInterval,1.0);
    VoronoiResult lakeResults = rtgWorld.cell.river().eval((float) pX / lakeInterval, (float) pY / lakeInterval);
    float results = 1f - (float) (lakeResults.interiorValue());
    if (results > 1.01)
        throw new RuntimeException("" + lakeResults.shortestDistance + " , " + lakeResults.nextDistance);
    if (results < -.01)
        throw new RuntimeException("" + lakeResults.shortestDistance + " , " + lakeResults.nextDistance);
    //return simplexCell.river().noise((float)x/ lakeInterval, (float)y/ lakeInterval,1.0);
    return results;
}
Also used : SimplexOctave(rtg.api.util.noise.SimplexOctave) VoronoiResult(rtg.api.util.noise.VoronoiResult)

Example 2 with VoronoiResult

use of rtg.api.util.noise.VoronoiResult in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeBase method lakePressure.

@Override
public float lakePressure(RTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) {
    if (!this.getConfig().ALLOW_SCENIC_LAKES.get()) {
        return 1f;
    }
    double pX = x;
    double pY = y;
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    rtgWorld.simplexInstance(1).multiEval2D(x / 240.0d, y / 240.0d, jitterData);
    pX += jitterData.getDeltaX() * largeBendSize;
    pY += jitterData.getDeltaY() * largeBendSize;
    rtgWorld.simplexInstance(0).multiEval2D(x / 80.0d, y / 80.0d, jitterData);
    pX += jitterData.getDeltaX() * mediumBendSize;
    pY += jitterData.getDeltaY() * mediumBendSize;
    rtgWorld.simplexInstance(4).multiEval2D(x / 30.0d, y / 30.0d, jitterData);
    pX += jitterData.getDeltaX() * smallBendSize;
    pY += jitterData.getDeltaY() * smallBendSize;
    VoronoiResult lakeResults = rtgWorld.cellularInstance(0).eval2D(pX / lakeInterval, pY / lakeInterval);
    return (float) (1.0d - lakeResults.interiorValue());
}
Also used : ISimplexData2D(rtg.api.util.noise.ISimplexData2D) VoronoiResult(rtg.api.util.noise.VoronoiResult)

Example 3 with VoronoiResult

use of rtg.api.util.noise.VoronoiResult in project Realistic-Terrain-Generation by Team-RTG.

the class VoronoiBasinEffect method added.

@Override
public float added(RTGWorld rtgWorld, float x, float y) {
    Point2D.Float evaluateAt = new Point2D.Float(x / pointWavelength, y / pointWavelength);
    VoronoiResult points = rtgWorld.cellularInstance(1).eval2D(evaluateAt.x, evaluateAt.y);
    float raise = (float) (points.borderValue());
    // now we're going to get an adjustment value which will be the same
    // for all points on a given vector from the voronoi basin center
    Point2D.Float adjustAt = points.toLength(evaluateAt, adjustmentRadius);
    float noZeros = 0.25f;
    float adjustment = (float) rtgWorld.cellularInstance(2).eval2D(adjustAt.x, adjustAt.y).interiorValue() + noZeros;
    float reAdjustment = (float) rtgWorld.cellularInstance(3).eval2D(adjustAt.x, adjustAt.y).interiorValue() + noZeros;
    // 0 to 1 which is currently undesirable so increase to average closer to 1
    adjustment = TerrainBase.bayesianAdjustment(adjustment, reAdjustment);
    // invert adjustment for Bryce
    raise = TerrainBase.bayesianAdjustment(raise, 1f / (adjustment * adjustment));
    return raise;
}
Also used : Point2D(java.awt.geom.Point2D) VoronoiResult(rtg.api.util.noise.VoronoiResult)

Example 4 with VoronoiResult

use of rtg.api.util.noise.VoronoiResult in project Realistic-Terrain-Generation by Team-RTG.

the class VoronoiBorderEffect method added.

@Override
public float added(RTGWorld rtgWorld, float x, float y) {
    VoronoiResult points = rtgWorld.cellularInstance(1).eval2D(x / pointWavelength, y / pointWavelength);
    float raise = (float) (points.interiorValue());
    raise = 1.0f - raise;
    // raise = TerrainBase.blendedHillHeight(raise, floor);
    return raise;
}
Also used : VoronoiResult(rtg.api.util.noise.VoronoiResult)

Example 5 with VoronoiResult

use of rtg.api.util.noise.VoronoiResult in project Realistic-Terrain-Generation by Team-RTG.

the class VoronoiPlateauEffect method added.

@Override
public float added(RTGWorld rtgWorld, float x, float y) {
    Point2D.Float evaluateAt = new Point2D.Float(x / pointWavelength, y / pointWavelength);
    VoronoiResult points = rtgWorld.cellularInstance(1).eval2D(evaluateAt.x, evaluateAt.y);
    float raise = (float) (points.interiorValue());
    // now we're going to get an adjustment value which will be the same
    // for all points on a given vector from the voronoi basin center
    Point2D.Float adjustAt = points.toLength(evaluateAt, adjustmentRadius);
    float multiplier = 1.3f;
    float noZeros = 0.1f;
    float adjustment = (float) rtgWorld.cellularInstance(2).eval2D(adjustAt.x, adjustAt.y).interiorValue() * multiplier + noZeros;
    float reAdjustment = (float) rtgWorld.cellularInstance(3).eval2D(adjustAt.x, adjustAt.y).interiorValue() * multiplier + noZeros;
    // 0 to 1 which is currently undesirable so increase to average closer to 1
    adjustment = TerrainBase.bayesianAdjustment(adjustment, reAdjustment);
    raise = TerrainBase.bayesianAdjustment(raise, adjustment);
    return raise;
}
Also used : Point2D(java.awt.geom.Point2D) VoronoiResult(rtg.api.util.noise.VoronoiResult)

Aggregations

VoronoiResult (rtg.api.util.noise.VoronoiResult)5 Point2D (java.awt.geom.Point2D)2 ISimplexData2D (rtg.api.util.noise.ISimplexData2D)1 SimplexOctave (rtg.api.util.noise.SimplexOctave)1