// Daniel Shiffman // Wavey // December 2005 int xres = 60; int yres = 60; int w; int h; float[][] z; float a1,a2,a3; float zoff = PI; void setup() { size(320,240,P3D); colorMode(RGB,255,255,255,255); z = new float[xres+1][yres+1]; w = width/xres; h = height/yres; framerate(30); //smooth(); } void draw() { background(75,50,50); noStroke(); zoff += 0.01f; float xoff = 0.0; for (int x = 0; x < z.length; x++) { xoff += 0.05; float yoff = 0.0; for (int y = 0; y < z[x].length; y++) { z[x][y] = (noise(xoff,yoff,zoff)*255.0f); yoff += 0.08; } } translate(width/2,height/2,sin(zoff)*250.0f); float alph = 90; rotateX(a1); a1 += 0.01f; rotateY(a2); a2 += 0.013f; rotateZ(a3); a3 += 0.018f; for (int x = 0; x < z.length-1; x++) { for (int y = 0; y < z[x].length-1; y++) { pushMatrix(); beginShape(QUADS); translate(x*w-width/2,y*h-height/2,0); fill(0,z[x][y]/2,z[x][y],z[x][y]); vertex(0,0,z[x][y]); fill(0,z[x+1][y]/2,z[x+1][y],z[x+1][y]); vertex(w,0,z[x+1][y]); fill(0,0,z[x+1][y+1],z[x+1][y+1]); vertex(w,h,z[x+1][y+1]); fill(0,0,z[x][y+1],z[x][y+1]); vertex(0,h,z[x][y+1]); endShape(); popMatrix(); } } }