public float lakePressure(RTGWorld rtgWorld, int x, int y, float border) { if (noLakes) { 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); double[] lakeResults = rtgWorld.cell.river().eval((float)pX / lakeInterval, (float)pY / lakeInterval); float results = 1f - (float)((lakeResults[1] - lakeResults[0]) / lakeResults[1]); if (results > 1.01) { throw new Exception("" + lakeResults[0] + " , " + lakeResults[1]); } if (results < -.01) { throw new Exception("" + lakeResults[0] + " , " + lakeResults[1]); } //return simplexCell.river().noise((float)x/ lakeInterval, (float)y/ lakeInterval,1.0); return(results); }
override public float added(RTGWorld rtgWorld, float x, float y) { running = true; rtgWorld.simplex.riverJitter().evaluateNoise((float)x / wavelength, (float)y / wavelength, jitter); int pX = (int)Math.Round(x + jitter.deltax() * amplitude); int pY = (int)Math.Round(y + jitter.deltay() * amplitude); running = false; return(jittered.added(rtgWorld, pX, pY)); }
override public float getRiverStrength(int x, int z) { //New river curve function. No longer creates worldwide curve correlations along cardinal axes. SimplexOctave.Disk jitter = new SimplexOctave.Disk(); simplex.riverJitter().evaluateNoise((float)x / 240.0, (float)z / 240.0, jitter); double pX = x + jitter.deltax() * largeBendSize; double pZ = z + jitter.deltay() * largeBendSize; simplex.octave(2).evaluateNoise((float)x / 80.0, (float)z / 80.0, jitter); pX += jitter.deltax() * smallBendSize; pZ += jitter.deltay() * smallBendSize; double xRiver = pX / riverSeparation; double zRiver = pZ / riverSeparation; //New cellular noise. //TODO move the initialization of the results in a way that's more efficient but still thread safe. //double[] results = cell.river().eval(xRiver,zRiver ); //return (float) cellBorder(results, riverValleyLevel, 1.0); return(river.octave(0).border2(xRiver, zRiver, riverValleyLevel, 1f)); }