p = new Player(Vector3.zero());
p.setWalkSpeed(50);
Light l = new Light(Color.WHITE);
l.directional = true;
l.pos = new Vector3(0, 1, 0);
l.setAttenuation(1.0f, 0.0f, 0.0f);
crosshair = sprite(new Material(loadTexture(new File("materials/crosshair.png"))), 1, 1);
int pow = 8;
int w = (1 << pow);
t = new float[w][w];
///diamondSquare(t, w);
//NoiseTest.generateTerrain(t, w);
FFTTest.generateTerrain(t, w);
try {
fbo = new FrameBuffer(1024, 1024, p);
fbo.setRepeat(false);
fbo.setFilter(GL11.GL_NEAREST, GL11.GL_NEAREST);
Shader vert = Shader.loadPrebuilt("texture.vert", Shader.Type.VERTEX);
Shader frag = loadShader(new File("shaders/test.frag"), Shader.Type.FRAGMENT);
post = new ShaderProgram(vert, frag);
fbo.postProcess(post);
} catch (LWJGLException ex) {
Logger.getLogger(AspectTest.class.getName()).log(Level.SEVERE, null, ex);
}
terrain = new Entity(genMesh(t, new Material(loadTexture(new File("materials/rock.jpg"))), 32.0f, 0.25f));
//Material wat = new Material(new Color(0.0f, 0.1f, 0.6f, 0.7f));
Material wat = new Material(loadTexture(new File("materials/water.jpg")));
//wat.specular = Color.WHITE;
wat.shininess = 0.05f;
wat.shader = ShaderProgram.loadPrebuilt("water");
water = new Entity(rect(wat, 8.0f, 8.0f, w, w));
water.ang.pitch = -90;
water.pos = new Vector3(w / 2.0f, 0, w / 2.0f);
Material sky = new Material(loadTexture(new File("materials/stars.jpg")));
sky.shader = ShaderProgram.TEXTURE;
skybox = box(sky, 1.0f, 1.0f, 1.0f);
//makeFog(0.01f, Color.WHITE, 1);
world = new ListWorld();
for (int i = 0; i < 50; i++) {
int x;
int z;
do {
x = r.nextInt(w);
z = r.nextInt(w);
} while (t[x][z] < 0.0f);
Tree tree = new Tree();
tree.pos = new Vector3(x, t[x][z] + tree.height / 2, z);
world.add(tree);
}
}