class WaterOld extends Terrain{ float[][] changeMap; float[][] flow; float step = 0.9; float volume; Terrain terrain; //------------ WaterOld( Terrain t, float pillarHeight ){ super(t.w,t.h,t.res,t.zScale); this.terrain = t; wireframe = false; // initialize arrays flow = new float[res][res]; changeMap = new float[res][res]; for(int x=0;x 0 ){ // water cell // calculate total volume volume += getWaterHeight(x,y); for(int i=0; i<4; i++){ // loop through the nearest neighbours if( 0 < (diff = getDiff(x,y,x+nx[i],y+ny[i])) ){ changeMap[x+nx[i]][y+ny[i]] += step * diff/4; changeMap[x][y] -= step * diff/4; flow[x][y] += diff; flow[x+nx[i]][y+ny[i]] += diff; } }//endloop }// endif } } for(int x=0;x0 ? heightMap[x][y] : heightMap[x][y]-4 ); } //------------ void buildVertexColors(){ for(int x=1;x