コード例 #1
0
ファイル: main.cpp プロジェクト: flaviusone/EGC
	//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 shaderul si recalculeaza locatiile (offseti/pointeri)
			glDeleteProgram(gl_program_shader);
			gl_program_shader = lab::loadShader("shadere\\shader_vertex.glsl", "shadere\\shader_fragment.glsl");
		}
		if(key_pressed == 'i'){
			static bool wire =true;
			wire=!wire;
			glPolygonMode(GL_FRONT_AND_BACK, (wire?GL_LINE:GL_FILL));
		}
		if(key_pressed == 'w') { cam1.translateForward(1.0f); }
		if(key_pressed == 'a') { cam1.translateRight(-1.0f); }
		if(key_pressed == 's') { cam1.translateForward(-1.0f); }
		if(key_pressed == 'd') { cam1.translateRight(1.0f); }
		if(key_pressed == 'r') { cam1.translateUpword(1.0f); }
		if(key_pressed == 'f') { cam1.translateUpword(-1.0f); }
		if(key_pressed == 'q') { cam1.rotateFPSoY(1.0f); }
		if(key_pressed == 'e') { cam1.rotateFPSoY(-1.0f); }
		if(key_pressed == 'z') { cam1.rotateFPSoZ(-1.0f); }
		if(key_pressed == 'c') { cam1.rotateFPSoZ(1.0f); }
		if(key_pressed == 't') { cam1.rotateFPSoX(1.0f); }
		if(key_pressed == 'g') { cam1.rotateFPSoX(-1.0f); }
		if(key_pressed == 'o') { cam1.set(glm::vec3(0,0,40), glm::vec3(0,0,0), glm::vec3(0,1,0)); }
		if(key_pressed == '1') { cam1.rotateTPSoX(1.0f,40.0f); }
		if(key_pressed == '2') { cam1.rotateTPSoX(-1.0f,40.0f); }
		if(key_pressed == '3') { cam1.rotateTPSoY(1.0f,40.0f); }
		if(key_pressed == '4') { cam1.rotateTPSoY(-1.0f,40.0f); }
		if(key_pressed == '5') { cam1.rotateTPSoZ(1.0f,40.0f); }
		if(key_pressed == '6') { cam1.rotateTPSoZ(-1.0f,40.0f); }
		if (key_pressed == '7') { active_camera = 1; }
		if (key_pressed == '8') { active_camera = 2; }
		if (key_pressed == '9') { active_camera = 3; }
		if (key_pressed == '0') { active_camera = 4; }
		
	}
コード例 #2
0
	void notifyKeyPressed(unsigned char key_pressed, int mouse_x, int mouse_y){
		//ESC inchide glut.
		if (key_pressed == 27) lab::glut::close();
		if (key_pressed == 'W') {
			static bool wire = true;
			wire = !wire;
			glPolygonMode(GL_FRONT_AND_BACK, (wire ? GL_LINE : GL_FILL));
		}
		// Taste pentru deplasarea camerei FPS de sus.
		if (key_pressed == 'w')
			view1->translateForward(1.0f);
		if (key_pressed == 's')
			view1->translateForward(-1.0f);
		if (key_pressed == 'q')
			view1->translateUpword(1.0f);
		if (key_pressed == 'e')
			view1->translateUpword(-1.0f);
		if (key_pressed == 'a')
			view1->translateRight(-1.0f);
		if (key_pressed == 'd')
			view1->translateRight(1.0f);
		if (key_pressed == '1')
			view1->rotateFPSoX(1.0f);
		if (key_pressed == '2')
			view1->rotateFPSoX(-1.0f);
		if (key_pressed == '3')
			view1->rotateFPSoY(1.0f);
		if (key_pressed == '4')
			view1->rotateFPSoY(-1.0f);
		if (key_pressed == '5')
			view1->rotateFPSoZ(1.0f);
		if (key_pressed == '6')
			view1->rotateFPSoZ(-1.0f);
		if (key_pressed == 'c')
			is_fps = !is_fps;
		modified = true;
	}