Exemple #1
0
void motion(int x, int y)
{	
	
    float dx, dy;
    dx = (float)( mouse_old_x-x);
    dy = (float)( mouse_old_y-y);

	 if( dx !=0 || dy!=0)
	 {
		if (mouse_buttons == GLUT_RIGHT_BUTTON)  // Rotate
			{
				//cout<<"mouse left button";
				changeYaw(dx * 0.01);
				changePitch(-dy * 0.01);
			}
			else if (mouse_buttons == GLUT_MIDDLE_BUTTON) // Zoom
			{
				changeAltitude(-dy * 0.01);
			}    

			if (mouse_buttons ==  GLUT_LEFT_BUTTON) // camera move
			{
				changeRadius(-dy*0.01f);
			}
		mouse_old_x = x;
		mouse_old_y = y;
		//cudaDeviceReset();
		//pathtracerReset();
	//	deletePBO(&pbo);
		//runCuda(); 
		
		for(int i=0; i<renderCam->resolution.x*renderCam->resolution.y; i++){
		renderCam->image[i] = glm::vec3(0,0,0);
		}
		iterations=0;
		glutPostRedisplay();
	 }
}
void Quadcopter::liftOff(int newAltitude)
{
	changeAltitude(newAltitude);
}