aurorae2
2009-11-15 12:52:59
Now with randomized variations on the horizon palette and procedural terrain.
class TerrainGen {
static final int maxDepth = 6;
static final float spreadX = 0.75f;
static final float spreadY = 0.35f;
static private void gen(float[] xs,
float[] ys,
float leftX,
float rightX,
float leftY,
float rightY,
int idx,
int depth) {
if(depth > 0) {
float fracX = (1-spreadX)*0.5f + spreadX*(float)Math.random();
float midX = (1-fracX)*leftX + fracX*rightX;
float midY = (1-fracX)*leftY + fracX*rightY;
float midYPrime = midY + spreadY*(float)Math.random()/(1<