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(); }
/** Usage: java ...Tunnelblick [sensitivity=1.0 [useopenni=false]] */ public static void main(String[] argv) { float sensitivity = 1.0f; boolean withOpenNi = false; if (argv.length >= 1) sensitivity = Float.valueOf(argv[0]).floatValue(); if (argv.length >= 2) withOpenNi = Boolean.valueOf(argv[1]); OpenNiBodyTrackerInputDriver onbtid = withOpenNi ? new OpenNiBodyTrackerInputDriver(true) : null; GameManager man = new GameManager("Tunnelblick", 800, 600); KeyboardGestureInputDriver kgid = new KeyboardGestureInputDriver(); kgid.bind(java.awt.event.KeyEvent.VK_SPACE, InputEvent.GESTURE_JUMP); man.installInputDriver(kgid); MouseButtonGestureInputDriver mbgid = new MouseButtonGestureInputDriver(); mbgid.bind(java.awt.event.MouseEvent.BUTTON1, InputEvent.GESTURE_JUMP); man.installInputDriver(mbgid); ModalMouseMotionInputDriver mmmid = new ModalMouseMotionInputDriver(); mmmid.setPointerMode(false); man.installInputDriver(mmmid); if (withOpenNi) man.installInputDriver(onbtid); Tunnelblick state = new Tunnelblick(man); state.getPlayer().setSensitivity(sensitivity); man.setState(state); man.run(); man.destroy(); }
public Tunnelblick(GameManager man) { this.man = man; player = new Player(this); field.add(player); music = new MusicPlayer(distortion); man.getAudioPlayer().addSource(music, (short) 0x7FFF); }