Ejemplo n.º 1
0
	//tasta speciala (up/down/F1/F2..) apasata
	void notifySpecialKeyPressed(int key_pressed, int mouse_x, int mouse_y){

		float moveSpeed = 5;
		float rotateSpeedOX = moveSpeed / 200;
		float rotateSpeedOY = moveSpeed / 200;
		float rotateSpeedOZ = moveSpeed / 200;

		// Camera Rotate FPS
		if(key_pressed == GLUT_KEY_F1) lab::glut::enterFullscreen();
		if(key_pressed == GLUT_KEY_F2) lab::glut::exitFullscreen();

		if (key_pressed == GLUT_KEY_RIGHT) { camera.rotateFPS_OY(rotateSpeedOY); }
		if (key_pressed == GLUT_KEY_LEFT) { camera.rotateFPS_OY(-rotateSpeedOY); }

		if (key_pressed == GLUT_KEY_UP) { camera.rotateFPS_OX(rotateSpeedOX); }
		if (key_pressed == GLUT_KEY_DOWN) { camera.rotateFPS_OX(-rotateSpeedOX); }

	}
Ejemplo n.º 2
0
	//tasta apasata
	void notifyKeyPressed(unsigned char key_pressed, int mouse_x, int mouse_y){
		if(key_pressed == 27) lab::glut::close();	//ESC inchide glut si 
		if(key_pressed == 32) {	//SPACE
			//reincarca shader
			glDeleteProgram(gl_program_shader_gouraud);
			gl_program_shader_gouraud = lab::loadShader("shadere\\shader_gouraud_vertex.glsl", "shadere\\shader_gouraud_fragment.glsl");
		}
		// grid view
		if(key_pressed == 'g'){
			static bool wire =true;
			wire=!wire;
			glPolygonMode(GL_FRONT_AND_BACK, (wire?GL_LINE:GL_FILL));
		}
		// directional
		if (key_pressed == '1') {
			directional ^= 1;
		}
		// circular
		if (key_pressed == '2') {
			circular ^= 1;
		}
		// inainte
		if (key_pressed == 'w') {
			FPS.translateForward(1);
			eye_position = FPS.getPosition();
		}
		// inapoi 
		if (key_pressed == 's') {
			FPS.translateForward(-1);
			eye_position = FPS.getPosition();
		}
		// rotire stanga
		if (key_pressed == 'a') {
			FPS.rotateFPS_OY(5);
			eye_position = FPS.getPosition();
		}
		// rotire dreapta
		if (key_pressed == 'd') {
			FPS.rotateFPS_OY(-5);
			eye_position = FPS.getPosition();
		}
		// rotire sus
		if (key_pressed == 'q') {
			FPS.rotateFPS_OX(-5);
			eye_position = FPS.getPosition();
		}
		// rotire jos
		if (key_pressed == 'e') {
			FPS.rotateFPS_OX(5);
			eye_position = FPS.getPosition();
		}
		// rotire oz
		if (key_pressed == 'z') {
			FPS.rotateFPS_OZ(-5);
			eye_position = FPS.getPosition();
		}
		// rotire oz
		if (key_pressed == 'c') {
			FPS.rotateFPS_OZ(5);
			eye_position = FPS.getPosition();
		}

	}