public void configureGL(GL2 gl) { gl.glEnable(GL2.GL_FOG); gl.glFogi(GL2.GL_FOG_MODE, GL2.GL_LINEAR); gl.glFogf(GL2.GL_FOG_DENSITY, 0.25f); gl.glFogf(GL2.GL_FOG_START, Math.max(getNearClippingPlane(), fadeOut * 1.0f)); gl.glFogf(GL2.GL_FOG_END, Math.max(1.1f, fadeOut * 1.1f * getSpawnDistance())); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); gl.glFrustumf(-1, 1, -man.vheight(), man.vheight(), getNearClippingPlane(), 128.0f); gl.glScalef(2.0f, 2.0f, 1); gl.glTranslatef(-0.5f, -man.vheight() / 2.0f, 0); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); }
/** Returns the distance at which objects should spawn. */ public float getSpawnDistance() { return Math.min(8 * player.getSpeed(), Tunnel.GRID_LENGTH * Tunnel.GSQ_LEN / 2); }