Beispiel #1
0
static void input_update(CAMERA_POSITION *cam) {
	if (keys_down[SDLK_DOWN]) {
		rotateCamera_X(cam, 0.005);
		setUpAndLoadModelViewMatrix(cam);
	} else if (keys_down[SDLK_UP]) {
		rotateCamera_X(cam, -0.005);
		setUpAndLoadModelViewMatrix(cam);
	}
	if (keys_down[SDLK_RIGHT]) {
		rotateCamera_Z(cam, 0.005);
		setUpAndLoadModelViewMatrix(cam);
	} else if (keys_down[SDLK_LEFT]) {
		rotateCamera_Z(cam, -0.005);
		setUpAndLoadModelViewMatrix(cam);
	}
	if (keys_down[SDLK_q]) {
		rotateCamera_Y(cam, -0.005);
		setUpAndLoadModelViewMatrix(cam);
	} else if (keys_down[SDLK_e]) {
		rotateCamera_Y(cam, 0.005);
		setUpAndLoadModelViewMatrix(cam);
	}

	if (keys_down[SDLK_w]) {
		moveCameraForward(cam,0.005);
		setUpAndLoadModelViewMatrix(cam);
	} else if (keys_down[SDLK_s]) {
		moveCameraForward(cam,-0.005);
		setUpAndLoadModelViewMatrix(cam);
	}

	if (keys_down[SDLK_a]) {
		moveCameraStrafe(cam, -0.005);
		setUpAndLoadModelViewMatrix(cam);
	} else if (keys_down[SDLK_d]) {
		moveCameraStrafe(cam, 0.005);
		setUpAndLoadModelViewMatrix(cam);
	}

//	if (keys_down[SDLK_SPACE]) {
//		cam->offset[1] -= 0.001; // -y
//		setUpAndLoadModelViewMatrix(cam);
//	} else if (keys_down[SDLK_c]) {
//		cam->offset[1] += 0.001; // +y
//		setUpAndLoadModelViewMatrix(cam);
//	}



	if(keys_down[SDLK_r]) {
		r_reset(cam);
	}
}
Beispiel #2
0
void Navigation::moveCameraBackward(float length) {
    moveCameraForward( -length );
}