00001 package org.hfbk.vis.visnode;
00002 import org.dronus.graph.Node;
00003 import org.lwjgl.opengl.GL11;
00004 import org.lwjgl.util.vector.Vector3f;
00005
00006 public abstract class VisHeightfield extends VisNode {
00007
00008 float t;
00009
00010 public VisHeightfield(Node node, Vector3f position) {
00011 super(node, position);
00012 }
00013
00014 abstract float[][] heightMap(float t);
00015
00016 void renderSelf() {
00017
00018 t+= getRoot().client.dt;
00019
00020 float[][] z=heightMap(t);
00021
00022 int mx=z.length, my=z[0].length;
00023
00024 GL11.glColor3f(1,1,1);
00025 for (int x = 0; x < mx; x++) {
00026 GL11.glBegin(GL11.GL_LINE_STRIP);
00027 for (int y = 0; y < my; y++) GL11.glVertex3f(x,z[x][y],y);
00028 GL11.glEnd();
00029 }
00030 for (int y = 0; y < my; y++) {
00031 GL11.glBegin(GL11.GL_LINE_STRIP);
00032 for (int x = 0; x < mx; x++) GL11.glVertex3f(x,z[x][y],y);
00033 GL11.glEnd();
00034 }
00035 }
00036 }