package common.rng;

public class OctaveGenOld extends NoiseGen {
	private final ImprovedGenOld generators[];
	private final int octaves;

	public OctaveGenOld(Random random, int octs) {
		this.octaves = octs;
		this.generators = new ImprovedGenOld[octs];
		
		for(int n = 0; n < octs; n++) {
			this.generators[n] = new ImprovedGenOld(random);
		}
	}

	public void generate(double noise[], int xoff, int yoff, int zoff, int xsize, int ysize, int zsize, double xscale, double yscale,
			double zscale) {
//		if(noise == null) {
//			noise = new double[xsize * ysize * zsize];
//		}
//		else {
			for(int n = 0; n < noise.length; n++) {
				noise[n] = 0.0D;
			}
//
//		}
		double factor = 1.0D;
		for(int n = 0; n < this.octaves; n++) {
			this.generators[n].generate(noise, xoff, yoff, zoff, xsize, ysize, zsize, xscale * factor, yscale * factor, zscale * factor, factor);
			factor /= 2D;
		}

//		return noise;
	}
}
